buxtronix / am43

Control AM43 blinds with an ESP32
MIT License
76 stars 25 forks source link

wifiDownSince keeps getting reset when WiFi loses connection #15

Open adotagarwal opened 4 years ago

adotagarwal commented 4 years ago

So - I noticed that occasionally the ESP starts receiving NO_AP_FOUND events consistently:

[W][WiFiGeneric.cpp:353] _eventCallback(): Reason: 201 - NO_AP_FOUND
[WiFi-event] event: 5
WiFi lost connection

When this happens, the clock for the wifiDownSince just keeps getting reset and so it never tries to reconnect. I think I can fix this by only setting wifiDownSince if the current millis() is less than the wifiDownSince, and setting the wifiDownSince = max value (4294967295 or something) when we connect.

Do you have any thoughts?