sharandac / My-TTGO-Watch

A GUI named hedge for smartwatch like devices based on ESP32. Currently support for T-Watch2020 (V1,V2,V3), T-Watch2021, M5Paper, M5Core2 and native Linux support for testing.
GNU General Public License v2.0
537 stars 246 forks source link

Abnormal after WiFi goes off screen #361

Closed lewisxhe closed 2 years ago

lewisxhe commented 2 years ago

https://github.com/sharandac/My-TTGO-Watch/blob/1b085c0e011aab5a7dc416111d2a1b43d1c87931/src/hardware/wifictl.cpp#L649

esp_wifi_stop(); should not be called here, it will cause the wifi to turn off after turning off the screen, just call WiFi.mode( WIFI_OFF );

sharandac commented 2 years ago

Thanks for your feedback. esp_wifi_stop() and esp_wifi_start() are intended to reset the driver control structure. For example, if promiscuous mode has been activated by an APP. Wifi.mode() does not do this. Can you describe exactly the effect that occurs?

lewisxhe commented 2 years ago

In V1, V2, V3, if you turn off the screen and then turn on the wifi scan, it will not scan any device, then restart it, you can scan the device for the first time, because it has not called esp_wifi_stop, when the screen is turned off, call esp_wifi_stop , turning on the screen again will not find any devices, I think you should call WiFi.mode(WIFI_OFF) instead of esp_wifi_stop, everything works fine after I comment out esp_wifi_stop. Of course I just tested the wifi scan, I also noticed that Some places also call esp_wifi_stop

sharandac commented 2 years ago

Thanks for the feedback and the explanation!