RyanDam / Infocal

Infocal watchface for Garmin devices
MIT License
60 stars 46 forks source link

Fix blank screen bug with vivoactive4(s) when in power saving mode #5

Closed tomfogg closed 4 years ago

tomfogg commented 4 years ago

Hi and thanks for open sourcing this watch face!

I saw there was a bug with the vivoactive 4/4s when in power saving mode and since I have a 4s I had a go at fixing it. This is my first look at any garmin/monkeyc stuff so apologies if it is a mess.

The problem seems to be that the va4(s) sometimes clears the watch DC and with infocal in powersave relying on the DC being persistent and skipping redraws, you get a blank screen. I couldn't find a way of determining when the DC gets cleared to force a redraw so instead I save the screen to a bufferedbitmap and just draw the bitmap on every onUpdate. This seems to have no impact on battery, i timed the onUpdate calls on the watch and skipping the draw vs drawing the bufferedbitmap both seem to take 1-4ms.

I put in some string resource overrides (not sure if thats the best way to do it) to only enable the buffer on va4(s) since on some other watches (eg fenix5) the buffer exhausts the memory of the device in the simulator. I have only tested this code on device for the 4s, the 4 has a higher pixel screen so potentially might run out of memory but it works ok in the simulator.

Hope this is useful

Thanks

Tom

RyanDam commented 4 years ago

Hi, thank you for your fix, I will have a check on memory footprint and get back to you soon.

RyanDam commented 4 years ago

@tomfogg And while you have a real device to test, would you mind to test it on your real device? Because this bug is not happen on my simulator.

tomfogg commented 4 years ago

@RyanDam have changed it to use a property, thanks, that's a much nicer way of doing it.

I have tested it on my VA4s device. Without the fix there are certain unpredictable situations where the screen gets blanked until the minutes change and a redraw happens. Sometimes it will do it when going to a widget and back but sometimes not and sometimes when a move alert notification appears but not always. It does seem like a bug with the VA4

Ive been running the watch face with the buffer fix on my device since yesterday and the blank screen no longer happens and have not noticed and battery drain. The only downside, as you say, is that the buffer uses up a fair bit of memory on the device

tomfogg commented 4 years ago

also noticed when testing the property you need to reset all app settings in the simulator if you change the device type, otherwise it uses the enable_buffering property from the previous run on the previous device. so if you run it as a va4 it will have buffering enabled, then if you run it as fenix5 it will still have buffering enabled (and crash out of memory) unless you reset the app settings between runs

RyanDam commented 4 years ago

At the beginning I'm a little bit worry about memory footprint because typical Garmin device only have 91KB. So using BufferedBitmap is really expensive. Then I surprised that Vivo4 have 500KB, which make using BufferedBitmap is reasonable. Again, thank you for your contribution. Will release an update soon!

tomfogg commented 4 years ago

Great, thanks! Just tried the version from the IQ store and all working good on my device