Skip to content

Conversation

@TuEmb
Copy link
Contributor

@TuEmb TuEmb commented Dec 29, 2025

Related issues #3430 #3151

The pusher thread was consuming a significant amount of CPU because it was running in a tight super loop, preventing the CPU from entering sleep states. This behavior was a cause of high power consumption.

This PR reduces power consumption by approximately 3 mA in both offline and live modes.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the pusher thread to prevent high CPU usage from busy-waiting, replacing k_yield() with k_sleep(). While k_yield() is an acceptable mechanism for preventing busy-waiting (as per repository rules), the new k_sleep() logic introduces a critical data loss bug under certain conditions. My review includes a detailed explanation of the issue and a suggested fix to ensure data integrity while maintaining the power-saving improvement.

@TuEmb
Copy link
Contributor Author

TuEmb commented Dec 29, 2025

The CPU can sleep in idle time now
image

@TuEmb
Copy link
Contributor Author

TuEmb commented Dec 29, 2025

Offline mode:
Reduce from 11.86 mA --> 8.86 mA
image

@TuEmb
Copy link
Contributor Author

TuEmb commented Dec 29, 2025

Live mode:
Reduce from 11.4mA --> 7.46mA (4mA save)
image

@TuEmb
Copy link
Contributor Author

TuEmb commented Dec 29, 2025

Audio sync over BLE:
image

@TuEmb TuEmb requested a review from beastoin December 29, 2025 08:26
@beastoin beastoin merged commit f338661 into BasedHardware:main Dec 30, 2025
@beastoin
Copy link
Collaborator

lgmt @TuEmb

@beastoin
Copy link
Collaborator

this technique can help devkit/devkit2 too. please create a new ticket

@TuEmb TuEmb deleted the TuEmb/improv_power branch December 30, 2025 01:23
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.

2 participants