From 74ec5e8a5cc8309729dbac84b834e05f96a9977c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 19 Jan 2023 00:21:21 +0100 Subject: [PATCH 1/5] add support for 128x128 b/w display GME128128-01-IIC --- platformio.ini | 2 +- src/graphics/Screen.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index e58656dd2..d5c5b13df 100644 --- a/platformio.ini +++ b/platformio.ini @@ -58,7 +58,7 @@ build_flags = -Wno-missing-field-initializers monitor_speed = 115200 lib_deps = - https://github.com/meshtastic/esp8266-oled-ssd1306.git#53580644255b48ebb7a737343c6b4e71c7e11cf2 ; ESP8266_SSD1306 + https://github.com/meshtastic/esp8266-oled-ssd1306.git#da1ede4dfcd91074283b029080759fd744120909 ; ESP8266_SSD1306 mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159 https://github.com/meshtastic/TinyGPSPlus.git#127ad674ef85f0201cb68a065879653ed94792c4 diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index abaeec660..43546af5c 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -908,7 +908,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ // } // } // #else -Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl), ui(&dispdev) +Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl, screen_model == Config_DisplayConfig_OledType_OLED_SH1107 ? GEOMETRY_128_128 : GEOMETRY_128_64), ui(&dispdev) { address_found = address; cmdQueue.setReader(this); @@ -958,6 +958,8 @@ void Screen::setup() useDisplay = true; #ifdef AutoOLEDWire_h + if (screen_model == Config_DisplayConfig_OledType_OLED_SH1107) + screen_model = Config_DisplayConfig_OledType_OLED_SH1106; dispdev.setDetected(screen_model); #endif From 50f72b0ea0c7a5870d246e9c05ff620407ae3a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 19 Jan 2023 08:49:19 +0100 Subject: [PATCH 2/5] add the possibility to #define USE_SH1107 to fix boards to this display. --- src/graphics/Screen.h | 7 ++----- src/main.cpp | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 3988fa1a8..c82653284 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -34,7 +34,7 @@ class Screen #ifdef USE_ST7567 #include -#elif defined(USE_SH1106) +#elif defined(USE_SH1106) || defined(USE_SH1107) #include #elif defined(USE_SSD1306) #include @@ -342,10 +342,7 @@ class Screen : public concurrency::OSThread /// Display device -// #ifdef RAK4630 -// EInkDisplay dispdev; -// AutoOLEDWire dispdev_oled; -#ifdef USE_SH1106 +#if defined(USE_SH1106) || defined(USE_SH1107) SH1106Wire dispdev; #elif defined(USE_SSD1306) SSD1306Wire dispdev; diff --git a/src/main.cpp b/src/main.cpp index 76a6a6b6f..409bb3e25 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -305,6 +305,10 @@ void setup() if (config.display.oled != Config_DisplayConfig_OledType_OLED_AUTO) screen_model = config.display.oled; +#if defined(USE_SH1107) + screen_model = Config_DisplayConfig_OledType_OLED_SH1107; // set dimension of 128x128 +#endif + // Init our SPI controller (must be before screen and lora) initSPI(); #ifndef ARCH_ESP32 From cbd6a0065b00c3c7b4fc55cb3f47940b9ca1e16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 19 Jan 2023 10:16:42 +0100 Subject: [PATCH 3/5] trunk format --- src/graphics/Screen.cpp | 5 ++- src/graphics/Screen.h | 67 ++++++++++++++++++++++------------------- src/main.cpp | 32 ++++++++++---------- 3 files changed, 56 insertions(+), 48 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 43546af5c..8ab3076ee 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -908,7 +908,10 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ // } // } // #else -Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl, screen_model == Config_DisplayConfig_OledType_OLED_SH1107 ? GEOMETRY_128_128 : GEOMETRY_128_64), ui(&dispdev) +Screen::Screen(uint8_t address, int sda, int scl) + : OSThread("Screen"), cmdQueue(32), + dispdev(address, sda, scl, screen_model == Config_DisplayConfig_OledType_OLED_SH1107 ? GEOMETRY_128_128 : GEOMETRY_128_64), + ui(&dispdev) { address_found = address; cmdQueue.setReader(this); diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index c82653284..1a11df70e 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -7,15 +7,15 @@ namespace graphics { // Noop class for boards without screen. -class Screen +class Screen { public: - explicit Screen(char){} + explicit Screen(char) {} void onPress() {} void setup() {} void setOn(bool) {} - void print(const char*){} - void adjustBrightness(){} + void print(const char *) {} + void adjustBrightness() {} void doDeepSleep() {} void forceDisplay() {} void startBluetoothPinScreen(uint32_t pin) {} @@ -23,7 +23,7 @@ class Screen void startRebootScreen() {} void startFirmwareUpdateScreen() {} }; -} +} // namespace graphics #else #include @@ -49,9 +49,9 @@ class Screen #include "commands.h" #include "concurrency/LockGuard.h" #include "concurrency/OSThread.h" +#include "mesh/MeshModule.h" #include "power.h" #include -#include "mesh/MeshModule.h" // 0 to 255, though particular variants might define different defaults #ifndef BRIGHTNESS_DEFAULT @@ -132,13 +132,14 @@ class Screen : public concurrency::OSThread void setOn(bool on) { if (!on) - handleSetOn(false); // We handle off commands immediately, because they might be called because the CPU is shutting down + handleSetOn( + false); // We handle off commands immediately, because they might be called because the CPU is shutting down else enqueueCmd(ScreenCmd{.cmd = on ? Cmd::SET_ON : Cmd::SET_OFF}); } /** - * Prepare the display for the unit going to the lowest power mode possible. Most screens will just + * Prepare the display for the unit going to the lowest power mode possible. Most screens will just * poweroff, but eink screens will show a "I'm sleeping" graphic, possibly with a QR code */ void doDeepSleep(); @@ -223,29 +224,33 @@ class Screen : public concurrency::OSThread LASTCHAR = ch; switch (last) { // conversion depending on first UTF8-character - case 0xC2: { - SKIPREST = false; - return (uint8_t)ch; - } - case 0xC3: { - SKIPREST = false; - return (uint8_t)(ch | 0xC0); - } - // map UTF-8 cyrillic chars to it Windows-1251 (CP-1251) ASCII codes - // note: in this case we must use compatible font - provided ArialMT_Plain_10/16/24 by 'ThingPulse/esp8266-oled-ssd1306' library - // have empty chars for non-latin ASCII symbols - case 0xD0: { - SKIPREST = false; - if (ch == 129) return (uint8_t)(168); // Ё - if (ch > 143 && ch < 192) return (uint8_t)(ch + 48); - break; - } - case 0xD1: { - SKIPREST = false; - if (ch == 145) return (uint8_t)(184); // ё - if (ch > 127 && ch < 144) return (uint8_t)(ch + 112); - break; - } + case 0xC2: { + SKIPREST = false; + return (uint8_t)ch; + } + case 0xC3: { + SKIPREST = false; + return (uint8_t)(ch | 0xC0); + } + // map UTF-8 cyrillic chars to it Windows-1251 (CP-1251) ASCII codes + // note: in this case we must use compatible font - provided ArialMT_Plain_10/16/24 by 'ThingPulse/esp8266-oled-ssd1306' + // library have empty chars for non-latin ASCII symbols + case 0xD0: { + SKIPREST = false; + if (ch == 129) + return (uint8_t)(168); // Ё + if (ch > 143 && ch < 192) + return (uint8_t)(ch + 48); + break; + } + case 0xD1: { + SKIPREST = false; + if (ch == 145) + return (uint8_t)(184); // ё + if (ch > 127 && ch < 144) + return (uint8_t)(ch + 112); + break; + } } // We want to strip out prefix chars for two-byte char formats diff --git a/src/main.cpp b/src/main.cpp index 409bb3e25..f554c3785 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,12 +3,12 @@ #include "MeshService.h" #include "NodeDB.h" #include "PowerFSM.h" +#include "ReliableRouter.h" #include "airtime.h" #include "buzz.h" #include "configuration.h" #include "error.h" #include "power.h" -#include "ReliableRouter.h" // #include "debug.h" #include "FSCommon.h" #include "RTC.h" @@ -27,8 +27,8 @@ #include // #include -#include "mesh/http/WiFiAPClient.h" #include "mesh/eth/ethClient.h" +#include "mesh/http/WiFiAPClient.h" #ifdef ARCH_ESP32 #include "mesh/http/WebServer.h" @@ -98,7 +98,8 @@ uint32_t serialSinceMsec; bool pmu_found; // Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan -uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1] = { 0 }; // one is enough, missing elements will be initialized to 0 anyway. +uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1] = { + 0}; // one is enough, missing elements will be initialized to 0 anyway. Router *router = NULL; // Users of router don't care what sort of subclass implements that API @@ -169,7 +170,7 @@ void setup() #endif #ifdef DEBUG_PORT - consoleInit(); // Set serial baud rate and init our mesh console + consoleInit(); // Set serial baud rate and init our mesh console #endif serialSinceMsec = millis(); @@ -249,12 +250,11 @@ void setup() powerStatus->observe(&power->newStatus); power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration - #ifdef LILYGO_TBEAM_S3_CORE // In T-Beam-S3-core, the I2C device cannot be scanned before power initialization, otherwise the device will be stuck // PCF8563 RTC in tbeam-s3 uses Wire1 to share I2C bus Wire1.beginTransmission(PCF8563_RTC); - if (Wire1.endTransmission() == 0){ + if (Wire1.endTransmission() == 0) { rtc_found = PCF8563_RTC; LOG_INFO("PCF8563 RTC found\n"); } @@ -452,18 +452,18 @@ void setup() } #endif -// check if the radio chip matches the selected region + // check if the radio chip matches the selected region -if((config.lora.region == Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())){ - LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n"); - config.lora.region = Config_LoRaConfig_RegionCode_UNSET; - nodeDB.saveToDisk(SEGMENT_CONFIG); - if(!rIf->reconfigure()) { - LOG_WARN("Reconfigure failed, rebooting\n"); - screen->startRebootScreen(); - rebootAtMsec = millis() + 5000; + if ((config.lora.region == Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) { + LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n"); + config.lora.region = Config_LoRaConfig_RegionCode_UNSET; + nodeDB.saveToDisk(SEGMENT_CONFIG); + if (!rIf->reconfigure()) { + LOG_WARN("Reconfigure failed, rebooting\n"); + screen->startRebootScreen(); + rebootAtMsec = millis() + 5000; + } } -} #if HAS_WIFI || HAS_ETHERNET mqttInit(); From 0eaf0747f4499f50899dd6593dd8889920d9ccaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 20 Jan 2023 16:34:39 +0100 Subject: [PATCH 4/5] fix building other screen adapters --- src/graphics/EInkDisplay2.cpp | 165 +++++++++++++++++----------------- src/graphics/EInkDisplay2.h | 10 +-- src/graphics/TFTDisplay.cpp | 2 +- src/graphics/TFTDisplay.h | 6 +- 4 files changed, 90 insertions(+), 93 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 07fcd2c46..d211d91bd 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -1,11 +1,11 @@ #include "configuration.h" #ifdef USE_EINK -#include "main.h" #include "EInkDisplay2.h" -#include "SPILock.h" -#include #include "GxEPD2_BW.h" +#include "SPILock.h" +#include "main.h" +#include #define COLORED GxEPD_BLACK #define UNCOLORED GxEPD_WHITE @@ -14,26 +14,27 @@ #define TECHO_DISPLAY_MODEL GxEPD2_154_D67 #elif defined(RAK4630) -//GxEPD2_213_BN - RAK14000 2.13 inch b/w 250x122 - changed from GxEPD2_213_B74 - which was not going to give partial update support +// GxEPD2_213_BN - RAK14000 2.13 inch b/w 250x122 - changed from GxEPD2_213_B74 - which was not going to give partial update +// support #define TECHO_DISPLAY_MODEL GxEPD2_213_BN -//4.2 inch 300x400 - GxEPD2_420_M01 +// 4.2 inch 300x400 - GxEPD2_420_M01 //#define TECHO_DISPLAY_MODEL GxEPD2_420_M01 -//2.9 inch 296x128 - GxEPD2_290_T5D +// 2.9 inch 296x128 - GxEPD2_290_T5D //#define TECHO_DISPLAY_MODEL GxEPD2_290_T5D -//1.54 inch 200x200 - GxEPD2_154_M09 +// 1.54 inch 200x200 - GxEPD2_154_M09 //#define TECHO_DISPLAY_MODEL GxEPD2_154_M09 #elif defined(PCA10059) -//4.2 inch 300x400 - GxEPD2_420_M01 +// 4.2 inch 300x400 - GxEPD2_420_M01 #define TECHO_DISPLAY_MODEL GxEPD2_420_M01 #elif defined(M5_COREINK) -//M5Stack CoreInk -//1.54 inch 200x200 - GxEPD2_154_M09 +// M5Stack CoreInk +// 1.54 inch 200x200 - GxEPD2_154_M09 #define TECHO_DISPLAY_MODEL GxEPD2_154_M09 #endif @@ -42,34 +43,34 @@ GxEPD2_BW *adafruitDisplay; EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl) { - #if defined(TTGO_T_ECHO) +#if defined(TTGO_T_ECHO) setGeometry(GEOMETRY_RAWMODE, TECHO_DISPLAY_MODEL::WIDTH, TECHO_DISPLAY_MODEL::HEIGHT); - #elif defined(RAK4630) - - //GxEPD2_213_BN - RAK14000 2.13 inch b/w 250x122 +#elif defined(RAK4630) + + // GxEPD2_213_BN - RAK14000 2.13 inch b/w 250x122 setGeometry(GEOMETRY_RAWMODE, 250, 122); - //GxEPD2_420_M01 - //setGeometry(GEOMETRY_RAWMODE, 300, 400); + // GxEPD2_420_M01 + // setGeometry(GEOMETRY_RAWMODE, 300, 400); - //GxEPD2_290_T5D - //setGeometry(GEOMETRY_RAWMODE, 296, 128); + // GxEPD2_290_T5D + // setGeometry(GEOMETRY_RAWMODE, 296, 128); - //GxEPD2_154_M09 - //setGeometry(GEOMETRY_RAWMODE, 200, 200); - - #elif defined(PCA10059) + // GxEPD2_154_M09 + // setGeometry(GEOMETRY_RAWMODE, 200, 200); - //GxEPD2_420_M01 +#elif defined(PCA10059) + + // GxEPD2_420_M01 setGeometry(GEOMETRY_RAWMODE, 300, 400); - - #elif defined(M5_COREINK) - - //M5Stack_CoreInk 200x200 - //1.54 inch 200x200 - GxEPD2_154_M09 + +#elif defined(M5_COREINK) + + // M5Stack_CoreInk 200x200 + // 1.54 inch 200x200 - GxEPD2_154_M09 setGeometry(GEOMETRY_RAWMODE, EPD_HEIGHT, EPD_WIDTH); - #endif +#endif // setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution // setGeometry(GEOMETRY_128_64); // We originally used this because I wasn't sure if rawmode worked - it does } @@ -104,28 +105,28 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit) } LOG_DEBUG("Updating E-Paper... "); - - #if defined(TTGO_T_ECHO) + +#if defined(TTGO_T_ECHO) // ePaper.Reset(); // wake the screen from sleep adafruitDisplay->display(false); // FIXME, use partial update mode - #elif defined(RAK4630) - - //RAK14000 2.13 inch b/w 250x122 actually now does support partial updates - - //Full update mode (slow) - //adafruitDisplay->display(false); // FIXME, use partial update mode - - //Only enable for e-Paper with support for partial updates and comment out above adafruitDisplay->display(false); - // 1.54 inch 200x200 - GxEPD2_154_M09 - // 2.13 inch 250x122 - GxEPD2_213_BN - // 2.9 inch 296x128 - GxEPD2_290_T5D - // 4.2 inch 300x400 - GxEPD2_420_M01 +#elif defined(RAK4630) + + // RAK14000 2.13 inch b/w 250x122 actually now does support partial updates + + // Full update mode (slow) + // adafruitDisplay->display(false); // FIXME, use partial update mode + + // Only enable for e-Paper with support for partial updates and comment out above adafruitDisplay->display(false); + // 1.54 inch 200x200 - GxEPD2_154_M09 + // 2.13 inch 250x122 - GxEPD2_213_BN + // 2.9 inch 296x128 - GxEPD2_290_T5D + // 4.2 inch 300x400 - GxEPD2_420_M01 adafruitDisplay->nextPage(); - - #elif defined(PCA10059) || defined(M5_COREINK) + +#elif defined(PCA10059) || defined(M5_COREINK) adafruitDisplay->nextPage(); - #endif - +#endif + // Put screen to sleep to save power (possibly not necessary because we already did poweroff inside of display) adafruitDisplay->hibernate(); LOG_DEBUG("done\n"); @@ -175,41 +176,40 @@ bool EInkDisplay::connect() pinMode(PIN_EINK_EN, OUTPUT); #endif - #if defined(TTGO_T_ECHO) -{ - auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1); - - adafruitDisplay = new GxEPD2_BW(*lowLevel); - adafruitDisplay->init(); - adafruitDisplay->setRotation(3); -} -#elif defined(RAK4630) -{ - if (eink_found) { - auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); + { + auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1); adafruitDisplay = new GxEPD2_BW(*lowLevel); - - adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0)); - - //RAK14000 2.13 inch b/w 250x122 does actually now support partial updates + adafruitDisplay->init(); adafruitDisplay->setRotation(3); - //Partial update support for 1.54, 2.13 RAK14000 b/w , 2.9 and 4.2 - //adafruitDisplay->setRotation(1); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - } else { - (void)adafruitDisplay; - } -} + } +#elif defined(RAK4630) + { + if (eink_found) { + auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); + + adafruitDisplay = new GxEPD2_BW(*lowLevel); + + adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0)); + + // RAK14000 2.13 inch b/w 250x122 does actually now support partial updates + adafruitDisplay->setRotation(3); + // Partial update support for 1.54, 2.13 RAK14000 b/w , 2.9 and 4.2 + // adafruitDisplay->setRotation(1); + adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); + } else { + (void)adafruitDisplay; + } + } #elif defined(PCA10059) -{ - auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); - adafruitDisplay = new GxEPD2_BW(*lowLevel); - adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0)); - adafruitDisplay->setRotation(3); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); -} + { + auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); + adafruitDisplay = new GxEPD2_BW(*lowLevel); + adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0)); + adafruitDisplay->setRotation(3); + adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); + } #elif defined(M5_COREINK) auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); adafruitDisplay = new GxEPD2_BW(*lowLevel); @@ -217,12 +217,11 @@ bool EInkDisplay::connect() adafruitDisplay->setRotation(0); adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT); #endif - - - //adafruitDisplay->setFullWindow(); - //adafruitDisplay->fillScreen(UNCOLORED); - //adafruitDisplay->drawCircle(100, 100, 20, COLORED); - //adafruitDisplay->display(false); + + // adafruitDisplay->setFullWindow(); + // adafruitDisplay->fillScreen(UNCOLORED); + // adafruitDisplay->drawCircle(100, 100, 20, COLORED); + // adafruitDisplay->display(false); return true; } diff --git a/src/graphics/EInkDisplay2.h b/src/graphics/EInkDisplay2.h index 727132d0e..7d56c8022 100644 --- a/src/graphics/EInkDisplay2.h +++ b/src/graphics/EInkDisplay2.h @@ -17,26 +17,26 @@ class EInkDisplay : public OLEDDisplay /// How often should we update the display /// thereafter we do once per 5 minutes uint32_t slowUpdateMsec = 5 * 60 * 1000; - + public: /* constructor FIXME - the parameters are not used, just a temporary hack to keep working like the old displays */ - EInkDisplay(uint8_t address, int sda, int scl); + EInkDisplay(uint8_t address, int sda, int scl, uint8_t screen_model); // Write the buffer to the display memory (for eink we only do this occasionally) virtual void display(void) override; /** * Force a display update if we haven't drawn within the specified msecLimit - * + * * @return true if we did draw the screen */ bool forceDisplay(uint32_t msecLimit = 1000); /** * shim to make the abstraction happy - * + * */ void setDetected(uint8_t detected); @@ -50,5 +50,3 @@ class EInkDisplay : public OLEDDisplay // Connect to the display virtual bool connect() override; }; - - diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 670c0f162..e296bc1eb 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -22,7 +22,7 @@ void TFTDisplay::display(void) { concurrency::LockGuard g(spiLock); - uint16_t x,y; + uint16_t x, y; for (y = 0; y < displayHeight; y++) { for (x = 0; x < displayWidth; x++) { diff --git a/src/graphics/TFTDisplay.h b/src/graphics/TFTDisplay.h index c9749d9a8..c18dc03c6 100644 --- a/src/graphics/TFTDisplay.h +++ b/src/graphics/TFTDisplay.h @@ -18,14 +18,14 @@ class TFTDisplay : public OLEDDisplay /* constructor FIXME - the parameters are not used, just a temporary hack to keep working like the old displays */ - TFTDisplay(uint8_t address, int sda, int scl); + TFTDisplay(uint8_t address, int sda, int scl, uint8_t screen_model); // Write the buffer to the display memory virtual void display(void) override; - + /** * shim to make the abstraction happy - * + * */ void setDetected(uint8_t detected); From 88c84dd8065ef5b8a48c4905e801eab9d6dc90d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 20 Jan 2023 21:53:34 +0100 Subject: [PATCH 5/5] trunk again --- src/graphics/EInkDisplay2.cpp | 2 +- src/graphics/TFTDisplay.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index d211d91bd..f9d99ab7e 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -41,7 +41,7 @@ GxEPD2_BW *adafruitDisplay; -EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl) +EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl, uint8_t screen_model) { #if defined(TTGO_T_ECHO) setGeometry(GEOMETRY_RAWMODE, TECHO_DISPLAY_MODEL::WIDTH, TECHO_DISPLAY_MODEL::HEIGHT); diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index e296bc1eb..0bd1d3a99 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -8,7 +8,7 @@ static TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h -TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl) +TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl, uint8_t screen_model) { #ifdef SCREEN_ROTATE setGeometry(GEOMETRY_RAWMODE, TFT_HEIGHT, TFT_WIDTH);