Merge pull request #36 from SQ2CPA/main

Fix mode 2, 3 and 5
This commit is contained in:
Ricardo Guzman (Richonguzman) 2024-02-25 14:15:22 -03:00 committed by GitHub
commit ffd27f03f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 13 deletions

View file

@ -82,11 +82,11 @@ void loop() {
WIFI_Utils::checkIfAutoAPShouldPowerOff();
if (!WiFiConnected) {
thirdLine = Utils::getLocalIP();
}
if (stationMode==1 || stationMode==2 ) { // iGate (1 Only Rx / 2 Rx+Tx)
if (!WiFiConnected) {
thirdLine = Utils::getLocalIP();
}
WIFI_Utils::checkWiFi();
if (!espClient.connected()) {
APRS_IS_Utils::connect();
@ -96,8 +96,8 @@ void loop() {
DIGI_Utils::loop();
} else if (stationMode==5) { // iGate when WiFi and APRS available , DigiRepeater when not (RxFreq=TxFreq)
Utils::checkWiFiInterval();
thirdLine = Utils::getLocalIP();
if (WiFi.status() == WL_CONNECTED) { // iGate Mode
thirdLine = Utils::getLocalIP();
if (!espClient.connected()) {
APRS_IS_Utils::connect();
}

View file

@ -3,6 +3,7 @@
#include "pins_config.h"
#include "wifi_utils.h"
#include "display.h"
#include "utils.h"
extern Configuration Config;
extern WiFi_AP *currentWiFi;
@ -27,6 +28,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() {
bool startAP = false;
if (currentWiFi->ssid == "") {
@ -88,13 +99,7 @@ namespace WIFI_Utils {
Serial.println("\nNot connected to WiFi! Starting Auto AP");
show_display("", "", " Starting Auto AP", " Please connect to it " , " loading ...", 1000);
WiFi.mode(WIFI_MODE_NULL);
WiFi.mode(WIFI_AP);
WiFi.softAP(Config.callsign + " AP", "1234567890");
WiFiAutoAPTime = millis();
WiFiAutoAPStarted = true;
startAutoAP();
}
}
@ -132,10 +137,12 @@ namespace WIFI_Utils {
} else {
Serial.println("stationMode ---> DigiRepeater (Rx freq != Tx freq)");
}
WiFi.mode(WIFI_OFF);
startAutoAP();
btStop();
} else if (stationMode==5) {
Serial.println("stationMode ---> iGate when Wifi/APRS available (DigiRepeater when not)");
startWiFi();
btStop();
} else {
Serial.println("stationMode ---> NOT VALID");
show_display("------- ERROR -------", "stationMode Not Valid", "device will autofix", "and then reboot", 1000);