Update just a single layer


#1

Hey everyone,

as above written I’m looking for a way to update just a single layer, so that every other stays untouched. My purpose is to save heap memory by drawing every graphics once and then delete them instantly, since I’m playing a png-animation which marks the animation layer as dirty at the end of the animation cycle it auomaticaly tells every other layer to redraw themselves too.


#2

The main issue you’ll get is that the default update_proc of the window’s root layer is clearing the screen.
So you’ll have to replace this update_proc before doing anything else.


#3

Hello,

I have the same problem.
There are three layers:
window_layer
|-> clock layer
| |-> second layer
|-> bottom layer

The only layer that overlaps are the second and the clock layer.

Every time the second layer updates, it updates all other too:
[DEBUG] main.c:21: Clock Layer Update
[DEBUG] main.c:72: Second Layer Update
[DEBUG] main.c:93: Bottom Layer Update
[DEBUG] main.c:21: Clock Layer Update
[DEBUG] main.c:72: Second Layer Update
[DEBUG] main.c:93: Bottom Layer Update

I already tried to disable the window layer update, but it does not help:
Layer *window_layer = window_get_root_layer(window);
layer_set_update_proc(window_layer, NULL);

It don’t draw the background anymore, but it still update all three layers every second…
How can I resolve that?


#4

Check my concept of window that update only the relevant part (see readme)


#5

So, you use a second window with an update-proc which just draws a filled rect where the text_layer is located.

I’m curious if this is worth the effort. Did you do some test regarding battery usage?


#6

Thanks a lot for the suggest @Ron64 , but in my case I don’t have nothing behind. But your Idea is not bad, I use it the other way, I copy the background into an bitmap and use it every time I erase the background, that should work… I want to update the second-layer every 200ms, so I think that will be faster than to draw everything again…


#7

@DirkMika For speed subject
The Aptile is optimized to update only relevant rows. So reducing the drawing is significant. I’m not sure how much Basalt is optimized in limiting column, but it may be significant.
Updating display 10 times per sec will reduce battery to one day. updating once per sec will last ~10 days (out of 25 days+ with no BT, light & vibes). So you can consider it as reducing a day of the regular operation.
This is only considering the screen update. What happen when you use complicated drawing or intensive mathematical calculation? It will use processor powere too. so you save more.

The simplest method to check if it make sense to bother with reducing power is the classic check of how many days watch will hold with sec and without it. Problem is you need a watch for it for 7-20 days, because if you use it with Bluetooth your tests won’t be equal.

@jakobTissen
Glad you found it useful. I suggest that you will make sure that in the way you make it, the other layers don’t get updated when you don’t need them to.(I used app_log inside update procedure)


#8