in my project I use a Wemos® TTGO WiFi + Bluetooth Battery ESP32 0,96 OLED with a BM280 sensor. To safe battery I use switch widget for deep sleep (60 sec). For the first time (typically 2 - 3 hrs) it seems that all works fine : if the switch is on (deep sleep) the oled goes off and the system goes in deep sleep mode for 60 sec and so on. But sometime it seems that after the wake up the sync all doesn’t work properly : the system doesn’t see the switch on and in such a way it doesn’t go in deep sleep mode (i.e. the system stay on).
I’ve made some tests but I don’t understand where is the problem. Some suggestion ?
You should consider switching to Blynk.config() as your current method could leave your device in a holding pattern if it doesn’t connect to the server.
@Toro_Blanco, thank you very much for your help. I’ve tried your suggestion for two days but the behavior after deep sleep is the same : sometime ESP32 lost the communication or doesn’t sync with switch widget.
Following @Gunner now I’m trying with this (from a project by @Costas but also you can see keeping your suggestion) :
Okay, also with these modifications after deep sleep wake up the system hang up or doesn’t sync with widgets status.
I suppose that may this depend on :
the board (i’ll check with another one);
non correct procedure before and after wake up from deep sleep;
I did a super quick search and even quicker scan… AKA didn’t really look that hard so while this may or may not be related… it is just the tip of the iceberg.
I come back on this issue after many trials but no good results.
Same results updating Arduino esp32 revision.
I’ve tried to use RTC_DATA_ATTR to collect reboots numbers and after 25 reboots I use esp_restart() to software restart the module but the behavior is the same with two different Wemos ESP32 modules.
Maybe try using some very simple code, and see if the issue is with the ESP32 itself, or maybe a coding issue. Something like: wake up, send a notification and then go back to sleep. If the issue still persists it may be something with the hardware itself. From what I gather about the ESP32s is that they are still hammering out all the kinks. Maybe this is one they are working on, or have yet to discover.
I’ve removed BME280 and all libraries (SPI, wire sensor) need for this sensor : no problem after 3 days.
With Google i’ve found this discussion https://github.com/espressif/arduino-esp32/issues/839.
If i understand well there is still some problem in Esp32 with I2C (& SPI?).
Update : also using external wake up, after random number of reboot the system hang up.
Same behaviour with three different esp32 model ( all by Bangood).
It seems that esp32 has some problem to manage the wake up after deep sleep…