Text Flashing on Change #567
Replies: 15 comments
-
@renegadeandy If you post a zip file of a small sample project that demos the problem I'll take a look at it. I have done similar things using TFT_eSPI's sprite animation extensions and Adafruit_GFX Canvas extensions. See, my example: progress-percent "External storage size" -- is this the number of chars for the variable that will be declared? Paul-- |
Beta Was this translation helpful? Give feedback.
-
Hi @Pconti31 thanks for helping! Please see the example attached. For me this example highlights the entire screen redrawing on each of the text strings update from 0 to 100. Regarding external storage size - I am indeed using GUISlice Builder. SO the answer is, put in the number of chars for my string and it will ad a 1 to the end to null terminate. Nice :) |
Beta Was this translation helpful? Give feedback.
-
Hi @renegadeandy -- in general, GUIslice attempts to only redraw the minimum rectangular "update region" that includes any elements that could be affected by a change. So if you only had a modifiable text field that changed, and no overlapping elements or background image, then just the modifiable text element would need to change. In your case, you're observing that the entire display is getting redrawn. This often suggests that you may have some overlapping elements (or have enabled some types of transparency etc). Having a real quick look at your rustaidgui_GSLC.h, it appears that your modifiable text element (E_ELEM_TEXT2) may be overlapping with the Ring Gauge (E_ELEM_RINGGAUGE2). Perhaps I misread the coordinates, but it looks like the TEXT2 X coordinate extends from X=5 to 240 (5+235), with Y from 23 to 36 (23+13). The Ring Gauge region is from X=205 to 236 (205+31) and Y=0 to 45 (0+45). If you changed the width of your ELEM_TEXT2 to be narrower (eg. width < 180), I wonder if the extra redraws might be reduced? Anyway, I may have overlooked something in my quick check, but perhaps this could be a reason. Happy to have a look at it if you or Paul don't see an obvious issue. thanks! |
Beta Was this translation helpful? Give feedback.
-
Thanks for looking @ImpulseAdventure I tried this - didnt help. Updated project attached. |
Beta Was this translation helpful? Give feedback.
-
@renegadeandy @ImpulseAdventure I ran this and it seems you do have one overlap field. Text3 extends to end of display overlaying Text4. However, you are basically updating every field (but the title Rust Aid and line drawing) at an extreme speed so I don't think GUIslice could do anything but flicker since text is written by Adafruit_GFX under the covers. Calvin can answer that one. Calvin's algorithm does make things slightly worst by refreshing the static fields Line, Title etc... I suppose a nice extension to GUIslice API would be to turn off his algorithm or have a way to mark fields as static and not include them in his region of update. I don't remember if Calvin has the idea of multiple regions of update or just makes the biggest one. In which case static fields would not work. If you are simply trying to show progress without a screen flicker I susgest using my progress bar with percentage that is Flicker free, I also would guess creating a Extended Text Element, say XFlickerFreeText.<h, c> that uses FlickerFreePrint library might help and holds the various text fields you are trying to update at high speeds. Although, I'm not aware of anyone but Calvin and I who have every created an Extended Element... Paul-- |
Beta Was this translation helpful? Give feedback.
-
@Pconti31 I think extending the text element to have a flickefreemode would be ideal. I am unsure about how to create such an extension. If you could lay out a plan...I cuold try byte (haha) some of this off and add it to the project. |
Beta Was this translation helpful? Give feedback.
-
I switched over to TFT_eSPI and removed the 2 text fields I was changing - and now the UI is perfectly stable, no flashing or any problem on text or progress indicator. You can see this in the following project: @Pconti31 @ImpulseAdventure please can you take a look? I think this test case highlights a clear problem? |
Beta Was this translation helpful? Give feedback.
-
@renegadeandy @ImpulseAdventure I ran your app just now and the good news is that after my suggested edits to JPEGDecoder.h
you icon RustLogo.bmp shows up fine. As for flicker, again you can always see what fields will be refreshed by adding to your config file:
A red box will appear marking the refresh area. You most likely should'nt update the ring graphic each time through loop() but only in major increments. Unless you use my It just too much to expect anything but a sprite animation (like my progress bar) to behave without flicker at As for the text flicker I haven't yet figured out anyway to fix it. Still looking... Paul-- |
Beta Was this translation helpful? Give feedback.
-
Hi @Pconti31 aha - I didn't see where you had documented where to make these changes to jpegdecoder...? Is this something due to get fixed in the JPEGDecoder library? It now works- thank you! Please let me know regarding the text updates - and how you come across any solutions to fix that. I will look to use some of your widgets, as they are better fitted for my use. |
Beta Was this translation helpful? Give feedback.
-
@renegadeandy @ImpulseAdventure No idea. I found this topic which led me to do these code changes |
Beta Was this translation helpful? Give feedback.
-
@renegadeandy I found a bug in the Builder that was causing most of your flashing issues.
This was forcing full page refreshes to occur on each update loop. If you download GUIsliceBuilder 0.17.b40 and go though each text field and set Also the newly added is text a variable seems to have confused people so I renamed it to
As for flicker free I have created a extended element XTextNoFlicker Note: with the changes I made to the builder you might not need this extended element. |
Beta Was this translation helpful? Give feedback.
-
Hello @Pconti31 What a great bit of news! I have upgraded my GUISlice builder, and am using these options as you detail now. It is definitely better, I do still see some flicking, so I want to use the #define DBG_REDRAW option. I added that line to my config and it shows: The debug line shows: 100DBG: PageRedrawGo() InvRgn: En=1 (3,5)-(234,65) PageRedraw=0 Not entirely sure what to make of that? The redbox goes around nearly all elements. Is this saying that entire rectangle is being redrawn? If so, why! Project included in case you can spot the problem? |
Beta Was this translation helpful? Give feedback.
-
@renegadeandy Turns out a simple fix. everyone else looks good. Newly added text fields will always now default to Fill Enabled?=true its just I couldn't do anything about existing fields. Anyway, let me know if you end up needing the XTextNoFlicker. I plan on adding it to my GUIslice-Solutions Repository at some point in anycase. Paul-- |
Beta Was this translation helpful? Give feedback.
-
Absolutely fantastic! Silly me. Thank you for your help, fixes and advice |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I am hitting a problem I have hit in the past when updating a text string on my ESP32 application. Before this lib - I used this lib https://github.com/KrisKasprzak/FlickerFreePrint
It worked very well at avoiding flickering when changing a text string on a screen (I use ILI9341 no touch).
I have made a very simple UI with 3 text objects - which are static, and 2 which are dynamic.
When either of my 2 text items change, I can visibly see the text 'flash' despite the fact that only one of the 14 chars is changing on my string.
I wonder if it would be possible to integrate this FlickerFreePrint into the generated code.....or perhaps there is some best practices I am missing when dealing with text updates.
frame enabled
flash api
fill enabled
I use none of these? I assume none of these will help. I am updating my text as follows:
Does anyone have any top tips for how to make text updates without having any flashing? I saw some posts about 'boxes' not being the right size etc - but I am not sure what that means, or how to check if I am invalidating that rule?
Another question. "External storage size" -- is this the number of chars for the variable that will be declared? If i wanted to display a single char, would that be a value of 1, or a value as 2 as it would need to be null terminated?
ANy thoughts would be brilliant!
Beta Was this translation helpful? Give feedback.
All reactions