<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[M5.shutdown(x) does not last x seconds]]></title><description><![CDATA[<p dir="auto">I would like my <strong>M5 Core Ink</strong> to <strong>shutdown</strong> (to save battery), then <strong>automatically wake up</strong> after a given amount of seconds and resume its activity.<br />
For that, I use <code>M5.shutdown(x)</code> where <code>x</code> is the amount of seconds. To my understanding, that's typically what <code>shutdown</code> does.</p>
<p dir="auto">It is <strong>not working</strong>!  For example, I specify 60 seconds as argument to <code>M5.shutdown()</code>, the program's  <code>loop()</code> is still called every ~5 seconds!<br />
<em>Strange: the eInk display is not refreshed...</em> (at all).</p>
<p dir="auto">Precisely, my <code>loop</code> code</p>
<ul>
<li>Gets the RTC time</li>
<li>Displays it (both Serial and eInk)</li>
<li>Calls <code>M5.shutdown(60)</code></li>
</ul>
<p dir="auto">The serial monitor shows that <code>loop</code> is called every <strong>~6-7 seconds</strong>. Strange, the <em>eInk screen is not refreshed</em> and displays only the first RTC time.</p>
<pre><code>RTC Time 14:07:35
Shutting down for 60 seconds
RTC Time 14:07:41
Shutting down for 60 seconds
</code></pre>
<p dir="auto">Code</p>
<pre><code class="language-c">#define DELAY_SECONDS 60

void loop() {
  // Get RTC time
  RTC_TimeTypeDef rtcTime;
  M5.rtc.GetTime(&amp;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);
}
</code></pre>
<p dir="auto">I tried <code>M5.shutdown(60000)</code>, same result. I also tried supplying a rtcTime to <code>shutdown</code>, but it didn't change anything either.</p>
<p dir="auto">The creation of the sprite is in <code>setup</code>:</p>
<pre><code class="language-c">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(&amp;rtcTime);
  
  Serial.printf("[+] Setup success\n");
}
</code></pre>
]]></description><link>https://community.m5stack.com/topic/4141/m5-shutdown-x-does-not-last-x-seconds</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Mar 2026 14:33:38 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4141.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 22 Mar 2022 13:24:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5.shutdown(x) does not last x seconds on Tue, 22 Mar 2022 15:21:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4037">@felmue</a> said in <a href="/post/16984">M5.shutdown(x) does not last x seconds</a>:</p>
<blockquote>
<p dir="auto">the shutdown functionality only works when M5CoreInk is running from battery.</p>
</blockquote>
<p dir="auto">ah haaaaaaaa! ok! Thanks for the remark! Indeed. And now it works (when from battery).</p>
<p dir="auto">And if somebody wonders, it might be useful to note in the doc that <code>shutdown()</code> actually has the M5 run again the <code>setup()</code> code (it makes sense, as it is "shut-down" but worth mentioning because it changes the way to implement things).</p>
]]></description><link>https://community.m5stack.com/post/16986</link><guid isPermaLink="true">https://community.m5stack.com/post/16986</guid><dc:creator><![CDATA[aafortinet]]></dc:creator><pubDate>Tue, 22 Mar 2022 15:21:05 GMT</pubDate></item><item><title><![CDATA[Reply to M5.shutdown(x) does not last x seconds on Tue, 22 Mar 2022 13:54:19 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/17751">@aafortinet</a></p>
<p dir="auto">the shutdown functionality only works when M5CoreInk is running from battery.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/16984</link><guid isPermaLink="true">https://community.m5stack.com/post/16984</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 22 Mar 2022 13:54:19 GMT</pubDate></item></channel></rss>