diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index fe24616..fdc4ba3 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -38,6 +38,8 @@ std::vector lastHeardStation_temp; String firstLine, secondLine, thirdLine, fourthLine, iGateBeaconPacket; +// agregar automatic restart cada X horas? + void setup() { Serial.begin(115200); pinMode(greenLed, OUTPUT); diff --git a/src/utils.cpp b/src/utils.cpp index 9b47a3b..52ac3b9 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -58,6 +58,10 @@ void setupDiplay() { fourthLine = " listening..."; } +String getLocalIP() { + return "IP : " + String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(WiFi.localIP()[3]); +} + void checkBeaconInterval() { uint32_t lastTx = millis() - lastBeaconTx; if (lastTx >= Config.beaconInterval*60*1000) { @@ -65,7 +69,7 @@ void checkBeaconInterval() { } if (beacon_update) { display_toggle(true); - thirdLine = ""; + thirdLine = getLocalIP(); Serial.println("---- Sending iGate Beacon ----"); if (stationMode==1 || stationMode==2) { show_display(firstLine, secondLine, thirdLine, "SENDING iGate BEACON", 1000); diff --git a/src/utils.h b/src/utils.h index 188e906..80c3c64 100644 --- a/src/utils.h +++ b/src/utils.h @@ -7,6 +7,7 @@ namespace utils { void processStatus(); void setupDiplay(); +String getLocalIP(); void checkBeaconInterval(); void checkDisplayInterval(); void validateDigiFreqs(); diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp index fd6a1b0..123af4f 100644 --- a/src/wifi_utils.cpp +++ b/src/wifi_utils.cpp @@ -33,9 +33,10 @@ void startWiFi() { Serial.print("\nConnecting to '"); Serial.print(currentWiFi->ssid); Serial.println("' WiFi ..."); WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str()); while (WiFi.status() != WL_CONNECTED) { + delay(500); digitalWrite(greenLed,HIGH); Serial.print('.'); - delay(1000); + delay(500); digitalWrite(greenLed,LOW); if ((millis() - start) > 15000){ if(myWiFiAPIndex >= (myWiFiAPSize-1)) { @@ -47,6 +48,7 @@ void startWiFi() { start = millis(); Serial.print("\nConnect to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ..."); show_display("", "Connect to Wifi:", currentWiFi->ssid + " ...", 0); + WiFi.disconnect(); WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str()); } }