1
0
mirror of https://github.com/revspace/operame synced 2024-10-31 21:47:30 +00:00

More detailed on-screen portal instructions

This commit is contained in:
Juerd Waalboer 2020-12-26 03:42:57 +01:00
parent e9c6cd49ec
commit 7b989eda31
2 changed files with 51 additions and 15 deletions

View File

@ -237,22 +237,55 @@ void setup() {
display_big("WiFi mislukt!", TFT_RED); display_big("WiFi mislukt!", TFT_RED);
delay(2000); delay(2000);
}; };
static int portal_phase = 0;
WiFiSettings.onPortalView = [] {
if (portal_phase < 2) portal_phase = 2;
};
WiFiSettings.onConfigSaved = [] {
portal_phase = 3;
};
WiFiSettings.onPortalWaitLoop = [] { WiFiSettings.onPortalWaitLoop = [] {
if (WiFi.softAPgetStationNum()) { if (WiFi.softAPgetStationNum() == 0) portal_phase = 0;
display_lines({ else if (! portal_phase) portal_phase = 1;
"Volg instructies op",
"smartphone.", switch (portal_phase) {
"(login-notificatie)" case 0: {
}, TFT_WHITE, TFT_BLUE);
} else {
display_lines({ display_lines({
"Voor configuratie,", "Voor configuratie,",
"verbind met WiFi", "verbind met WiFi",
"\"" + WiFiSettings.hostname + "\"", "\"" + WiFiSettings.hostname + "\"",
"met een smartphone." "met een smartphone."
}, TFT_WHITE, TFT_BLUE); }, TFT_WHITE, TFT_BLUE);
if (millis() > 10*60*1000) ESP.restart(); break ;
} }
case 1: {
display_lines({
"Volg instructies op",
"uw smartphone.",
"(inlog-notificatie)"
}, TFT_WHITE, TFT_BLUE);
break;
}
case 2: {
display_lines({
"Wijzig instellingen",
"en klik op \"Save\".",
"(rechtsonder)"
}, TFT_WHITE, TFT_BLUE);
break;
}
case 3: {
display_lines({
"Wijzig instellingen",
"en klik op \"Save\".",
"Of \"Restart device\"",
"als u klaar bent."
}, TFT_WHITE, TFT_BLUE);
break;
}
}
if (portal_phase == 0 && millis() > 10*60*1000) ESP.restart();
if (ota_enabled) ArduinoOTA.handle(); if (ota_enabled) ArduinoOTA.handle();
if (!digitalRead(portalbutton)) { if (!digitalRead(portalbutton)) {
delay(50); delay(50);

View File

@ -22,11 +22,14 @@ targets = upload
monitor_speed = 115200 monitor_speed = 115200
#upload_speed = 460800 #upload_speed = 460800
lib_deps = lib_deps =
ESP-WiFiSettings @^3.5 # ESP-WiFiSettings @^3.6
https://github.com/Juerd/ESP-WiFiSettings/
MH-Z19 MH-Z19
TFT_eSPI TFT_eSPI
MQTT MQTT
build_flags = build_flags =
# -DCORE_DEBUG_LEVEL=5
-DUSER_SETUP_LOADED=1 -DUSER_SETUP_LOADED=1
-DST7789_DRIVER=1 -DST7789_DRIVER=1
-DCGRAM_OFFSET=1 -DCGRAM_OFFSET=1