omi icon indicating copy to clipboard operation
omi copied to clipboard

fix: Charge to 100%

Open skywinder opened this issue 10 months ago • 9 comments

Fix #1885: Battery never shows 100% even when fully charged If voltage is high enough (≥ 96% charge), report as 100%

6C617072-41CB-4857-9429-1DC619117E29_4_5005_c

skywinder avatar Apr 05 '25 09:04 skywinder

1/ 4074, why dont you use the battery_states ? 2/ sry, please help with resolving the code conflict.

@skywinder

beastoin avatar Apr 07 '25 08:04 beastoin

hey man, it's cleaning time.

/ closed

3 days with no updates feel free to reopen it anytime

beastoin avatar Apr 14 '25 10:04 beastoin

@beastoin Please mark it as a draft if it’s not ready. It’s still an issue and shouldn’t be ignored or closed.

skywinder avatar Apr 14 '25 13:04 skywinder

@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?

beastoin avatar Apr 14 '25 14:04 beastoin

1/ 4074, why don’t you use the battery_states?

  1. It helps preserve the original battery specs in the lookup table — using battery_states would override the intended reference curve.
  2. It’s easier to tweak the threshold later for different models — this value might need adjustments in the future.
  3. This makes it explicit that we’re deviating from the standard discharge curve intentionally.

But there are pros to your solution too:

  1. More consistent approach where all voltage-to-percentage mappings are in one place
  2. Better interpolation and discharge curve

So:

  • For data accuracymy solution: keeps accurate specs but adds special logic
  • For code simplicityyour 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

skywinder avatar Apr 14 '25 14:04 skywinder

your choice man. show me your best :).

beastoin avatar Apr 14 '25 14:04 beastoin

🔋 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%

skywinder avatar Apr 14 '25 15:04 skywinder

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

skywinder avatar Apr 14 '25 15:04 skywinder

done. it works, more precise and tested. pls check @thinhx

skywinder avatar Apr 14 '25 15:04 skywinder

lgtm @skywinder 🥳

beastoin avatar Apr 20 '25 04:04 beastoin