<?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 Paper : Unable to clear screen contents]]></title><description><![CDATA[<p dir="auto">Hi folks,</p>
<p dir="auto">I just started using M5 paper and went through the documentation at<br />
<a href="https://docs.m5stack.com/en/api/m5paper/epd_canvas" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.m5stack.com/en/api/m5paper/epd_canvas</a></p>
<p dir="auto">Using this info, I created a canvas with some content in the setup.<br />
Then, in the loop I wish to clear the canvas and display some other content.<br />
The code is as follows :</p>
<p dir="auto">#include &lt;M5EPD.h&gt;<br />
M5EPD_Canvas canvas(&amp;M5.EPD);<br />
void setup() {<br />
M5.begin();   //Init M5Paper.<br />
M5.EPD.SetRotation(90);   //Set the rotation of the display.<br />
M5.EPD.Clear(true);  //Clear the screen.<br />
M5.RTC.begin();  //Init the RTC.</p>
<p dir="auto">canvas.createCanvas(540, 960);  //Create a canvas.<br />
canvas.setTextSize(3); //Set the text size.<br />
canvas.drawString("Hello World", 10, 10);  //Draw a string.<br />
canvas.pushCanvas(0,0,UPDATE_MODE_DU4); //Update the screen.<br />
delay(2000);<br />
}</p>
<p dir="auto">void loop() {<br />
M5.EPD.Clear(true); //Clear the screen.<br />
canvas.drawString("Another string", 10, 60);  //Draw a string.<br />
canvas.pushCanvas(0,0,UPDATE_MODE_DU4); //Update the screen.<br />
delay(5000);<br />
}</p>
<p dir="auto">Expected : I see only 'Another string' after refresh every 5 seconds.<br />
Actual : Both 'Hello World' and 'Another string' are displayed.<br />
:(</p>
<p dir="auto">I think I am missing something. May you please explain what is going wrong here?</p>
<p dir="auto">Thanks,<br />
Zitrone</p>
]]></description><link>https://community.m5stack.com/topic/4344/m5-paper-unable-to-clear-screen-contents</link><generator>RSS for Node</generator><lastBuildDate>Thu, 07 May 2026 10:22:34 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4344.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 05 Jun 2022 19:06:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5 Paper : Unable to clear screen contents on Mon, 06 Jun 2022 11:10:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> Thank you for the quick reply.<br />
Yes, it works perfectly. :)</p>
]]></description><link>https://community.m5stack.com/post/17662</link><guid isPermaLink="true">https://community.m5stack.com/post/17662</guid><dc:creator><![CDATA[zitrone]]></dc:creator><pubDate>Mon, 06 Jun 2022 11:10:04 GMT</pubDate></item><item><title><![CDATA[Reply to M5 Paper : Unable to clear screen contents on Mon, 06 Jun 2022 09:07:52 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/zitrone" aria-label="Profile: zitrone">@<bdi>zitrone</bdi></a></p>
<p dir="auto">the reason both strings are displayed is that both strings are present in the canvas which then is pushed to the screen. <code>M5.EPD.Clear(true);</code> only clears what is on the screen but it leaves the canvas untouched, therefore the next <code>pushCanvas()</code> displays both strings again on the screen.</p>
<p dir="auto">Try adding a <code>canvas.fillCanvas(0);</code> after the <code>M5.EPD.Clear(true);</code> - this will clean the canvas (and remove the first string). See also the touch <a href="https://github.com/m5stack/M5EPD/blob/main/examples/Basics/TOUCH/TOUCH.ino" target="_blank" rel="noopener noreferrer nofollow ugc">example</a>.</p>
<p dir="auto">BTW: you don't need the <code>M5.EPD.Clear(true);</code> in the loop for one string to be removed and the other to be added. (Note: w/o there might be a slight shadow where the first string was.)</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/17660</link><guid isPermaLink="true">https://community.m5stack.com/post/17660</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 06 Jun 2022 09:07:52 GMT</pubDate></item></channel></rss>