InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

DirtyValue: add possibility to mark DirtyValue updated

Open ljahn opened this issue 1 year ago • 2 comments

Adds the ability to manually mark a DirtyValue as updated.

This simplifies situations where a the user (or any other condition) selects if a value should be updated.

Example: In my Star Trek watch face I give the possibility to show weather or not. Using this function, I do not have to duplicate the weather updating code to the button press handler or introduce another variable weatherNeedsUpdate. I can just make the corresponding element visible, mark the weather data as updated (although it really isn't), and the next normal refresh loop will put the correct weather information.

ljahn avatar Dec 23 '24 20:12 ljahn

Build size and comparison to main:

Section Size Difference
text 372816B 0B
data 948B 0B
bss 22536B 0B

github-actions[bot] avatar Dec 23 '24 20:12 github-actions[bot]

I don't love this conceptually as it kind of breaks the idea that the DirtyValue is a state container that informs of updates only on state changes. However, I'm not dead set on not including this

For your use-case, could you update the weather irrespective of whether it's visible or not?

mark9064 avatar Feb 14 '25 01:02 mark9064