<?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[Not Fully Solved: Core2 UIFlow touch clears display?]]></title><description><![CDATA[<p dir="auto">I'm trying a few little UIFlow tests on my core2 and I noticed that when I touch the display it always gets cleared to the background colour set in the uiflow.<br />
I wrote a simple test program to print the current rtc time as a clock.<br />
Here is the python:</p>
<pre><code>from m5stack import *
from m5stack_ui import *
from uiflow import *
import time

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0x070707)

lasttime = None
time = None

lcd.clear()
lcd.fill(0x000000)
lcd.rect(50, 50, 50, 50, color=0xff0000)
lasttime = ''
while True:
  time = rtc.printRTCtime()
  if lasttime != time:
    lcd.print(lasttime, 0, 0, 0x000000)
    lasttime = time
    lcd.print(time, 0, 0, 0xffffff)
  wait_ms(500)
  wait_ms(2)
</code></pre>
<p dir="auto">If I touch the display, it gets cleared to the black background.<br />
The red square that I draw only once disappears, so I know the display is being cleared.<br />
When my program writes to the display again, when the time changes after one second, it updates correctly and shows the time in white on a black background.</p>
<p dir="auto">How can I disable or change the behaviour of this 'automatic' touch display clear?</p>
<p dir="auto">I've solved the problem myself. When I use a label the screen clear does not affect it, so only the red square disappears.</p>
<pre><code>from m5stack import *
from m5stack_ui import *
from uiflow import *
import time

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0x000000)

label0 = M5Label('Text', x=0, y=0, color=0xffffff, font=FONT_MONT_26, parent=None)

lasttime = None
time = None

lcd.clear()
lcd.fill(0x000000)
lcd.rect(50, 50, 50, 50, color=0xff0000)
lasttime = ''
while True:
  time = rtc.printRTCtime()
  if lasttime != time:
    lasttime = time
    label0.set_text(str(time))
  wait_ms(500)
  wait_ms(2)
</code></pre>
<p dir="auto">I suppose this has something to do with which layers on the display are being cleared by the touch? But this still seems strange default behaviour to me.</p>
<p dir="auto">If I download the original program to the Core2 (without using a label) and run it from the app menu, any touches do not clear the display at all. If I then reset the Core2 and the app runs automatically, it then clears the display when I do a touch. What is going on?</p>
]]></description><link>https://community.m5stack.com/topic/2270/not-fully-solved-core2-uiflow-touch-clears-display</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 22:00:54 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2270.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 05 Sep 2020 07:18:31 GMT</pubDate><ttl>60</ttl></channel></rss>