Has anyone gotten M5.Rtc.setAlarmIRQ to work on ESP32S3? for
-
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?
-
This post is deleted! -
Hello @wsanders
you answered your question yourself - power off functionality is not implemented yet on M5PaperS3 and therefore RTC alarms do not work.
Some background (as I understand it). Some M5Stack devices - like M5Paper (non S3 version) - can not power off while being powered from USB so the current code in
Power_Class
does the following: it sets up both, RTC alarm and ESP sleep functions (e.g. deep sleep and light sleep). It then first attempts to power off - which works when powered from battery, so the code execution ends here. However when powered from USB, power off does nothing and the 'backup' ESP sleep functions take over.So with M5PaperS3 and the current state of
Power_Class
when you calltimerSleep(int seconds)
it works because ESP sleep function is setup and can take over. However when you call the othertimerSleep()
functions nothing happens as the ESP sleep functions are not setup here and power off isn't implemented yet.And when you call
setAlarmIRQ(30)
andpowerOff()
manually nothing happens either - same reason again - power off is not implemented yet.BTW: you can still test your code though - during the 30 seconds you can double-click the side button to actually power off M5Paper and when the time is up it should power on again.
Thanks
Felix