M5.shutdown(x) does not last x seconds
-
I would like my M5 Core Ink to shutdown (to save battery), then automatically wake up after a given amount of seconds and resume its activity.
For that, I useM5.shutdown(x)
wherex
is the amount of seconds. To my understanding, that's typically whatshutdown
does.It is not working! For example, I specify 60 seconds as argument to
M5.shutdown()
, the program'sloop()
is still called every ~5 seconds!
Strange: the eInk display is not refreshed... (at all).Precisely, my
loop
code- Gets the RTC time
- Displays it (both Serial and eInk)
- Calls
M5.shutdown(60)
The serial monitor shows that
loop
is called every ~6-7 seconds. Strange, the eInk screen is not refreshed and displays only the first RTC time.RTC Time 14:07:35 Shutting down for 60 seconds RTC Time 14:07:41 Shutting down for 60 seconds
Code
#define DELAY_SECONDS 60 void loop() { // Get RTC time RTC_TimeTypeDef rtcTime; M5.rtc.GetTime(&rtcTime); // Display time sprintf(buf, "%02d:%02d:%02d", rtcTime.Hours, rtcTime.Minutes, rtcTime.Seconds); InkPageSprite.drawString(10,50,buf); InkPageSprite.pushSprite(); Serial.printf("RTC Time %02d:%02d:%02d\n", rtcTime.Hours, rtcTime.Minutes, rtcTime.Seconds); // Sleep delay(100); Serial.printf("Shutting down for %d seconds\n", DELAY_SECONDS); M5.shutdown(DELAY_SECONDS); }
I tried
M5.shutdown(60000)
, same result. I also tried supplying a rtcTime toshutdown
, but it didn't change anything either.The creation of the sprite is in
setup
:void setup() { M5.begin(); //Init CoreInk. if( !M5.M5Ink.isInit()) //Init CoreInk screen. { Serial.printf("[-] M5Ink init failed"); while (1) delay(100); } M5.M5Ink.clear(); // Clear screen. Serial.printf("[+] Clearing eInk screen\n"); delay(1000); if( InkPageSprite.creatSprite(0,0,200,200,true) != 0 ){ Serial.printf("[-] Ink Sprite create failed\n"); } // set RTC time RTC_TimeTypeDef rtcTime; rtcTime.Hours = 14; rtcTime.Minutes = 6; rtcTime.Seconds = 0; M5.rtc.SetTime(&rtcTime); Serial.printf("[+] Setup success\n"); }
-
Hello @aafortinet
the shutdown functionality only works when M5CoreInk is running from battery.
Thanks
Felix -
@felmue said in M5.shutdown(x) does not last x seconds:
the shutdown functionality only works when M5CoreInk is running from battery.
ah haaaaaaaa! ok! Thanks for the remark! Indeed. And now it works (when from battery).
And if somebody wonders, it might be useful to note in the doc that
shutdown()
actually has the M5 run again thesetup()
code (it makes sense, as it is "shut-down" but worth mentioning because it changes the way to implement things).