fix: digi mode with auto ap

This commit is contained in:
SQ2CPA 2024-02-25 18:02:50 +01:00
parent 930061bdc0
commit b45633ab48
2 changed files with 16 additions and 12 deletions

View File

@ -82,11 +82,11 @@ void loop() {
WIFI_Utils::checkIfAutoAPShouldPowerOff(); WIFI_Utils::checkIfAutoAPShouldPowerOff();
if (!WiFiConnected) {
thirdLine = Utils::getLocalIP();
}
if (stationMode==1 || stationMode==2 ) { // iGate (1 Only Rx / 2 Rx+Tx) if (stationMode==1 || stationMode==2 ) { // iGate (1 Only Rx / 2 Rx+Tx)
if (!WiFiConnected) {
thirdLine = Utils::getLocalIP();
}
WIFI_Utils::checkWiFi(); WIFI_Utils::checkWiFi();
if (!espClient.connected()) { if (!espClient.connected()) {
APRS_IS_Utils::connect(); APRS_IS_Utils::connect();

View File

@ -27,6 +27,16 @@ namespace WIFI_Utils {
} }
} }
void startAutoAP() {
WiFi.mode(WIFI_MODE_NULL);
WiFi.mode(WIFI_AP);
WiFi.softAP(Config.callsign + " AP", "1234567890");
WiFiAutoAPTime = millis();
WiFiAutoAPStarted = true;
}
void startWiFi() { void startWiFi() {
bool startAP = false; bool startAP = false;
if (currentWiFi->ssid == "") { if (currentWiFi->ssid == "") {
@ -88,13 +98,7 @@ namespace WIFI_Utils {
Serial.println("\nNot connected to WiFi! Starting Auto AP"); Serial.println("\nNot connected to WiFi! Starting Auto AP");
show_display("", "", " Starting Auto AP", " Please connect to it " , " loading ...", 1000); show_display("", "", " Starting Auto AP", " Please connect to it " , " loading ...", 1000);
WiFi.mode(WIFI_MODE_NULL); startAutoAP();
WiFi.mode(WIFI_AP);
WiFi.softAP(Config.callsign + " AP", "1234567890");
WiFiAutoAPTime = millis();
WiFiAutoAPStarted = true;
} }
} }
@ -132,7 +136,7 @@ namespace WIFI_Utils {
} else { } else {
Serial.println("stationMode ---> DigiRepeater (Rx freq != Tx freq)"); Serial.println("stationMode ---> DigiRepeater (Rx freq != Tx freq)");
} }
WiFi.mode(WIFI_OFF); startAutoAP();
btStop(); btStop();
} else if (stationMode==5) { } else if (stationMode==5) {
Serial.println("stationMode ---> iGate when Wifi/APRS available (DigiRepeater when not)"); Serial.println("stationMode ---> iGate when Wifi/APRS available (DigiRepeater when not)");