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()
{
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))
{
@ -725,3 +731,11 @@ String getHwRev() {
return HW_REV;
#endif
}
bool isWhiteVersion() {
#ifdef IS_HW_REV_B
return digitalRead(39);
#else
return false;
#endif
}

View File

@ -64,3 +64,4 @@ void improv_set_error(improv::Error error);
void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info);
String getHwRev();
bool isWhiteVersion();