Flickering Problem - Screen Buffering but also turn off Display #1790
Replies: 12 comments
-
Posted at 2020-05-26 by @gfwilliams Hi! Ahh, that's an interesting problem - I'd always intended the What I'd suggest is to actually use an offscreen buffer if you can... So something like is done here: https://github.com/espruino/BangleApps/blob/master/apps/speedo/speedo.js That way you can have everything coexist with widgets as well - if you're planning on using it for 6 hours or so, battery level and stuff like that might be handy. That way you can use The speedo uses a single color - I'm not sure if that'd work for you? You can use a color palette to do the lookup if you need more colors though: https://github.com/espruino/BangleApps/blob/master/apps/gpsnav/app.js#L7 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-26 by AxelRHD Hi Gordon. Thank you for the quick feedback. I will try the offscreen buffer this evening. Is there a maximum size or can I use the full 240x240px? I also came over another little thing: it would be nice to get the acual brightness or the default value from settings. This is maybe possible already (didn't find it in the Reference). Thank you again so much! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-26 by @gfwilliams
It's just how much RAM you have available. 1bpp x 240 x 240 is 7.2k, which will fit in memory just fine. Even better if you do 240x192 to leave room for widgets. That size at 2bpp would also be fine, but you just need to be a little careful not to try to allocate too much other memory :)
Not sure I understand? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-26 by AxelRHD
As example an app could dim the brightness down for power saving and restore the user-set value by event or closing the app. So how can I get/read the actual state of brightness to restore it later (if possible)? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-26 by AxelRHD Okay, now I mixed up a sample of your two suggestions. But now I have heavy flickering again:
I guess I have still a big misunderstanding of the usage of rendering with the Bangle.js. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-26 by NebbishHacker You don't need to call |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-27 by @gfwilliams
Yep, this :)
It's just handled here: https://github.com/espruino/BangleApps/blob/master/apps/setting/boot.js#L5 So you basically do what's in that code. Load the settings, check |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-27 by AxelRHD @nebbishhacker & @gfwilliams, thank you both so much. Removing With the buffer I recognized that the normal |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-27 by @gfwilliams
Yep, that's right :) Another option is to go for a half-res image (120x120) and then use a higher bit depth... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-27 by AxelRHD
So can I find that somewhere in the documentation? Which resolution works with how many colors? Or is this something that can be calculated? Would it be better to use multiple buffers for different areas on the screen or is this not advisable? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-27 by NebbishHacker You can calculate the amount of ram a buffer will take up as widthheightbpp/8. A 240x192 2bpp buffer takes up 11952 bytes, or about 12kb. If you halve the size to 120x96 you can fit quadruple the bit depth (8bpp) in the exact same amount of space. Using multiple buffers should work fine - I was actually just experimenting with that the other night. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-27 by AxelRHD Yes, I experimenting this evening and just getting more and more behind the concept. I will render the different components of my app with the suitable bpp instead of the one fullscreen component, hoping to save memory this way. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-05-24 by AxelRHD
Hello everyone!
Yesterday my Bangle finally arrived. I immediatly started with my project to develop a timer app for Football Officiating and came unpleasant problem of the flickering screen. I red the tutorial with the possibility to Buffer the Screen output and gave it a try.
If the display is on, the countdown timer will draw every second a new screen with g.flip(). But this always resets the Screen timeout so the Display stays on forever, until the countdown timer stops or ist interrupted.
Is there a workaround or best practice to get along with this or is it no problem to keep the display on for a longer period? If we officiate a tournament, I need the clock for ~ 6 hours.
Thank you for support. :)
Beta Was this translation helpful? Give feedback.
All reactions