<?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[Avoid LCD Flicker When Updating Text on M5StickC?]]></title><description><![CDATA[<p dir="auto">I measure quantities and display them every tenth of a second or so.  The screen flickers annoyingly.</p>
<p dir="auto">I have tried lcd.clear()  and overwriting with the previous text with lcd.Black color in between writes but they both flicker the same way. printing '\r' on each line before writing text doesn't work either.</p>
<p dir="auto">Other suggestions?</p>
]]></description><link>https://community.m5stack.com/topic/2409/avoid-lcd-flicker-when-updating-text-on-m5stickc</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 00:35:08 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2409.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 25 Oct 2020 16:13:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Avoid LCD Flicker When Updating Text on M5StickC? on Sun, 18 Apr 2021 13:33:54 GMT]]></title><description><![CDATA[<p dir="auto">You can always use sprites to get rid of flicker. It happens because you write to LCD in runtime which is slow. Try sprites;</p>
<p dir="auto">First, create a sprite and set the size. Then fill it in black to avoid overwriting text.</p>
<pre><code>disp_buffer = new TFT_eSprite(&amp;M5.Lcd);
disp_buffer-&gt;setSwapBytes(false);
disp_buffer-&gt;createSprite(240, 135);
disp_buffer-&gt;fillRect(0, 0, 240, 135, BLACK);
</code></pre>
<p dir="auto">Then write desired text and push it to screen.</p>
<pre><code>disp_buffer-&gt;drawString("This is some text", 0, 0, 2);
disp_buffer-&gt;pushSprite(0, 0);
</code></pre>
]]></description><link>https://community.m5stack.com/post/13568</link><guid isPermaLink="true">https://community.m5stack.com/post/13568</guid><dc:creator><![CDATA[anuradhawick]]></dc:creator><pubDate>Sun, 18 Apr 2021 13:33:54 GMT</pubDate></item><item><title><![CDATA[Reply to Avoid LCD Flicker When Updating Text on M5StickC? on Mon, 26 Oct 2020 22:16:40 GMT]]></title><description><![CDATA[<p dir="auto">Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> and <a class="plugin-mentions-user plugin-mentions-a" href="/user/robalstona" aria-label="Profile: robalstona">@<bdi>robalstona</bdi></a> , I will try your suggestions tomorrow.<br />
Jack</p>
]]></description><link>https://community.m5stack.com/post/10467</link><guid isPermaLink="true">https://community.m5stack.com/post/10467</guid><dc:creator><![CDATA[JackH]]></dc:creator><pubDate>Mon, 26 Oct 2020 22:16:40 GMT</pubDate></item><item><title><![CDATA[Reply to Avoid LCD Flicker When Updating Text on M5StickC? on Mon, 26 Oct 2020 13:16:56 GMT]]></title><description><![CDATA[<p dir="auto">I am using the <strong>lcd.print</strong> function.  I add one or two spaces to the displayed value and display in the same place.  In firmware version 1.4.5 UiFlow, this function displays text with a black background (default), blurring previously displayed text completely.  And there is no display flickering effect.  Unfortunately, in version 1.5 the background of the text is transparent and the following text overlaps.  I don't know how it is solved from version 1.6 and higher.</p>
<p dir="auto">or try below commands in <strong>execute</strong> block<br />
Print text on screen, x and y is beginning cursor , use  current foreground  color is not given<br />
<strong>lcd.print(text, x, y, [,color])</strong><br />
Set the default foreground color<br />
<strong>lcd.set_fg(color)</strong></p>
<p dir="auto">On 1.4.5 firmware looks like:<br />
<a href="https://youtu.be/EzupP4tXkZA" target="_blank" rel="noopener noreferrer nofollow ugc">https://youtu.be/EzupP4tXkZA</a></p>
]]></description><link>https://community.m5stack.com/post/10465</link><guid isPermaLink="true">https://community.m5stack.com/post/10465</guid><dc:creator><![CDATA[robalstona]]></dc:creator><pubDate>Mon, 26 Oct 2020 13:16:56 GMT</pubDate></item><item><title><![CDATA[Reply to Avoid LCD Flicker When Updating Text on M5StickC? on Mon, 26 Oct 2020 12:46:48 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/jackh" aria-label="Profile: JackH">@<bdi>JackH</bdi></a></p>
<p dir="auto">Here is my attempt to reduce flicker for a simple counter. The code separates the digits and only updates the ones which are necessary. The flicker isn't completely gone, but at least only the digit which changes flickers a little bit.</p>
<pre><code>from m5stack import *
from m5ui import *
from uiflow import *
import time

setScreenColor(0x000000)

count0 = None
oldten0 = None
one0 = None
ten0 = None

from numbers import Number
import math

count0 = 0
oldten0 = 0
for count in range(30):
  one0 = count0 % 10
  lcd.print(one0, 20, 5, 0x000000)
  count0 = (count0 if isinstance(count0, Number) else 0) + 1
  one0 = count0 % 10
  lcd.print(one0, 20, 5, 0xff0000)
  ten0 = math.floor(count0 / 10)
  if ten0 != oldten0:
    lcd.print(oldten0, 5, 5, 0x000000)
    lcd.print(ten0, 5, 5, 0xff0000)
    oldten0 = ten0
  wait_ms(300)
</code></pre>
<p dir="auto">BTW: In the Arduino environment a solution to reduce flicker is to use sprites, but I have no idea if sprites exist in M5Stack's MicroPython implementation.</p>
<p dir="auto">Cheers<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/10464</link><guid isPermaLink="true">https://community.m5stack.com/post/10464</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Mon, 26 Oct 2020 12:46:48 GMT</pubDate></item><item><title><![CDATA[Reply to Avoid LCD Flicker When Updating Text on M5StickC? on Mon, 26 Oct 2020 08:23:35 GMT]]></title><description><![CDATA[<p dir="auto">try use <code>M5.Lcd.fillRect(x,y,w,h,color);</code> to cover display the value. don't need clear whole screen</p>
]]></description><link>https://community.m5stack.com/post/10459</link><guid isPermaLink="true">https://community.m5stack.com/post/10459</guid><dc:creator><![CDATA[m5stack]]></dc:creator><pubDate>Mon, 26 Oct 2020 08:23:35 GMT</pubDate></item></channel></rss>