mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-14 15:54:47 +00:00
Fixed 8266 build
This commit is contained in:
parent
4068f127ba
commit
4093b64dd0
@ -14,7 +14,9 @@
|
||||
#define CONNECTION_TIMEOUT 30000
|
||||
#define RECONNECT_TIMEOUT 5000
|
||||
|
||||
#if defined(ESP32)
|
||||
esp_err_t set_esp_interface_ip(esp_interface_t interface, IPAddress local_ip=INADDR_NONE, IPAddress gateway=INADDR_NONE, IPAddress subnet=INADDR_NONE, IPAddress dhcp_lease_start=INADDR_NONE);
|
||||
#endif
|
||||
|
||||
class WiFiClientConnectionHandler : public ConnectionHandler {
|
||||
public:
|
||||
@ -46,7 +48,9 @@ private:
|
||||
unsigned long lastRetry = 0;
|
||||
|
||||
wl_status_t begin(const char* ssid, const char* psk);
|
||||
#if defined(ESP32)
|
||||
void wifi_sta_config(wifi_config_t * wifi_config, const char * ssid=NULL, const char * password=NULL, const uint8_t * bssid=NULL, uint8_t channel=0, wifi_auth_mode_t min_security=WIFI_AUTH_WPA2_PSK, wifi_scan_method_t scan_method=WIFI_ALL_CHANNEL_SCAN, wifi_sort_method_t sort_method=WIFI_CONNECT_AP_BY_SIGNAL, uint16_t listen_interval=0, bool pmf_required=false);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -94,7 +94,11 @@ bool WiFiClientConnectionHandler::connect(NetworkConfig config, SystemConfig sys
|
||||
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
|
||||
#endif
|
||||
WiFi.setAutoReconnect(true);
|
||||
#if defined(ESP32)
|
||||
if(begin(config.ssid, config.psk)) {
|
||||
#else
|
||||
if(WiFi.begin(config.ssid, config.psk)) {
|
||||
#endif
|
||||
if(config.sleep <= 2) {
|
||||
switch(config.sleep) {
|
||||
case 0:
|
||||
@ -118,6 +122,7 @@ bool WiFiClientConnectionHandler::connect(NetworkConfig config, SystemConfig sys
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(ESP32)
|
||||
wl_status_t WiFiClientConnectionHandler::begin(const char* ssid, const char* passphrase) {
|
||||
if(!WiFi.enableSTA(true)) {
|
||||
log_e("STA enable failed!");
|
||||
@ -204,7 +209,7 @@ void WiFiClientConnectionHandler::wifi_sta_config(wifi_config_t * wifi_config, c
|
||||
wifi_config->sta.btm_enabled = true;
|
||||
wifi_config->sta.mbo_enabled = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void WiFiClientConnectionHandler::disconnect(unsigned long reconnectDelay) {
|
||||
if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Disconnecting!\n"));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user