Add version detection

This commit is contained in:
Djuri Baars 2024-05-19 17:49:39 +02:00
parent ba0594959e
commit 88615ce248
2 changed files with 19 additions and 4 deletions

View File

@ -18,8 +18,9 @@ uint lastTimeSync;
void setup() void setup()
{ {
setupPreferences();
setupHardware(); setupHardware();
setupPreferences();
setupDisplays(); setupDisplays();
if (preferences.getBool("ledTestOnPower", true)) if (preferences.getBool("ledTestOnPower", true))
{ {
@ -196,8 +197,8 @@ void tryImprovSetup()
// esp_task_wdt_deinit(); // esp_task_wdt_deinit();
// esp_task_wdt_reset(); // esp_task_wdt_reset();
} }
setFgColor(preferences.getUInt("fgColor", DEFAULT_FG_COLOR)); setFgColor(preferences.getUInt("fgColor", isWhiteVersion() ? GxEPD_BLACK : GxEPD_WHITE));
setBgColor(preferences.getUInt("bgColor", DEFAULT_BG_COLOR)); setBgColor(preferences.getUInt("bgColor", isWhiteVersion() ? GxEPD_WHITE : GxEPD_BLACK));
} }
// else // else
// { // {
@ -370,6 +371,11 @@ void setupHardware()
#endif #endif
} }
#ifdef IS_HW_REV_B
pinMode(39, INPUT_PULLUP);
#endif
#ifdef IS_BTCLOCK_S3 #ifdef IS_BTCLOCK_S3
if (!mcp2.begin_I2C(0x21)) if (!mcp2.begin_I2C(0x21))
{ {
@ -724,4 +730,12 @@ String getHwRev() {
#else #else
return HW_REV; return HW_REV;
#endif #endif
}
bool isWhiteVersion() {
#ifdef IS_HW_REV_B
return digitalRead(39);
#else
return false;
#endif
} }

View File

@ -63,4 +63,5 @@ void improv_send_response(std::vector<uint8_t> &response);
void improv_set_error(improv::Error error); void improv_set_error(improv::Error error);
void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info); void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info);
String getHwRev(); String getHwRev();
bool isWhiteVersion();