🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Dealing with background color changes ...

    UIFlow
    3
    6
    8.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      marcvl
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by felmue

        Hello @marcvl

        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?

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 0
        • M
          marcvl
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • IAMLIUBOI
            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.
            0_1616048853175_ba24b7f0-403e-4e56-9073-4ca8f89e8832-image.png

            1 Reply Last reply Reply Quote 0
            • M
              marcvl
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • M
                marcvl
                last edited by

                BTW, I created a new topic "randomness" with more detail on the issues I'm seeing. It goes beyond background color refresh...

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post