diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 468f4d4..79dfe09 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -191,6 +191,13 @@ ulong oled_timer; // Variable to manually send beacon from html page bool manBeacon = false; +// Variable to show AP settings on OLED +bool apEnabled = false; +bool apConnected = false; +String infoApName = ""; +String infoApPass = ""; +String infoApAddr = ""; + #define ANGLE_AVGS 3 // angle averaging - x times float average_course[ANGLE_AVGS]; float avg_c_y, avg_c_x; @@ -878,6 +885,17 @@ void loop() { } } + // Show informations on WiFi Status + if (apConnected) { + enableOled(); // turn ON OLED temporary + writedisplaytext(" ((WiFi))","WiFi Client Mode","SSID: " + infoApName, "Pass: ********", "IP: " + infoApAddr, getSatAndBatInfo()); + apConnected=false; + } else if (apEnabled) { + enableOled(); // turn ON OLED temporary + writedisplaytext(" ((WiFi))","WiFi AP Mode","SSID: " + infoApName, "Pass: " + infoApPass, "IP: " + infoApAddr, getSatAndBatInfo()); + apEnabled=false; + } + if (manBeacon) { // Manually sending beacon from html page enableOled(); diff --git a/src/taskWebServer.cpp b/src/taskWebServer.cpp index ce39ab2..3ad432e 100644 --- a/src/taskWebServer.cpp +++ b/src/taskWebServer.cpp @@ -19,6 +19,13 @@ extern const char web_js_js_end[] asm("_binary_data_embed_js_js_out_end"); // Variable needed to send beacon from html page extern bool manBeacon; +// Variable to show AP status +extern bool apEnabled; +extern bool apConnected; +extern String infoApName; +extern String infoApPass; +extern String infoApAddr; + QueueHandle_t webListReceivedQueue = nullptr; std::list receivedPackets; const int MAX_RECEIVED_LIST_SIZE = 50; @@ -407,8 +414,16 @@ void handle_saveDeviceCfg(){ //Serial.println(WiFi.getMode()); if (WiFi.getMode() == 3){ Serial.println("Running AP. IP: " + WiFi.softAPIP().toString()); + apEnabled=true; + infoApName = apSSID.c_str(); + infoApPass = apSSID.c_str(); + infoApAddr = WiFi.softAPIP().toString(); } else if (WiFi.getMode() == 1) { Serial.println("Connected. IP: " + WiFi.localIP().toString()); + apConnected=true; + infoApName = wifi_ssid.c_str(); + infoApPass = wifi_password.c_str(); + infoApAddr = WiFi.localIP().toString(); } else { Serial.println("WiFi Mode: " + WiFi.getMode()); }