Summary
When M5.Power.deepSleep() is called with micro_seconds == 0 and touch_wakeup == false, the device can enter deep sleep without any wakeup source configured and may never wake up unless externally reset.
Current Behavior
Example:
int sleepSec = SleepTimeSec - execTimeSec;
M5.Power.deepSleep(
sleepSec * 1000ULL * 1000ULL,
false
);
If sleepSec unexpectedly becomes 0, the device enters permanent deep sleep. This can be difficult to distinguish from a system freeze.
Suggestion
Consider one of the following:
- Return an error when micro_seconds == 0 and no wakeup source is configured.
- Output a warning log before entering deep sleep.
- Document this behavior in the API reference.
Additional Information
In my case, a calculated sleep duration unexpectedly became 0, causing the device to enter deep sleep without any wakeup source. It took considerable time to diagnose because the symptoms were similar to a system freeze.
This may be intended behavior, but a warning or documentation note could help developers avoid accidental permanent deep-sleep situations.
Summary
When
M5.Power.deepSleep()is called withmicro_seconds == 0andtouch_wakeup == false, the device can enter deep sleep without any wakeup source configured and may never wake up unless externally reset.Current Behavior
Example:
int sleepSec = SleepTimeSec - execTimeSec;
M5.Power.deepSleep(
sleepSec * 1000ULL * 1000ULL,
false
);
If sleepSec unexpectedly becomes 0, the device enters permanent deep sleep. This can be difficult to distinguish from a system freeze.
Suggestion
Consider one of the following:
Additional Information
In my case, a calculated sleep duration unexpectedly became 0, causing the device to enter deep sleep without any wakeup source. It took considerable time to diagnose because the symptoms were similar to a system freeze.
This may be intended behavior, but a warning or documentation note could help developers avoid accidental permanent deep-sleep situations.