Skip to content

improve battery percentage accuracy#3452

Merged
beastoin merged 6 commits intoBasedHardware:mainfrom
TuEmb:TuEmb/improve_battery_percentage
Nov 20, 2025
Merged

improve battery percentage accuracy#3452
beastoin merged 6 commits intoBasedHardware:mainfrom
TuEmb:TuEmb/improve_battery_percentage

Conversation

@TuEmb
Copy link
Copy Markdown
Contributor

@TuEmb TuEmb commented Nov 18, 2025

as #2782 , the current battery percentage fluctuates too sharply, causing noticeable jumps up and down that may confuse users.

This pull request includes:

  • Enhanced battery percentage calculation: refined the lookup table and interpolation logic to provide smoother and more accurate battery percentage readings.
  • Added EMA filter to make the number moving smoothly to improve user experience.
  • Added a battery critical level (3500mV) threshold to prevent deep discharge and protect battery health.

Comment thread omi/firmware/omi/src/lib/core/transport.c Outdated
@TuEmb
Copy link
Copy Markdown
Contributor Author

TuEmb commented Nov 19, 2025

Discharge Profile

image

@TuEmb
Copy link
Copy Markdown
Contributor Author

TuEmb commented Nov 19, 2025

The system will power off when the battery level under threshold, prevents deep discharge, reduces stress on the cell, and helps maintain long-term battery health and lifespan.

image

@TuEmb
Copy link
Copy Markdown
Contributor Author

TuEmb commented Nov 19, 2025

Charging profile
image

@TuEmb TuEmb marked this pull request as ready for review November 19, 2025 04:57
@TuEmb TuEmb requested a review from beastoin November 19, 2025 05:02
@beastoin beastoin merged commit 783ac90 into BasedHardware:main Nov 20, 2025
@beastoin
Copy link
Copy Markdown
Collaborator

lgtm @TuEmb

do you think 10s is too frequent? https://github.com/BasedHardware/omi/pull/3452/files#diff-fc6983d86c90195a910760bb5c0ba59712e9aa2151b4c57c2aa430a13f58d463R393 previously, 60s, my concern is that it would consume more battery for reading the voltage and increase the instability. tell me more about your thoughts on the new implementation.

@TuEmb
Copy link
Copy Markdown
Contributor Author

TuEmb commented Nov 20, 2025

@beastoin that's right, but I think the power consumption will not be too much. I will have an analyzation table on the power consumption task later to show how much we are using for each components

ellaaicare pushed a commit to ellaaicare/omi that referenced this pull request Dec 6, 2025
Cherry-picked commits:
- 8c6d99f: Fix SD card data corruption (BasedHardware#3463)
- ffc5138: SD card power/performance refactor (BasedHardware#3490)
- a812bc3: SD card error handling (BasedHardware#3499)
- 983c8b9: Watchdog timer 30s timeout (BasedHardware#3425)
- 783ac90: Battery percentage accuracy (BasedHardware#3452)

Key changes:
- SD card mutex protection for multi-thread access
- Reduced SD card power consumption and faster read/write
- Added watchdog timer to catch firmware hangs
- Improved battery percentage reporting accuracy

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
* improve battery percentage

* improve EMA filter for edge cases

* update turnoff_all to be common for single button and critical battery level

* remove unsed variable
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