FS#13538 export and import battery level tables

when battery_bench is run
exports a file in the rockbox directory called 'battery_levels.default'

if the user wants their own levels they can rename the file battery_levels.cfg
and it will be loaded at boot

some minimal error checking is performed prior to using the values

added manual entry

Change-Id: Ia0126faced0c7229fcf8385a1bcb584b5a9dc378
This commit is contained in:
William Wilgus 2025-01-11 18:54:53 -05:00 committed by William Wilgus
parent 3539dd5a70
commit 10f8312db4
79 changed files with 611 additions and 298 deletions

View file

@ -21,25 +21,25 @@
#include "config.h"
#include "powermgmt-target.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3660
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3630
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{
/* figured from discharge curve */
{ 3630, 3720, 3770, 3800, 3816, 3845, 3888, 3950, 4010, 4070, 4150 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* TODO */
4028, 4063, 4087, 4111, 4135, 4156, 4173, 4185, 4194, 4202, 4208

View file

@ -21,25 +21,25 @@
#include "config.h"
#include "powermgmt-target.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3660
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3630
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{
/* figured from discharge curve */
{ 3630, 3700, 3745, 3775, 3800, 3830, 3880, 3940, 4000, 4070, 4140 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* TODO */
4028, 4063, 4087, 4111, 4135, 4156, 4173, 4185, 4194, 4202, 4208