Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
translations translations
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Hardware
| | |-+  Battery tables
« previous next »
  • Print
Pages: [1]

Author Topic: Battery tables  (Read 125 times)

Offline rockbox_dev123

  • Member
  • *
  • Posts: 173
Battery tables
« on: July 03, 2025, 06:16:52 PM »
I have always been confused by themes that make use of %bl to show the battery percentage as there is a difference in the percentage when charging and unplugging the cable. I dug into the code and now understand it is because of the differing battery tables. In the case of an ipod6g they're stored in /firmware/target/arm/s5l8702/ipod6g/powermgmt-6g.c.

Code: [Select]
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
unsigned short percent_to_volt_discharge[11] =
{
    3500, 3670, 3720, 3750, 3770, 3800, 3860, 3920, 3980, 4070, 4170
};

#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
unsigned short percent_to_volt_charge[11] =
{
    3700, 3820, 3900, 3950, 3990, 4030, 4070, 4120, 4170, 4190, 4200
};
#endif /* CONFIG_CHARGING */

If I'm not completely wrong then I think I now understand why a battery with a reading of 4.017 mV will show as 83% full when not charging and as 46% full when charging. It's because of the different tables being used in each scenario.

Can anyone explain to me why there are these different tables? Can I not just have Rockbox say the battery is at 83% full when charging as well?

Thanks
Logged

Offline bahus

  • Member
  • *
  • Posts: 221
Re: Battery tables
« Reply #1 on: July 11, 2025, 04:58:58 AM »
Battery shows different higher voltage when charging hence different tables. You can try and calibrate those values for your battery if you see big differences.

It seems https://gerrit.rockbox.org/r/c/rockbox/+/6322 adds a way to adjust those values without recompilation.
Logged

Offline rockbox_dev123

  • Member
  • *
  • Posts: 173
Re: Battery tables
« Reply #2 on: July 14, 2025, 04:36:51 AM »
Thanks for the reply.

When I have some free time I'll see if I can patch so that the theme tag shows a consistent charge value regardless of how charging is handled internally by Rockbox.
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Hardware
| | |-+  Battery tables
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.048 seconds with 16 queries.