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

    Display not refreshing within loops

    UiFlow 2.0
    2
    4
    231
    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.
    • B
      BR123456
      last edited by

      Hi,
      On UIFlow 2.3.5, TAB5:
      The display is not refreshing during a loop that changes a label text.
      It only refreshes to the last operation of the loop by the end of the loop.
      I have a callback function for a simple push button that counts from 1 to 100 and displays the count with a label. It only shows the last number by the end of the loop.
      When this exact loop is placed in the main loop it works well.
      I tried the following without success:

      1. Add manual command to the python code: M5.update() within the loop: no refresh
      2. Tried a bar to display the count: bar length not refreshing
      3. Added in the loop a sleep command up to a full second: no refresh

      It seems that an external loops (to the main loop) don't get the attention of the display library, only when this loop is in the main loop.

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

        Hello @BR123456

        the trick is to only set a flag in the button clicked callback function and then in the main loop do whatever needs to be done when that flag has been set.

        I created an example of what I mean in the UIFlow Project Zone: M5Tab5_Count_In_Loop_Test_UIFlow2.3.5

        Thanks
        Felix

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

        B 1 Reply Last reply Reply Quote 0
        • B
          BR123456
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • B
            BR123456 @felmue
            last edited by

            @felmue Thanks.
            I thought of doing this, but it is a kind of a patch, not a fix. The whole advantage of having callbacks functions that perform distinct operations outside of the main loop is almost eliminated by doing this. The main loop need to be as clean as possible, otherwise very quickly it becomes very long and messy.
            Functions outside the main loop should be working properly, unless there is a fundamental reason why they cant access the display libraries properly.
            It looks like a fundamental bug in how the firmware on the TAB5 treats the external functions.

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