mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 09:49:32 +02:00
improve WIFI event disconnect/connect register on emulator
This commit is contained in:
parent
5d8c20ee0f
commit
23c9f8c3c3
1 changed files with 3 additions and 4 deletions
|
@ -139,6 +139,7 @@ static void connectToWiFi() {
|
|||
|
||||
// Event handler for successful Wi-Fi connection
|
||||
static void onWifiConnect(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
clear_event(EVENT_WIFI_DISCONNECT);
|
||||
set_event(EVENT_WIFI_CONNECT, 0);
|
||||
#ifdef DEBUG_VIA_USB
|
||||
Serial.println("Wi-Fi connected.");
|
||||
|
@ -167,16 +168,14 @@ static void onWifiDisconnect(WiFiEvent_t event, WiFiEventInfo_t info) {
|
|||
#ifdef DEBUG_VIA_USB
|
||||
Serial.println("Wi-Fi disconnected.");
|
||||
#endif
|
||||
//do not do anything here, the reconnect will be handled by the monitor
|
||||
//we dont do anything here, the reconnect will be handled by the monitor
|
||||
//too many events received when the connection is lost
|
||||
//normal reconnects start at fit second
|
||||
clear_event(EVENT_WIFI_DISCONNECT);
|
||||
//normal reconnect retry start at first 2 seconds
|
||||
}
|
||||
|
||||
#ifdef MDNSRESPONDER
|
||||
// Initialise mDNS
|
||||
void init_mDNS() {
|
||||
|
||||
// Calulate the host name using the last two chars from the MAC address so each one is likely unique on a network.
|
||||
// e.g batteryemulator8C.local where the mac address is 08:F9:E0:D1:06:8C
|
||||
String mac = WiFi.macAddress();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue