Not Fully Solved: Core2 UIFlow touch clears display?
-
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.
I wrote a simple test program to print the current rtc time as a clock.
Here is the python: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)
If I touch the display, it gets cleared to the black background.
The red square that I draw only once disappears, so I know the display is being cleared.
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.How can I disable or change the behaviour of this 'automatic' touch display clear?
I've solved the problem myself. When I use a label the screen clear does not affect it, so only the red square disappears.
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)
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.
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?