Added WiFi info screen at startup

This commit is contained in:
LucaIU2FRL 2021-09-18 10:46:49 +02:00
parent 87d8dbc558
commit ab3b3a3c37
2 changed files with 33 additions and 0 deletions

View File

@ -191,6 +191,13 @@ ulong oled_timer;
// Variable to manually send beacon from html page // Variable to manually send beacon from html page
bool manBeacon = false; 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 #define ANGLE_AVGS 3 // angle averaging - x times
float average_course[ANGLE_AVGS]; float average_course[ANGLE_AVGS];
float avg_c_y, avg_c_x; 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) { if (manBeacon) {
// Manually sending beacon from html page // Manually sending beacon from html page
enableOled(); enableOled();

View File

@ -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 // Variable needed to send beacon from html page
extern bool manBeacon; 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; QueueHandle_t webListReceivedQueue = nullptr;
std::list <tReceivedPacketData*> receivedPackets; std::list <tReceivedPacketData*> receivedPackets;
const int MAX_RECEIVED_LIST_SIZE = 50; const int MAX_RECEIVED_LIST_SIZE = 50;
@ -407,8 +414,16 @@ void handle_saveDeviceCfg(){
//Serial.println(WiFi.getMode()); //Serial.println(WiFi.getMode());
if (WiFi.getMode() == 3){ if (WiFi.getMode() == 3){
Serial.println("Running AP. IP: " + WiFi.softAPIP().toString()); 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) { } else if (WiFi.getMode() == 1) {
Serial.println("Connected. IP: " + WiFi.localIP().toString()); Serial.println("Connected. IP: " + WiFi.localIP().toString());
apConnected=true;
infoApName = wifi_ssid.c_str();
infoApPass = wifi_password.c_str();
infoApAddr = WiFi.localIP().toString();
} else { } else {
Serial.println("WiFi Mode: " + WiFi.getMode()); Serial.println("WiFi Mode: " + WiFi.getMode());
} }