From 8eb4bab9d7e84559b4ea64349aec05313f207123 Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Sun, 24 Mar 2024 00:02:40 +0100 Subject: [PATCH] Version for GDEY042T81 --- lib/obp60task/OBP60Extensions.cpp | 24 ++++++++++++++++++++++++ lib/obp60task/OBP60Extensions.h | 14 ++++++++++++++ lib/obp60task/obp60task.cpp | 25 +++++++++++++++++-------- lib/obp60task/platformio.ini | 4 ++-- 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 6511d88..b4c191f 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -25,10 +25,34 @@ // E-Ink Display #define GxEPD_WIDTH 400 // Display width #define GxEPD_HEIGHT 300 // Display height + +#ifdef DISPLAY_GDEW042T2 // Set display type and SPI pins for display GxEPD2_BW display(GxEPD2_420(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398) // Export display in new funktion GxEPD2_BW & getdisplay(){return display;} +#endif + +#ifdef DISPLAY_GDEY042T81 +// Set display type and SPI pins for display +GxEPD2_BW display(GxEPD2_420_GDEY042T81(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398) +// Export display in new funktion +GxEPD2_BW & getdisplay(){return display;} +#endif + +#ifdef DISPLAY_GYE042A8 +// Set display type and SPI pins for display +GxEPD2_BW display(GxEPD2_420_GYE042A87(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398) +// Export display in new funktion +GxEPD2_BW & getdisplay(){return display;} +#endif + +#ifdef DISPLAY_SE0420NQ04 +// Set display type and SPI pins for display +GxEPD2_BW display(GxEPD2_420_SE0420NQ04(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398) +// Export display in new funktion +GxEPD2_BW & getdisplay(){return display;} +#endif // Horter I2C moduls PCF8574 pcf8574_Out(PCF8574_I2C_ADDR1); // First digital output modul PCF8574 from Horter diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index 5a929a1..e679ee1 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -19,7 +19,21 @@ extern const GFXfont DSEG7Classic_BoldItalic42pt7b; extern const GFXfont DSEG7Classic_BoldItalic60pt7b; // Gloabl functions +#ifdef DISPLAY_GDEW042T2 GxEPD2_BW & getdisplay(); +#endif + +#ifdef DISPLAY_GDEY042T81 +GxEPD2_BW & getdisplay(); +#endif + +#ifdef DISPLAY_GYE042A8 +GxEPD2_BW & getdisplay(); +#endif + +#ifdef DISPLAY_SE0420NQ04 +GxEPD2_BW & getdisplay(); +#endif void hardwareInit(); diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 1bacffa..530ddb1 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -245,7 +245,8 @@ void OBP60Task(GwApi *api){ int pixelcolor = GxEPD_BLACK; int bgcolor = GxEPD_WHITE; - getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse + getdisplay().init(115200); // Init for nolrmal displays + // getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse getdisplay().setRotation(0); // Set display orientation (horizontal) if(displaycolor == "Normal"){ textcolor = GxEPD_BLACK; @@ -262,18 +263,26 @@ void OBP60Task(GwApi *api){ getdisplay().fillScreen(bgcolor); // Draw white sreen getdisplay().setTextColor(textcolor); // Set display color getdisplay().nextPage(); // Full Refresh - + getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update + getdisplay().fillScreen(bgcolor); // Draw white sreen + getdisplay().nextPage(); // Fast Refresh + getdisplay().nextPage(); // Fast Refresh if(String(displaymode) == "Logo + QR Code" || String(displaymode) == "Logo"){ + getdisplay().fillScreen(bgcolor); // Draw white sreen getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), pixelcolor); // Draw start logo - getdisplay().nextPage(); // Full Refresh - delay(SHOW_TIME); // Logo show time - getdisplay().nextPage(); // Full Refresh + getdisplay().nextPage(); // Fast Refresh + getdisplay().nextPage(); // Fast Refresh + delay(SHOW_TIME); // Logo show time if(String(displaymode) == "Logo + QR Code"){ - qrWiFi(systemname, wifipass, displaycolor); // Show QR code for WiFi connection - delay(SHOW_TIME); // QR code show time getdisplay().fillScreen(bgcolor); // Draw white sreen - getdisplay().nextPage(); // Full Refresh + qrWiFi(systemname, wifipass, displaycolor); // Show QR code for WiFi connection + getdisplay().nextPage(); // Fast Refresh + getdisplay().nextPage(); // Fast Refresh + delay(SHOW_TIME); // QR code show time } + getdisplay().fillScreen(bgcolor); // Draw white sreen + getdisplay().nextPage(); // Fast Refresh + getdisplay().nextPage(); // Fast Refresh } // Init pages diff --git a/lib/obp60task/platformio.ini b/lib/obp60task/platformio.ini index 2b384d8..fcc6cbf 100644 --- a/lib/obp60task/platformio.ini +++ b/lib/obp60task/platformio.ini @@ -33,8 +33,8 @@ lib_deps = build_flags= -DTIME=$UNIX_TIME -D BOARD_OBP60S3 - -D DISPLAY_GDEW042T2 #old E-Ink display from Waveshare, R10 0.47 ohm -# -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm +# -D DISPLAY_GDEW042T2 #old E-Ink display from Waveshare, R10 0.47 ohm + -D DISPLAY_GDEY042T81 #new E-Ink display from Waveshare, R10 2.2 ohm # -D DISPLAY_GYE042A8 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm # -D DISPLAY_SE0420NQ04 #alternativ E-Ink display from SID Technology, R10 2.2 ohm ${env.build_flags}