mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-03-31 22:55:20 +05:00
Compare commits
2 Commits
351a884685
...
45762967ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45762967ee | ||
|
|
10f9cde17a |
@@ -247,11 +247,19 @@ namespace NetworkUtils {
|
|||||||
this->delayCallback(250);
|
this->delayCallback(250);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!this->useDhcp) {
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
WiFi.config(this->staticIp, this->staticGateway, this->staticSubnet, this->staticDns);
|
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
||||||
}
|
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
WiFi.begin(this->staSsid, this->staPassword, this->staChannel);
|
if (!this->useDhcp) {
|
||||||
|
WiFi.begin(this->staSsid, this->staPassword, this->staChannel, nullptr, false);
|
||||||
|
WiFi.config(this->staticIp, this->staticGateway, this->staticSubnet, this->staticDns);
|
||||||
|
WiFi.reconnect();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
WiFi.begin(this->staSsid, this->staPassword, this->staChannel, nullptr, true);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned long beginConnectionTime = millis();
|
unsigned long beginConnectionTime = millis();
|
||||||
while (millis() - beginConnectionTime < timeout) {
|
while (millis() - beginConnectionTime < timeout) {
|
||||||
@@ -267,7 +275,16 @@ namespace NetworkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void disconnect() {
|
void disconnect() {
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
WiFi.disconnectAsync(false, true);
|
||||||
|
|
||||||
|
const unsigned long start = millis();
|
||||||
|
while (WiFi.isConnected() && (millis() - start) < 5000) {
|
||||||
|
this->delayCallback(100);
|
||||||
|
}
|
||||||
|
#else
|
||||||
WiFi.disconnect(false, true);
|
WiFi.disconnect(false, true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
@@ -365,10 +382,10 @@ namespace NetworkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const unsigned int reconnectInterval = 5000;
|
const unsigned int reconnectInterval = 15000;
|
||||||
const unsigned int failedConnectTimeout = 120000;
|
const unsigned int failedConnectTimeout = 185000;
|
||||||
const unsigned int connectionTimeout = 15000;
|
const unsigned int connectionTimeout = 5000;
|
||||||
const unsigned int resetConnectionTimeout = 30000;
|
const unsigned int resetConnectionTimeout = 90000;
|
||||||
|
|
||||||
YieldCallback yieldCallback = []() {
|
YieldCallback yieldCallback = []() {
|
||||||
::yield();
|
::yield();
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ lib_deps =
|
|||||||
bblanchon/ArduinoJson@^7.1.0
|
bblanchon/ArduinoJson@^7.1.0
|
||||||
;ihormelnyk/OpenTherm Library@^1.1.5
|
;ihormelnyk/OpenTherm Library@^1.1.5
|
||||||
https://github.com/ihormelnyk/opentherm_library#master
|
https://github.com/ihormelnyk/opentherm_library#master
|
||||||
arduino-libraries/ArduinoMqttClient@^0.1.8
|
;arduino-libraries/ArduinoMqttClient@^0.1.8
|
||||||
|
https://github.com/Laxilef/ArduinoMqttClient.git#esp32_core_310
|
||||||
lennarthennigs/ESP Telnet@^2.2
|
lennarthennigs/ESP Telnet@^2.2
|
||||||
gyverlibs/FileData@^1.0.2
|
gyverlibs/FileData@^1.0.2
|
||||||
gyverlibs/GyverPID@^3.3.2
|
gyverlibs/GyverPID@^3.3.2
|
||||||
@@ -78,7 +79,7 @@ board_build.ldscript = eagle.flash.4m1m.ld
|
|||||||
;platform_packages =
|
;platform_packages =
|
||||||
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
||||||
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
|
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
|
||||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.06/platform-espressif32.zip
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10-rc2/platform-espressif32.zip
|
||||||
platform_packages =
|
platform_packages =
|
||||||
board_build.partitions = esp32_partitions.csv
|
board_build.partitions = esp32_partitions.csv
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
|||||||
@@ -769,7 +769,7 @@ protected:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->webServer->handleClient();
|
//this->webServer->handleClient();
|
||||||
this->webServer->stop();
|
this->webServer->stop();
|
||||||
this->webServerEnabled = false;
|
this->webServerEnabled = false;
|
||||||
this->webServerChangeState = millis();
|
this->webServerChangeState = millis();
|
||||||
@@ -794,7 +794,7 @@ protected:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->dnsServer->processNextRequest();
|
//this->dnsServer->processNextRequest();
|
||||||
this->dnsServer->stop();
|
this->dnsServer->stop();
|
||||||
this->dnsServerEnabled = false;
|
this->dnsServerEnabled = false;
|
||||||
this->dnsServerChangeState = millis();
|
this->dnsServerChangeState = millis();
|
||||||
|
|||||||
Reference in New Issue
Block a user