Re-render specific parts of the display in the onUpdate method

Hello!

I have written my own watch face and I was trying to maximize battery life as much as possible. One consideration I had on mind was to only re-render the parts of the display I need to update, but I am struggling with that part.

Inspired by the onPartialUpdate() method, my idea was to re-render a small part of the display once a minute (the minutes value) and a full display update every hour (when minutes equals 0).

Something like this:

function onUpdate(dc) {
    if (needAFullRedraw) {
        ...
        View.onUpdate(dc);
    } else {
        dc.setClip(<dimensions>)
		dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_BLACK);
		dc.clearClip();

		dc.drawText(
				x,
				y,
				Gfx.FONT_SYSTEM_NUMBER_THAI_HOT,
				minutes.format("%02d"),
				Gfx.TEXT_JUSTIFY_RIGHT
			);

    }
}

When a full redraw is not needed (needAFullRedraw = false) the minutes show up just fine and are updated accordingly. However, the rest of the display turns blank and I do not see any of the existing data that was previously set by View.onUpdate(). At least on a real device, on the emulator is all good regardless of the high-power mode or low-power mode setting.

On my watch, I measured the performance by logging the elapsed time within the onUpdate() method and it is definitely faster when only the minutes are re-rendered. However, I do not understand why everything else turns blank. Am I not supposed to mix View.onUpdate() and partial updates in the onUpdate() method? Thank you in advance!

PS: I understand that the main use case of onPartialUpdate() is to show up the seconds for a short amount of time, I just want to extend the idea of re-rendering a small part of the display in the onUpdate() method.

Top Replies

All Replies