#define ENABLE_GxEPD2_GFX 0 #include #include #include "creds.h" #include "dow_fetch.h" #include "dow.h" #define DOW_ENDPOINT "http://screen-data.lan/api/dow" // #define DOW_ENDPOINT "http://192.168.0.210:8062/api/dow" GxEPD2_BW display(GxEPD2_583_GDEQ0583T31(/*CS=*/GPIO_NUM_5, /*DC=*/GPIO_NUM_17, /*RST=*/GPIO_NUM_16, /*BUSY=*/GPIO_NUM_4)); // GDEQ0583T31 648x480, UC8179, (P583010-MF1-B) const char *ssid = WIFI_SSID; const char *password = WIFI_PASS; void setup() { Serial.begin(115200); Serial.println(); Serial.println("setup"); delay(100); Serial.println("Display power ON"); display.init(115200); display.fillScreen(GxEPD_WHITE); display.setFont(&FreeSans12pt7b); int16_t tbx, tby; uint16_t tbw, tbh; display.getTextBounds("connecting...", 0, 0, &tbx, &tby, &tbw, &tbh); // center bounding box by transposition of origin: uint16_t x = ((display.width() - tbw) / 2) - tbx; uint16_t y = ((display.height() - tbh) / 2) - tby; display.setFullWindow(); display.setRotation(0); display.setTextColor(GxEPD_BLACK); display.firstPage(); do { display.fillScreen(GxEPD_WHITE); display.setCursor(x, y); display.print("connecting..."); } while (display.nextPage()); Serial.print("Connecting to wifi: "); delay(500); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.print("Connected"); delay(500); } std::vector current_items; void loop() { dow_fetch(DOW_ENDPOINT, current_items); dow_render(display, current_items); display.powerOff(); delay(10000); }