From c9577b6c21bb2bc31966bda2b82c18ce0c26322d Mon Sep 17 00:00:00 2001 From: richonguzman Date: Fri, 25 Oct 2024 11:08:00 -0300 Subject: [PATCH] more display testing --- src/boards_pinout.h | 3 ++- src/display.cpp | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/boards_pinout.h b/src/boards_pinout.h index f93bd16..6da9664 100644 --- a/src/boards_pinout.h +++ b/src/boards_pinout.h @@ -186,7 +186,8 @@ #define OLED_RST -1 #endif -#if !defined(LIGHTGATEWAY_1_0) && !defined(HELTEC_HTCT62) && !defined(HELTEC_WSL_V3) && !defined(ESP32C3_DIY_1W_LoRa) && !defined(ESP32C3_DIY_1W_LoRa_915) && !defined(WEMOS_S2_MINI_DIY_LoRa) + +#if !defined(HELTEC_HTCT62) && !defined(HELTEC_WSL_V3) && !defined(ESP32C3_DIY_1W_LoRa) && !defined(ESP32C3_DIY_1W_LoRa_915) && !defined(WEMOS_S2_MINI_DIY_LoRa) #define HAS_DISPLAY #endif diff --git a/src/display.cpp b/src/display.cpp index 59f404c..59d055d 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -67,20 +67,22 @@ void displaySetup() { digitalWrite(OLED_RST, HIGH); #endif - if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { - Serial.println(F("SSD1306 allocation failed")); - for(;;); // Don't proceed, loop forever - } - if (Config.display.turn180) { + if(display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { + if (Config.display.turn180) { display.setRotation(2); + } + display.clearDisplay(); + display.setTextColor(WHITE); + display.setTextSize(1); + display.setCursor(0, 0); + display.ssd1306_command(SSD1306_SETCONTRAST); + display.ssd1306_command(1); + display.display(); + } else { + //Serial.println(F("SSD1306 allocation failed")); + #undef HAS_DISPLAY } - display.clearDisplay(); - display.setTextColor(WHITE); - display.setTextSize(1); - display.setCursor(0, 0); - display.ssd1306_command(SSD1306_SETCONTRAST); - display.ssd1306_command(1); - display.display(); + #endif #endif delay(1000);