InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Refactor doNotGoToSleep to a wakelock counter

Open mark9064 opened this issue 1 year ago • 2 comments

Rather than tracking whether sleeping is disabled with a boolean, this moves it to a counter which records the number of requests to keep the device awake. When this counter is zero, sleeping is possible. This prevents one task from enabling sleeping when another task still wants sleeping disabled.

mark9064 avatar Aug 23 '24 13:08 mark9064

Build size and comparison to main:

Section Size Difference
text 374232B 128B
data 948B 0B
bss 63480B 0B

github-actions[bot] avatar Aug 23 '24 13:08 github-actions[bot]

Couple rebase mistakes breaking build I'll patch them this evening Edit: done

mark9064 avatar Aug 23 '24 13:08 mark9064

Rebased to resolve conflicts

mark9064 avatar Sep 14 '24 10:09 mark9064

merge conflict after https://github.com/InfiniTimeOrg/InfiniTime/pull/2109 got merged. Please resolve them when doing the little newline

NeroBurner avatar Sep 21 '24 19:09 NeroBurner

I also moved the destructor as IMO code should be minimally surprising, and now I think about it you don't really expect to find code in the header (except maybe const getters)

mark9064 avatar Sep 21 '24 20:09 mark9064

I always miss those formatting errors when rebasing...

mark9064 avatar Sep 21 '24 20:09 mark9064