fix: Charge to 100%
Fix #1885: Battery never shows 100% even when fully charged If voltage is high enough (≥ 96% charge), report as 100%
1/ 4074, why dont you use the battery_states ? 2/ sry, please help with resolving the code conflict.
@skywinder
hey man, it's cleaning time.
/ closed
3 days with no updates feel free to reopen it anytime
@beastoin Please mark it as a draft if it’s not ready. It’s still an issue and shouldn’t be ignored or closed.
@beastoin Please mark it as a draft if it’s not ready. It’s still an issue and shouldn’t be ignored or closed.
man, sorry, but no. otherwise, you'll see 100+ draft PRs. Instead, do this: if you want a draft PR to stay open, make sure you're actively working on it, and don’t let it sit for more than 3 days without updates.
please think about it: why am I here just to clean up your draft requests?
1/ 4074, why don’t you use the
battery_states?
- It helps preserve the original battery specs in the lookup table — using
battery_stateswould override the intended reference curve. - It’s easier to tweak the threshold later for different models — this value might need adjustments in the future.
- This makes it explicit that we’re deviating from the standard discharge curve intentionally.
But there are pros to your solution too:
- More consistent approach where all voltage-to-percentage mappings are in one place
- Better interpolation and discharge curve
So:
- For data accuracy — my solution: keeps accurate specs but adds special logic
- For code simplicity — your solution: simpler code flow but with modified reference data
Let me know which one you prefer, and I’ll fix it in 5 minutes. 🙌 @beastoin
your choice man. show me your best :).
🔋 1S LiPo 3.7V 250mAh — Voltage vs. Capacity Table (based on datasheets)
| Voltage (mV) | Percentage |
|---|---|
| 4200 | 100% |
| 4150 | 95% |
| 4100 | 90% |
| 4050 | 85% |
| 4000 | 80% |
| 3950 | 70% |
| 3900 | 60% |
| 3850 | 50% |
| 3750 | 40% |
| 3700 | 30% |
| 3600 | 20% |
| 3500 | 10% |
| 3400 | 5% |
| 3300 | 2% |
| 3200 | 1% |
| 3000 | 0% (cutoff) |
This is more or less curent one. Lets adjust it to
| Adjusted Voltage (mV) | Original % |
|---|---|
| 4074 | 100% |
| 4029 | 95% |
| 3983 | 90% |
| 3938 | 85% |
| 3893 | 80% |
| 3847 | 70% |
| 3802 | 60% |
| 3756 | 50% |
| 3665 | 40% |
| 3619 | 30% |
| 3528 | 20% |
| 3437 | 10% |
| 3346 | 5% |
| 3255 | 2% |
| 3164 | 1% |
| 3000 | 0% |
well, https://github.com/BasedHardware/omi/blob/d46d4121c926860f933b8590cae248afde441aef/omi/firmware/firmware/app/src/lib/battery/battery.c#L78
there is wrong datasheet anyway// its for 18650-batteries which is slightly diffeent
so I will adjust ot for 1S 250mAh LiPo battery discharge profile
done. it works, more precise and tested. pls check @thinhx
lgtm @skywinder 🥳