increase vTick for time screen, add lost IP event handler and system status to web interface

This commit is contained in:
Djuri 2023-11-03 16:03:34 +01:00
parent 7cc524f75f
commit 5c165633d1
7 changed files with 49 additions and 3 deletions

View file

@ -64,7 +64,7 @@ void setupComponents()
// Serial.println(F("Leds should be on"));
#ifndef NO_MCP
if (!mcp.begin_I2C())
if (!mcp.begin_I2C(0x20))
{
Serial.println(F("Error MCP23017"));
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
@ -143,6 +143,8 @@ void setupWifi()
}
#endif
//WiFi.persistent(true);
WiFi.enableLongRange(false);
setupSoftAP();
wm.setConfigPortalTimeout(preferences.getUInt("wpTimeout", 600));
@ -156,6 +158,12 @@ void setupWifi()
softAP_password.c_str()); });
bool ac = wm.autoConnect(softAP_SSID.c_str(), softAP_password.c_str());
WiFi.onEvent(onWifiLostIp, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_LOST_IP);
}
void onWifiLostIp(WiFiEvent_t event, WiFiEventInfo_t info) {
ESP.restart();
}
void setupPreferences()

View file

@ -28,6 +28,7 @@ void setCurrentScreen(uint screen);
void handleScreenTasks(uint screen);
void showNetworkSettings();
void toggleScreenTimer();
void onWifiLostIp(WiFiEvent_t event, WiFiEventInfo_t info);
void timebasedChangeTask(void *parameter);

View file

@ -76,6 +76,11 @@ void onApiStatus(AsyncWebServerRequest *request)
root["currentScreen"] = String(getCurrentScreen());
root["timerRunning"] = timerRunning;
root["numScreens"] = NUM_SCREENS;
root["espUptime"] = esp_timer_get_time() / 1000000;
root["espFreeHeap"] = ESP.getFreeHeap();
root["espHeapSize"] = ESP.getHeapSize();
root["espFreePsram"] = ESP.getFreePsram();
root["espPsramSize"] = ESP.getPsramSize();
JsonArray data = root.createNestedArray("data");
JsonArray rendered = root.createNestedArray("rendered");
String epdContent[NUM_SCREENS];

View file

@ -28,7 +28,7 @@ void minuteTask(void * parameter) {
if(rtc.getSecond() != 0) { // Reset the event triggered flag if the second is not 0
eventTriggered = false;
}
vTaskDelay(pdMS_TO_TICKS(500)); // Sleep for 500 milliseconds to avoid busy waiting
vTaskDelay(pdMS_TO_TICKS(1000)); // Sleep for 1000 milliseconds to avoid busy waiting
#endif
}
}