This commit is contained in:
parent
012972e53f
commit
77375b0913
|
|
@ -13,7 +13,7 @@
|
|||
#include <ESPAsyncWebServer.h>
|
||||
#include <AsyncElegantOTA.h>
|
||||
|
||||
#define VERSION "2023.06.04"
|
||||
#define VERSION "2023.06.06"
|
||||
|
||||
WiFiClient espClient;
|
||||
AsyncWebServer server(80);
|
||||
|
|
@ -35,7 +35,7 @@ std::vector<String> lastHeardStation_temp;
|
|||
|
||||
String firstLine, secondLine, thirdLine, fourthLine, iGateLatitude, iGateLongitude;
|
||||
|
||||
void setup_wifi() {
|
||||
/*void setup_wifi() {
|
||||
int status = WL_IDLE_STATUS;
|
||||
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.print("' ");
|
||||
show_display("", "Connecting to Wifi:", currentWiFi->ssid + " ...", 0);
|
||||
|
|
@ -50,7 +50,7 @@ void setup_wifi() {
|
|||
Serial.println("STA Failed to configure");
|
||||
}
|
||||
//WiFi.config(Config.network.ip, Config.network.gateway, Config.network.subnet, Config.network.dns1, Config.network.dns2);
|
||||
}*/
|
||||
}
|
||||
|
||||
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
|
|
@ -71,7 +71,7 @@ void setup_wifi() {
|
|||
}
|
||||
Serial.print("Connected as ");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
}*/
|
||||
|
||||
void APRS_IS_connect(){
|
||||
int count = 0;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#include <Wire.h>
|
||||
|
|
|
|||
|
|
@ -8,4 +8,5 @@ namespace utils {
|
|||
void processStatus();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#include <WiFi.h>
|
||||
#include "wifi_utils.h"
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
extern WiFi_AP *currentWiFi;
|
||||
extern int myWiFiAPIndex;
|
||||
extern int myWiFiAPSize;
|
||||
|
||||
namespace WIFI_Utils {
|
||||
|
||||
void setup() {
|
||||
int status = WL_IDLE_STATUS;
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
delay(500);
|
||||
unsigned long start = millis();
|
||||
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) {
|
||||
Serial.print('.');
|
||||
delay(1000);
|
||||
if ((millis() - start) > 15000){
|
||||
if(myWiFiAPIndex >= (myWiFiAPSize-1)) {
|
||||
myWiFiAPIndex = 0;
|
||||
} else {
|
||||
myWiFiAPIndex++;
|
||||
}
|
||||
currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||
start = millis();
|
||||
Serial.print("\nConnect to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
|
||||
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
||||
}
|
||||
}
|
||||
Serial.print("Connected as ");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef WIFI_UTILS_H_
|
||||
#define WIFI_UTILS_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
namespace WIFI_Utils {
|
||||
|
||||
void setup();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue