<?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[Adding Text to screen button causes any subsequent screen text writes to corrupt screen]]></title><description><![CDATA[<p dir="auto">I'm using an M5Stack Core2 AWS on a project where I need to use on-screen buttons:</p>
<pre><code>Button BtnL(10, 190, 60, 40, false, "Dec", off_clrs, on_clrs, TL_DATUM);
//and:
BtnL.setLabel("Dec");
</code></pre>
<p dir="auto">I have found that anytime I put any text into the button, the screen after the button is displayed (such as):</p>
<pre><code>M5.Lcd.print(Line2.c_str());
// or
M5.Lcd.print(Line2);
</code></pre>
<p dir="auto">the screen is corrupted and the only way that I have found to correct the problem is to reboot the Core2 device.</p>
<p dir="auto">The corrupted screen looks like:<br />
<img src="/assets/uploads/files/1738717369389-19030666-17a2-46d2-b328-e322f08fffb8-image.png" alt="19030666-17a2-46d2-b328-e322f08fffb8-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The only way I've found to use the on-screen buttons is to leave the button text blank and write the text above the screen button.</p>
<p dir="auto">This very much appears to be a bug in the code.<br />
Should I write this up as a bug on <a href="https://github.com/m5stack/M5Core2/issues/" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Core2/issues/</a> ?</p>
<p dir="auto">Sir Michael</p>
]]></description><link>https://community.m5stack.com/topic/7268/adding-text-to-screen-button-causes-any-subsequent-screen-text-writes-to-corrupt-screen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 02:29:18 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7268.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 05 Feb 2025 01:08:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Thu, 13 Feb 2025 21:00:40 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sirmichael" aria-label="Profile: SirMichael">@<bdi>SirMichael</bdi></a></p>
<p dir="auto">you are absolutely correct. Overwriting the button with a rectangle only removes it from the screen, but doesn't deactivate its touch function. You would need to deactivate the touch function in addition to drawing the rectangle. Sorry I've missed that.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/28216</link><guid isPermaLink="true">https://community.m5stack.com/post/28216</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Thu, 13 Feb 2025 21:00:40 GMT</pubDate></item><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Thu, 13 Feb 2025 15:15:40 GMT]]></title><description><![CDATA[<p dir="auto">Felix,</p>
<p dir="auto">I had tried your suggestion, but the covered buttons would still re-act.  With some more playing, I think that I could have gotten it to work, but I had re-designed the interface to use the</p>
<pre><code>M5.BtnA.wasReleasedAfterHold());
</code></pre>
<p dir="auto">to substitute for the on-screen buttons.</p>
<p dir="auto">I do sincerely appreciate your help!</p>
<p dir="auto">Sir Michael</p>
]]></description><link>https://community.m5stack.com/post/28208</link><guid isPermaLink="true">https://community.m5stack.com/post/28208</guid><dc:creator><![CDATA[SirMichael]]></dc:creator><pubDate>Thu, 13 Feb 2025 15:15:40 GMT</pubDate></item><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Wed, 12 Feb 2025 18:00:49 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sirmichael" aria-label="Profile: SirMichael">@<bdi>SirMichael</bdi></a></p>
<p dir="auto">I don't see any function which would hide and show a button either. I suggest you try either clearing the screen and recreate  as you already mentioned or for only one button you could use <code>fillRect()</code> with screen background color to make it hidden.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/28187</link><guid isPermaLink="true">https://community.m5stack.com/post/28187</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 12 Feb 2025 18:00:49 GMT</pubDate></item><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Wed, 12 Feb 2025 17:41:28 GMT]]></title><description><![CDATA[<p dir="auto">Felix,</p>
<p dir="auto">The only thing that I'm missing with it is the commands to be able to ".erase" and show again. I tried to check the options (adding the "." and checking what options are available, but I didn't find anything that seemed like it would work.. I'm not sure how to erase, or would I just do a clear screen and recreate it?</p>
<p dir="auto">Sir Michael</p>
]]></description><link>https://community.m5stack.com/post/28186</link><guid isPermaLink="true">https://community.m5stack.com/post/28186</guid><dc:creator><![CDATA[SirMichael]]></dc:creator><pubDate>Wed, 12 Feb 2025 17:41:28 GMT</pubDate></item><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Sun, 09 Feb 2025 17:44:35 GMT]]></title><description><![CDATA[<p dir="auto">Felix,</p>
<p dir="auto">Thanks for the example.  That helps.</p>
<p dir="auto">The only thing that I'm missing with it is the commands to be able to ".erase" and show again.  I tried to check the options (adding the "." and checking what options are available, but I didn't find anything that seemed like it would work..  I'm not sure how to erase, or would I just do a clear screen and recreate it?</p>
<p dir="auto">I did play with it and added some line text, and it doesn't exhibit the same bug that the M5Core2 button graphics does when I wrote line and used the:</p>
<pre><code>btn2.setLabelText("BUTTON");
</code></pre>
<p dir="auto">It doesn't mess up the screen text by making the existing text LARGER.</p>
<p dir="auto">Thanks,</p>
<p dir="auto">Sir Michael</p>
]]></description><link>https://community.m5stack.com/post/28158</link><guid isPermaLink="true">https://community.m5stack.com/post/28158</guid><dc:creator><![CDATA[SirMichael]]></dc:creator><pubDate>Sun, 09 Feb 2025 17:44:35 GMT</pubDate></item><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Wed, 05 Feb 2025 20:44:38 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sirmichael" aria-label="Profile: SirMichael">@<bdi>SirMichael</bdi></a></p>
<p dir="auto">if you are still interested - I figured out a way to create touch screen buttons using M5Unified and M5GFX library. Please find the example <a href="https://github.com/felmue/MyM5StackExamples/blob/main/M5Core2/TouchButtonTest/TouchButtonTest.ino" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/28129</link><guid isPermaLink="true">https://community.m5stack.com/post/28129</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 05 Feb 2025 20:44:38 GMT</pubDate></item><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Wed, 05 Feb 2025 20:36:31 GMT]]></title><description><![CDATA[<p dir="auto">I gave up trying to create on-screen buttons and figured out a way to use the A/B/C buttons using either</p>
<pre><code>M5.BtnB.wasreleased() 
//or
M5.BtnB.wasReleasedAfterHold()
</code></pre>
<p dir="auto">I was also able to get it to compile under M5Unified.h.  I'll try to proceed with that.</p>
<p dir="auto">I still need to get the Deep Sleep to work under the M5Unified.h, but I'm getting there....</p>
<p dir="auto">Sir Michael</p>
]]></description><link>https://community.m5stack.com/post/28128</link><guid isPermaLink="true">https://community.m5stack.com/post/28128</guid><dc:creator><![CDATA[SirMichael]]></dc:creator><pubDate>Wed, 05 Feb 2025 20:36:31 GMT</pubDate></item><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Wed, 05 Feb 2025 14:27:47 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></p>
<p dir="auto">I had tried that.  I had the exact same sequence but nothing that I would do would correct the corrupted screen.  The only way was to reboot!</p>
<p dir="auto">I would move over to the <strong>M5Unified.h</strong>, but I can't figure out how to create the same buttons:</p>
<pre><code>Button BtnL(10, 190, 60, 40, false, "Dec", off_clrs, on_clrs, TL_DATUM);
//and:
BtnL.setLabel("Dec");
</code></pre>
<p dir="auto">using the M5Unified.h library.  The Touch examples are so obfuscated, I can't figure out how to get a simple button to work.  I actually wrote up a bug report about this:<br />
<a href="https://github.com/m5stack/M5Unified/issues/147" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Unified/issues/147</a></p>
<p dir="auto">By any chance, can you point me at an example that demonstrates the on screen button [wasreleased()] operation?</p>
<p dir="auto">Sir Michael</p>
]]></description><link>https://community.m5stack.com/post/28123</link><guid isPermaLink="true">https://community.m5stack.com/post/28123</guid><dc:creator><![CDATA[SirMichael]]></dc:creator><pubDate>Wed, 05 Feb 2025 14:27:47 GMT</pubDate></item><item><title><![CDATA[Reply to Adding Text to screen button causes any subsequent screen text writes to corrupt screen on Wed, 05 Feb 2025 06:46:32 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/sirmichael" aria-label="Profile: SirMichael">@<bdi>SirMichael</bdi></a></p>
<p dir="auto">there is a mechanism trying to deal with this issue. Please see <a href="https://github.com/m5stack/M5Core2/blob/master/src/M5Display.h#L123" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>.</p>
<p dir="auto">That said, it did not work for me. What works is to set the relevant parameters every time before printing to the screen like below:</p>
<pre><code>  M5.Lcd.setCursor(0, 10);
  M5.Lcd.setTextFont(2);
  M5.Lcd.setTextColor(TFT_YELLOW);
  M5.Lcd.print("hallo 2");
</code></pre>
<p dir="auto">Thanks<br />
Felix</p>
<p dir="auto">P.S.: M5Core2 library is deprecated and I haven't seen the <a href="https://community.m5stack.com/user/rop">person</a> who wrote the library in the forums in a long time.</p>
]]></description><link>https://community.m5stack.com/post/28118</link><guid isPermaLink="true">https://community.m5stack.com/post/28118</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 05 Feb 2025 06:46:32 GMT</pubDate></item></channel></rss>