Complete
over 2 years ago

BUG: some newer devices clear the screen on every view update. Simulator behaves differently

Some users have reported issues with my app Maze (https://apps.garmin.com/en-US/apps/3a4436a8-1126-4539-a2f2-aefb319a0ef0) and Snake (https://apps.garmin.com/en-US/apps/e443b0cc-8046-4d76-830f-e87517cf14b6), where the screen will go black after starting to play the game.

For efficiency, the screen is drawn using Dc calls, the view's onUpdate does not call the parent, and only the changed parts of the screen are redrawn: during gameplay on Maze, the previous location of the ball is blanked out, and the new location is drawn.  The event loop is run by a timer that calls Ui.requestUpdate() every 100ms.  This method has worked since I originally developed the games for my Forerunner 235.  

However, with newer devices - specifically, the Venu and the Forerunner 55 - this does not work.  For some reason, the display gets blacked out on every call to View.onUpdate. This only happens on the physical watches, not in the simulator, so I have no way to test this behaviour!I can create the undesired behaviour in the simulator by adding a call to View.onUpdate(dc) at the top of the onUpdate method in my view class.

So, here are my requests:

* please correct the behaviour on these watches

* if this behaviour was a desired change, please update your documentation to make it clear that we can no longer perform incremental updates to the screen

* please fix the simulator so that it behaves the same as these watches

* in the meantime, please tell me if there is a workaround for this issue.  I believe my code is correct since it has behaved correctly for years, and there is no detail in the documentation that says that what I'm doing is no longer possible

More details available on request - for some reason I can't add an image here.

  • Thanks.  I think the response could be more helpful.  Making "expected behaviour" known and understood outside of Garmin is part of good documentation.  The API docs for View.onUpdate() should contain full details of the behaviour and the expectations.  Ideally, there should also be a how-to for drawing complex graphics on screen.

    Does anyone know how to create such graphics and draw them in such a way that the full screen doesn't have to be fully redrawn every time?  

  • Clearing the screen is the easy part!

    The part that I need some guidance on is how to work around the lack of ability to do an incremental update, because the graphics take literally seconds to draw. It seems like there isn’t a good universal way to do this, and that there will need to be two blocks of code: one for devices with the old behaviour; one for the newer devices that would need some kind of bitmap or buffer or something. Again, the docs aren’t that helpful here.

  • There are other reports of this where Travis.ConnectIQ has explained that trying to update only parts of a screen in onUpdate() is inconsistent, when you mix in things like alerts shown on the watch too as well as different app types.

    To be consistent, when onUpdate is called, you always want to clear the screen with something like:

    		dc.setColor(Gfx.COLOR_BLACK,Gfx.COLOR_BLACK);
    		dc.clear();
    		dc.setColor(Gfx.COLOR_WHITE,Gfx.COLOR_TRANSPARENT);

    The only time you can consistenltly update only part of the screen is with onPartialUpdate() in watch faces.  

  • Thanks for the reply.

    I'm not sure how it can be "not a bug".  The simulator should simulate the watches correctly and it doesn't.  The behaviour of the watches themselves is undocumented and inconsistent: either all watches should preserve screen content, or they should all wipe all screen content on update, or there should be clear documentation on which watches do what.  Those are both bugs, even if they have been categorised as "won't fix".

    It might be well known to some; for those who don't know, it's hard to discover.  The current behaviour and documentation does not provide a good developer experience, so it should be addressed - either in the code or the documentation.  You might be experienced with the Connect IQ SDK; I wrote a couple of apps a few years back and just try to keep them up-to-date.  The SDK should serve both classes of developers.

    Do you have a suggestion for how to redraw an entire maze structure on the screen on every update?  The number of lines means that the current draw logic takes some seconds to complete.  I'm assuming there should be some documentation on how to do this neatly, but I can't find it.