mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge ec2dd475eb into dee3e26ac0
This commit is contained in:
commit
5a9666cc3d
2 changed files with 13 additions and 0 deletions
|
|
@ -53,6 +53,15 @@ void SerialWifiInterface::resetReceivedFrameHeader() {
|
|||
}
|
||||
|
||||
size_t SerialWifiInterface::checkRecvFrame(uint8_t dest[]) {
|
||||
// periodic WiFi health check (every 60s, only after first successful connection)
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
_wifi_was_connected = true;
|
||||
} else if (_wifi_was_connected && millis() >= _wifi_check_time) {
|
||||
WIFI_DEBUG_PRINTLN("WiFi disconnected, attempting reconnect...");
|
||||
WiFi.reconnect();
|
||||
_wifi_check_time = millis() + 60000;
|
||||
}
|
||||
|
||||
// check if new client connected
|
||||
auto newClient = server.available();
|
||||
if (newClient) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ class SerialWifiInterface : public BaseSerialInterface {
|
|||
bool _isEnabled;
|
||||
unsigned long _last_write;
|
||||
unsigned long adv_restart_time;
|
||||
bool _wifi_was_connected;
|
||||
unsigned long _wifi_check_time;
|
||||
|
||||
WiFiServer server;
|
||||
WiFiClient client;
|
||||
|
|
@ -39,6 +41,8 @@ public:
|
|||
deviceConnected = false;
|
||||
_isEnabled = false;
|
||||
_last_write = 0;
|
||||
_wifi_was_connected = false;
|
||||
_wifi_check_time = 0;
|
||||
send_queue_len = recv_queue_len = 0;
|
||||
received_frame_header.type = 0;
|
||||
received_frame_header.length = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue