Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor doNotGoToSleep to a wakelock counter #2107

Merged
merged 1 commit into from
Sep 21, 2024

Conversation

mark9064
Copy link
Contributor

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.

Copy link

github-actions bot commented Aug 23, 2024

Build size and comparison to main:

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

@mark9064
Copy link
Contributor Author

mark9064 commented Aug 23, 2024

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

@mark9064
Copy link
Contributor Author

Rebased to resolve conflicts

src/systemtask/WakeLock.cpp Show resolved Hide resolved
src/systemtask/WakeLock.h Outdated Show resolved Hide resolved
@JF002 JF002 added this to the 1.15.0 milestone Sep 21, 2024
NeroBurner added a commit to InfiniTimeOrg/InfiniSim that referenced this pull request Sep 21, 2024
For InfiniTime PR InfiniTimeOrg/InfiniTime#2107
a new systemtask file is introduced `WakeLock.h` and `WakeLock.cpp`.

If available add those files to the build target to support the current
`main` and the new `WakeLock` using redesign.
NeroBurner added a commit to InfiniTimeOrg/InfiniSim that referenced this pull request Sep 21, 2024
For InfiniTime PR InfiniTimeOrg/InfiniTime#2107
a new systemtask file is introduced `WakeLock.h` and `WakeLock.cpp`.

If available add those files to the build target to support the current
`main` and the new `WakeLock` using redesign.
Copy link
Contributor

@NeroBurner NeroBurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the InfiniSim to use WakeLock.cpp if it is available, fixing this PR build pipeline
InfiniTimeOrg/InfiniSim#150

Just the little newline and we're good to go from my side

src/systemtask/WakeLock.cpp Show resolved Hide resolved
src/systemtask/WakeLock.h Outdated Show resolved Hide resolved
NeroBurner added a commit to InfiniTimeOrg/InfiniSim that referenced this pull request Sep 21, 2024
For InfiniTime PR InfiniTimeOrg/InfiniTime#2107
a new systemtask file is introduced `WakeLock.h` and `WakeLock.cpp`.

If available add those files to the build target to support the current
`main` and the new `WakeLock` using redesign.
@NeroBurner
Copy link
Contributor

merge conflict after #2109 got merged. Please resolve them when doing the little newline

@mark9064
Copy link
Contributor Author

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
Copy link
Contributor Author

I always miss those formatting errors when rebasing...

Copy link
Contributor

@NeroBurner NeroBurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also mess up formating on rebases 😁 That's why I love the CI job checking it for me ^^

LGTM

@NeroBurner NeroBurner merged commit 7ca0418 into InfiniTimeOrg:main Sep 21, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants