diff --git a/src/lib/config.cpp b/src/lib/config.cpp index 95ca5ab..214297f 100644 --- a/src/lib/config.cpp +++ b/src/lib/config.cpp @@ -18,8 +18,9 @@ uint lastTimeSync; void setup() { - setupPreferences(); setupHardware(); + + setupPreferences(); setupDisplays(); if (preferences.getBool("ledTestOnPower", true)) { @@ -196,8 +197,8 @@ void tryImprovSetup() // esp_task_wdt_deinit(); // esp_task_wdt_reset(); } - setFgColor(preferences.getUInt("fgColor", DEFAULT_FG_COLOR)); - setBgColor(preferences.getUInt("bgColor", DEFAULT_BG_COLOR)); + setFgColor(preferences.getUInt("fgColor", isWhiteVersion() ? GxEPD_BLACK : GxEPD_WHITE)); + setBgColor(preferences.getUInt("bgColor", isWhiteVersion() ? GxEPD_WHITE : GxEPD_BLACK)); } // else // { @@ -370,6 +371,11 @@ void setupHardware() #endif } +#ifdef IS_HW_REV_B +pinMode(39, INPUT_PULLUP); + +#endif + #ifdef IS_BTCLOCK_S3 if (!mcp2.begin_I2C(0x21)) { @@ -724,4 +730,12 @@ String getHwRev() { #else return HW_REV; #endif +} + +bool isWhiteVersion() { + #ifdef IS_HW_REV_B + return digitalRead(39); + #else + return false; + #endif } \ No newline at end of file diff --git a/src/lib/config.hpp b/src/lib/config.hpp index f7ca85b..8c03023 100644 --- a/src/lib/config.hpp +++ b/src/lib/config.hpp @@ -63,4 +63,5 @@ void improv_send_response(std::vector &response); void improv_set_error(improv::Error error); void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info); -String getHwRev(); \ No newline at end of file +String getHwRev(); +bool isWhiteVersion(); \ No newline at end of file