1
0
mirror of https://github.com/revspace/operame synced 2024-12-04 21:57:30 +00:00

Bugfix: use portal uptime instead of MCU uptime for portal timeout

This commit is contained in:
Juerd Waalboer 2020-12-27 22:25:41 +01:00
parent 94c39eaf0d
commit 320bff7393

View File

@ -316,7 +316,6 @@ void setup() {
mqtt_template = WiFiSettings.string("operame_mqtt_template", "{} PPM", "Berichtsjabloon"); mqtt_template = WiFiSettings.string("operame_mqtt_template", "{} PPM", "Berichtsjabloon");
WiFiSettings.info("De {} in het sjabloon wordt vervangen door de gemeten waarde."); WiFiSettings.info("De {} in het sjabloon wordt vervangen door de gemeten waarde.");
if (ota_enabled) WiFiSettings.onPortal = setup_ota;
WiFiSettings.onConnect = [] { WiFiSettings.onConnect = [] {
display_big("Verbinden met WiFi...", TFT_BLUE); display_big("Verbinden met WiFi...", TFT_BLUE);
@ -328,6 +327,11 @@ void setup() {
delay(2000); delay(2000);
}; };
static int portal_phase = 0; static int portal_phase = 0;
static unsigned long portal_start;
WiFiSettings.onPortal = [] {
if (ota_enabled) setup_ota;
portal_start = millis();
};
WiFiSettings.onPortalView = [] { WiFiSettings.onPortalView = [] {
if (portal_phase < 2) portal_phase = 2; if (portal_phase < 2) portal_phase = 2;
}; };
@ -374,7 +378,7 @@ void setup() {
break; break;
} }
} }
if (portal_phase == 0 && millis() > 10*60*1000) { if (portal_phase == 0 && millis() - portal_start > 10*60*1000) {
panic("Tijd verstreken"); panic("Tijd verstreken");
} }