I'm creating a device that downloads temperature data from a IoT logging server and displays it on a small screen. The hardware is the LOLIN D32 Pro and the LOLIN 2.13 EPD (Electronic Paper Display). The libraries used are ThingSpeak, LOLIN_EPD, and Adafruit_GFX.
In programing the display, I am encountering two strange problems.
- I want the display to have large numbers, so I used the included tool to created a 60pt version of the FreeSans font that is part of the GFX library. If I try to put the custom font file in the sketch folder and include it with
#include "FreeSansBold60pt7b.h"
I get the error:
sketch\7_EPD.h: In function 'void writeEPD()':
7_EPD.h:7:15: error: 'FreeSansBold60pt7b' was not declared in this scope
EPD.setFont(&FreeSansBold60pt7b);
^
However, if I copy the custom font file to the Fonts folder of the GFX library and include it as if it were one of the provided fonts with
#include <Fonts\FreeSansBold60pt7b.h>
, it works just fine. Any idea of what's going on here?
- When the numbers are displayed on the screen, they are mostly off the screen. I used the
EPD.getTextBounds
function provided in the library to see what was going on and the function reports that the text is using the start coordinates of 5,-85 (even though the current cursor position is set to 0,0). If I use the numbers from
EPD.getTextBounds
to set
EPD.setCursor
at 0,85 the text displays fine, but I would like to know why it's starting out at a high negative number?
For reference, the problem didn't just happen with my custom font, it was happening the same way when I was using one of the provided fonts
EPD.setFont(&FreeSansBold12pt7b);
EPD.setTextSize(5);
In case you need it for reference, I've attached the complete sketch below.
RemoteSHT-DispEPD.zip (28.5 KB)