I'm using a EPD (2.7" from Adafruit). But I think it is about the GFX Library.
I have variable "Temperature" which comes as a float value
From the GFX Library I use:
Code: Select all
display.setCursor(20 - display.getTextBounds(String(Temperature)) / 2 , 20);
display.print(Temperature, 1);
With that I want to center the value on the EPD Display
It's completely off. Like by 50 pixels or so.
But, if I do:
Code: Select all
int TemperatureInt = Temperature;
display.setCursor(20 - display.getTextBounds(String(TemperatureInt)) / 2 , 20);
display.print(TemperatureInt, 0);
It's spot on in the center.
So it seems to be a problem with the float variable.
Do I use it wrong, or is it a limitation in the library?
Thank you for your time.
I use the GFX version 1.8.5. Why so old?
See other post:
Because I tried 1.10.12 and the EPD display only prints in red, not black. Also the examples of Adafruit for the EPD do that. My EPD Lib is 4.4.2