Implement regular OTA update attempt / indicate OTA processing on display

This commit is contained in:
Phat Nguyen
2024-05-02 10:19:49 +07:00
parent 0acb7d470d
commit 4493156739
10 changed files with 252 additions and 10 deletions

View File

@ -82,7 +82,7 @@ static WifiConnector wifiConnector(oledDisplay, Serial, stateMachine,
configuration);
static OpenMetrics openMetrics(measurements, configuration, wifiConnector,
apiClient);
static OtaHandler otaHandler;
static OtaHandler otaHandler(stateMachine, configuration);
static LocalServer localServer(Serial, openMetrics, measurements, configuration,
wifiConnector);
@ -157,6 +157,7 @@ void setup() {
apiClient.setAirGradient(ag);
openMetrics.setAirGradient(ag);
localServer.setAirGraident(ag);
otaHandler.setAirGradient(ag);
/** Connecting wifi */
bool connectToWifi = false;
@ -184,7 +185,7 @@ void setup() {
#ifdef ESP8266
// ota not supported
#else
otaHandler.updateFirmwareIfOutdated(ag->deviceId());
// otaHandler.updateFirmwareIfOutdated(ag->deviceId());
#endif
apiClient.fetchServerConfiguration();
@ -733,6 +734,11 @@ static void configUpdateHandle() {
String(configuration.getDisplayBrightness()));
}
String newVer = configuration.newFirmwareVersion();
if (newVer.length()) {
otaHandler.updateFirmwareIfOutdated(newVer);
}
appDispHandler();
appLedHandler();
}