Trying to get M5.Rtc.setAlarmIRQ to work. Note: Device is PaperS3, so this function may not be implemented yet.
M5.Rtc.setAlarmIRQ(30);
M5.Power.powerOff();
This should reboot the device every 30 sec but doesn't.
M5.Power.timeSleep works, and is coded thus in Power_Class.cpp:
void Power_Class::timerSleep( int seconds )
{
M5.Rtc.disableIRQ();
M5.Rtc.setAlarmIRQ(seconds);
#if !defined (M5UNIFIED_PC_BUILD)
esp_sleep_enable_timer_wakeup(seconds * 1000000ULL);
#endif
_timerSleep();
}
However, for the PaperS3, M5UNIFIED_PC_BUILD is not defined, so the RTC timer call is not used, and the esp timer is called instead. I'm not sure why, because the PaperS3 has the same RTC chip as all the other M5 devices, and getting and setting the RTC clock seems to work. Yet, when I call M5.Rtc.disableIRQ and M5.Rtc.setAlarmIRQ separately in my code, it doesn't work.
It's also unclear form the ESP documentation is esp_sleep_enable_timer_wakeup even puts the ESP to sleep. You can put the ESP in deep sleep with a wakeup time, but the PaperS3 still drains about 5mA of power, much more than it should if it were completely powered off. (It is a known issue that M5.Power.powerOff doesn't completely power off the PaperS3, but this should not affect the Rtc alarm.)
I hope this is not a bug in the odd PMS150G power chip since that chip cannot be reprogrammed in the PowerS3.
Any ideas?