OTA fixes + enable when network connected and switch pressed

This commit is contained in:
Emanuele Trabattoni
2025-08-06 09:49:46 +02:00
parent 5bff567863
commit e37aa58398
7 changed files with 102 additions and 74 deletions

View File

@@ -55,14 +55,6 @@ void loop()
LOG_INFO("Temperature sensors connected ->", sensors);
// Initialize OTA updater if needed
auto ota = OTA(devices);
if (io.digitalInRead(DI_OTAENABLE)) {
buzzer.beepRepeat(25,25, NOTE_A);
delay(1000);
if (io.digitalInRead(DI_OTAENABLE)) { // maintain keyPress for 1s
ota.begin();
}
buzzer.beep(100, NOTE_G);
}
//////////////// DEVICES ////////////////
//////////////// MQTT ////////////////
@@ -134,6 +126,17 @@ void loop()
led.setColor(led.COLOR_RED);
return;
}
if (io.digitalInRead(DI::OTAENABLE)) // Initialize OTA, BLUE
{
buzzer.beepRepeat(25, 25, NOTE_A);
delay(1000);
if (io.digitalInRead(DI::OTAENABLE))
{ // maintain keyPress for 1s
ota.begin();
}
buzzer.beep(100, NOTE_G);
delay(100);
}
// Get RTC time at ethernet connection
time_t ntpTime;
uint8_t timeRetries(0);
@@ -198,7 +201,7 @@ void loop()
mqtt.publish(conf.m_mqttPublish["temperatures"], ti);
};
if (io.digitalInRead(DI_CONFRESET)) // ROSSO - Config Reset
if (io.digitalInRead(DI::CONFRESET)) // ROSSO - Config Reset
{
LOG_WARN("Config RESET!");
buzzer.beep(450, NOTE_E);
@@ -206,7 +209,7 @@ void loop()
conf.resetConfig();
}
if (io.digitalInRead(DI_RESTART)) // GIALLO - Restart
if (io.digitalInRead(DI::RESTART)) // GIALLO - Restart
{
LOG_WARN("RESTART!");
buzzer.beep(450, NOTE_D);