Display not refreshing within loops
-
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:- Add manual command to the python code: M5.update() within the loop: no refresh
- Tried a bar to display the count: bar length not refreshing
- 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.
-
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 -
This post is deleted! -
@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.