WiFi stayed active after disabling WiFi in menu

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-10-07 23:15:47 +02:00
parent a300af5eeb
commit 9227fe7736
2 changed files with 21 additions and 15 deletions
+18 -12
View File
@@ -560,24 +560,30 @@ void passwordcrypt() {
} }
void tryWiFi() { void tryWiFi() {
if (!setupmode) { if (!setupmode && wifi) {
tft.drawRoundRect(1, 60, 319, 140, 5, ActiveColor); tft.drawRoundRect(1, 60, 319, 140, 5, ActiveColor);
tft.fillRoundRect(3, 62, 315, 136, 5, BackgroundColor); tft.fillRoundRect(3, 62, 315, 136, 5, BackgroundColor);
tftPrint(0, myLanguage[language][55], 155, 88, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][55], 155, 88, ActiveColor, ActiveColorSmooth, 28);
} }
if (wc.autoConnect()) { if (wifi) {
Server.begin(); if (wc.autoConnect()) {
Udp.begin(9031); Server.begin();
remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient); Udp.begin(9031);
if (!setupmode) tftPrint(0, myLanguage[language][57], 155, 128, InsignificantColor, InsignificantColorSmooth, 28); remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient);
wifi = true; if (!setupmode) tftPrint(0, myLanguage[language][57], 155, 128, InsignificantColor, InsignificantColorSmooth, 28);
wifi = true;
} else {
if (!setupmode) tftPrint(0, myLanguage[language][56], 155, 128, SignificantColor, SignificantColorSmooth, 28);
Server.end();
Udp.stop();
WiFi.mode(WIFI_OFF);
wifi = false;
XDRGTKTCP = false;
RDSSPYTCP = false;
}
} else { } else {
if (!setupmode) tftPrint(0, myLanguage[language][56], 155, 128, SignificantColor, SignificantColorSmooth, 28);
Server.end(); Server.end();
Udp.stop(); Udp.stop();
WiFi.mode(WIFI_OFF); WiFi.mode(WIFI_OFF);
wifi = false;
XDRGTKTCP = false;
RDSSPYTCP = false;
} }
} }
+3 -3
View File
@@ -2268,9 +2268,9 @@ void DoMenu() {
break; break;
} }
} else { } else {
if (menupage == CONNECTIVITY && menuoption == ITEM2 && wifi) { if (menupage == CONNECTIVITY && menuoption == ITEM2) {
tryWiFi(); tryWiFi();
delay(2000); if (wifi) delay(2000);
} }
if (menupage == DISPLAYSETTINGS && menuoption == ITEM5) { if (menupage == DISPLAYSETTINGS && menuoption == ITEM5) {
doTheme(); doTheme();
@@ -2278,4 +2278,4 @@ void DoMenu() {
menuopen = false; menuopen = false;
BuildMenu(); BuildMenu();
} }
} }