Dealing with background color changes ...
I'm designing a "Nest"-like thermostat using UIFlow and I'm running into issues with changing the background colors to orange ("heating") and blue ("cooling").
When the ENVII sensor temperature is above the set temperature, I want to change the background to blue. When the temperature is below the set temperature, the background needs to become orange.
When I use "Set Screen backgroundColor" I'm getting strange results... Some screen elements disappear, and some stay... I'm automatically updating my display with new sensor readings once per minute. After each refresh things change .... some screen elements will reappear and some won't... So, it doesn't feel at all reliable.
When I use "Lcd.fill" to set the screen color, things work more reliably. However, the rectangular behind the slider UI elements becomes visible, because it keeps the default screen background color. There doesn't seem to be any way to update that color.
What would be the best way to solve this issue?
felmue last edited by felmue
I cannot reproduce the issue you are reporting with UIFlow 1.7.3 online and a M5Core2 UIFlow firmware 1.7.3. I've added some text, button, lines, slider, switch and checkboxes to the screen and switch background with BtnA and BtnB using
Set Screen backgroundColor.
- which M5 device are you using? M5Stack (Fire, Gray, ...), M5Core2, M5StickC?
- which UIFlow firmware version are you using?
- which elements are ok and which disappear?
- could you share your code?
I'm using M5Core2. Firmware 1.7.3. I made several code changes since posting this and I need to recreate the scenario I described. Will post my code shortly.
IAMLIUBO last edited by
Waiting for more detail or .m5f file to test.
I can change the background color with these blocks, and UI element won't disapper.
You can download my .m5f from here: https://drive.google.com/file/d/1m0h_doYGzMuLBswxOFLACEBcgvQ9D_7m/view?usp=sharing
(I'm currently using a Core2 with an ENV2 sensor connected to it)
For context, this is the beginning of a thermostat app that integrates with Home Assistant through MQTT. Not all MQTT components have been built yet.
The background changes are happening in the 'UpdateDisplay' function. When the background changes all other screen elements disappear. Some of the elements come back after a screen refresh (which happens every 20 seconds), but it takes multiple refreshes typically for all visual elements to be back.
There is something else weird ... When I 'play' this app on my Core2, it will take multiple attempts for the buttons at the bottom to work. Sometimes one works, sometimes two, but it takes several downloads for all 3 to work. As you can see from the code, i'm pushing debug info over MQTT so I can monitor what's happening. That's how I can tell which buttons work.
BTW, I created a new topic "randomness" with more detail on the issues I'm seeing. It goes beyond background color refresh...