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

@ -913,10 +913,11 @@ static bool tsc2100_debug(void)
static bool view_battery(void)
{
extern struct battery_tables_t device_battery_tables; /* powermgmt.c */
unsigned short *power_history = device_battery_tables.history;
int view = 0;
int i, x, y, z, y1, y2, grid, graph;
unsigned short maxv, minv;
lcd_setfont(FONT_SYSFIXED);
while(1)

View file

@ -437,6 +437,7 @@ static void init(void)
settings_reset();
settings_load();
settings_apply(true);
init_battery_tables();
#ifdef HAVE_DIRCACHE
init_dircache(true);
init_dircache(false);
@ -701,7 +702,9 @@ static void init(void)
settings_reset();
}
#endif
CHART(">init_battery_tables");
init_battery_tables();
CHART("<init_battery_tables");
#ifdef HAVE_DIRCACHE
CHART(">init_dircache(true)");
rc = init_dircache(true);

View file

@ -86,6 +86,8 @@ static void* plugin_get_audio_buffer(size_t *buffer_size);
static void plugin_release_audio_buffer(void);
static void plugin_tsr(int (*exit_callback)(bool));
extern struct battery_tables_t device_battery_tables; /* powermgmt.c */
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
/* File handle leak prophylaxis */
#include "bitarray.h"
@ -842,6 +844,7 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time
the API gets incompatible */
add_playbacklog,
&device_battery_tables,
};
static int plugin_buffer_handle;

View file

@ -991,6 +991,7 @@ struct plugin_api {
/* new stuff at the end, sort into place next time
the API gets incompatible */
void (*add_playbacklog)(struct mp3entry *id3);
struct battery_tables_t *device_battery_tables;
};
/* plugin header */

View file

@ -24,6 +24,22 @@
#include "plugin.h"
#include "lang_enum.h"
/* matches struct in powermgmt.h */
struct battery_tables_t {
unsigned short * const history;
unsigned short * const disksafe;
unsigned short * const shutoff;
unsigned short * const discharge;
#if CONFIG_CHARGING
unsigned short * const charge;
const size_t elems;
bool isdefault;
#endif
};
#define BATTERY_LEVELS_DEFAULT ROCKBOX_DIR"/battery_levels.default"
#define BATTERY_LEVELS_USER ROCKBOX_DIR"/battery_levels.cfg"
#define BATTERY_LOG HOME_DIR "/battery_bench.txt"
#define BUF_SIZE 16000
@ -265,7 +281,7 @@
#endif
/****************************** Plugin Entry Point ****************************/
static long start_tick;
long start_tick;
/* Struct for battery information */
static struct batt_info
@ -507,6 +523,66 @@ static void put_centered_str(const char* str, plcdfunc putsxy, int lcd_width, in
putsxy((lcd_width - strwdt)/2, line*(strhgt), str);
}
void do_export_battery_tables(void)
{
size_t elems = rb->device_battery_tables->elems;
if (!rb->device_battery_tables->isdefault)
return; /* no need to print out non-defaults */
unsigned int i;
int fd;
/* write out the default battery levels file */
if (!rb->file_exists(BATTERY_LEVELS_DEFAULT))
{
fd = rb->open(BATTERY_LEVELS_DEFAULT, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd >= 0)
{
rb->fdprintf(fd, "# Rename to %s\n# " MODEL_NAME " Battery Levels (%s)\n\n",
BATTERY_LEVELS_USER, rb->rbversion);
rb->fdprintf(fd, "# Battery voltage(millivolt) lower than this %s\n",
"player will shutdown");
rb->fdprintf(fd, "shutoff: %d\n\n", *rb->device_battery_tables->shutoff);
rb->fdprintf(fd, "# Battery voltage(millivolt) lower than this %s\n",
"won't access the disk to write");
rb->fdprintf(fd, "disksafe: %d\n\n", *rb->device_battery_tables->disksafe);
rb->fdprintf(fd, "# Battery voltage(millivolt) of {");
for(i= 0;i < elems;i++)
{
rb->fdprintf(fd, "%u%%, ", i * 10);
}
rb->lseek(fd, -2, SEEK_CUR); /*remove last comma */
rb->fdprintf(fd, "} when charging %sabled\n", "dis");
rb->fdprintf(fd, "discharge: {");
for(i= 0;i < elems;i++)
{
rb->fdprintf(fd, "%u, ", rb->device_battery_tables->discharge[i]);
}
rb->lseek(fd, -2, SEEK_CUR); /*remove last comma */
rb->fdprintf(fd, "}\n\n");
#if CONFIG_CHARGING
rb->fdprintf(fd, "# Battery voltage(millivolt) of {");
for(i= 0;i < elems;i++)
{
rb->fdprintf(fd, "%u%%, ", i * 10);
}
rb->lseek(fd, -2, SEEK_CUR); /*remove last comma */
rb->fdprintf(fd, "} when charging %sabled\n", "en");
rb->fdprintf(fd, "charge: {");
for(i= 0;i < elems;i++)
{
rb->fdprintf(fd, "%u, ", rb->device_battery_tables->charge[i]);
}
rb->lseek(fd, -2, SEEK_CUR); /*remove last comma */
rb->fdprintf(fd, "}\n\n");
#endif
rb->close(fd);
}
}
}
enum plugin_status plugin_start(const void* parameter)
{
int button, fd;
@ -543,6 +619,7 @@ enum plugin_status plugin_start(const void* parameter)
#endif
if (!resume)
{
do_export_battery_tables();
do
{
button = rb->button_get(true);

View file

@ -201,11 +201,11 @@ static void battery_trap(void)
* differ as much as more than 200 mV when charge current is at
* maximum (~340 mA).
* - RB uses some sort of average/compensation for battery voltage
* measurements, battery icon blinks at battery_level_dangerous,
* measurements, battery icon blinks at battery_level_disksafe,
* when the HDD is used heavily (large database) the level drops
* to battery_level_shutoff quickly.
*/
if (vbat >= battery_level_dangerous[0] + th)
if (vbat >= battery_level_disksafe[0] + th)
break;
th = 200;

View file

@ -83,6 +83,9 @@ enum shutdown_type
/* Start up power management thread */
void powermgmt_init(void) INIT_ATTR;
/* load user battery levels */
#define BATTERY_LEVELS_USER ROCKBOX_DIR"/battery_levels.cfg"
void init_battery_tables(void) INIT_ATTR;
#if CONFIG_CHARGING && !defined(CURRENT_MAX_CHG)
#define CURRENT_MAX_CHG 350 /* maximum charging current */
@ -103,13 +106,17 @@ void powermgmt_init(void) INIT_ATTR;
#define POWER_THREAD_STEP_TICKS (HZ/2)
#endif
extern unsigned short power_history[POWER_HISTORY_LEN];
extern const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT];
extern const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT];
extern const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11];
struct battery_tables_t {
unsigned short * const history;
unsigned short * const disksafe;
unsigned short * const shutoff;
unsigned short * const discharge;
#if CONFIG_CHARGING
extern const unsigned short percent_to_volt_charge[11];
unsigned short * const charge;
const size_t elems;
bool isdefault;
#endif
};
/* Returns battery status, filtered for runtime estimation */
int battery_level(void); /* percent */

View file

@ -19,6 +19,8 @@
* KIND, either express or implied.
*
****************************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "config.h"
#include "system.h"
#include "kernel.h"
@ -34,6 +36,9 @@
#include "backlight.h"
#include "lcd.h"
#include "rtc.h"
#include "misc.h"
#include "splash.h"
#include "version.h"
#if CONFIG_TUNER
#include "fmradio.h"
#endif
@ -52,6 +57,27 @@
#include "pcf50606.h"
#endif
extern unsigned short power_history[POWER_HISTORY_LEN];
extern unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT];
extern unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT];
extern unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11];
#if CONFIG_CHARGING
extern unsigned short percent_to_volt_charge[11];
#endif
struct battery_tables_t device_battery_tables =
{
.history = power_history,
.disksafe = &battery_level_disksafe[0],
.shutoff = &battery_level_shutoff[0],
.discharge = percent_to_volt_discharge[0],
#if CONFIG_CHARGING
.charge = percent_to_volt_charge,
#endif
.elems = ARRAYLEN(percent_to_volt_discharge[0]),
.isdefault = true,
};
static int last_sent_battery_level = 100;
static void set_sleep_timer(int seconds);
@ -487,15 +513,15 @@ bool battery_level_safe(void)
#if defined(NO_LOW_BATTERY_SHUTDOWN)
return true;
#elif ((CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE) && (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE))
return voltage_now > battery_level_dangerous[battery_type];
return voltage_now > battery_level_disksafe[battery_type];
#elif CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE
return percent_now > 0;
#elif defined(HAVE_BATTERY_SWITCH)
/* Cannot rely upon the battery reading to be valid and the
* device could be powered externally. */
return input_millivolts() > battery_level_dangerous[battery_type];
return input_millivolts() > battery_level_disksafe[battery_type];
#else
return voltage_now > battery_level_dangerous[battery_type];
return voltage_now > battery_level_disksafe[battery_type];
#endif
}
@ -823,6 +849,184 @@ static void power_thread(void)
}
} /* power_thread */
static bool battery_table_readln(int fd, char * buf, size_t bufsz,
const char *name, char **value, int* linect) INIT_ATTR;
static bool battery_table_readln(int fd, char * buf, size_t bufsz,
const char *name, char **value, int* linect)
{
/* reads a line from user battery level file skips comments
* if name is NULL and the line is a continuation (no setting:)
* or name matches the found setting then remaining line contents are returned in value
* name if supplied should contain the name of the setting you are searching for */
int rd;
char *setting;
if (name)
{
/* DEBUGF("%s Searching for '%s'\n", __func__, name); */
lseek(fd, 0, SEEK_SET);
*linect = 0;
}
while(1)
{
rd = read_line(fd, buf, bufsz);
if (rd > 0)
{
/*DEBUGF("\nREAD '%s'\n", buf);*/
*linect = *linect + 1;
if (buf[0] == '#' || buf[0] == '\0')
continue; /* skip empty lines and comments to EOL */
bool found = settings_parseline(buf, &setting, value);
if (!name) /* if name is not supplied just return value */
{
*value = buf;
if(found) /* expected more values but got a new setting instead */
return false; /* error */
}
else if (strcasecmp(name, setting) != 0)
continue; /* not the correct setting */
}
break;
}
return rd > 0;
}
void init_battery_tables(void)
{
/* parse and load user battery levels file */
#define PWRELEMS (ARRAYLEN(percent_to_volt_discharge[0]))
#if !defined(BOOTLOADER)
unsigned short tmparr[PWRELEMS];
char buf[MAX_PATH];
unsigned int i, bl_op;
enum { eSHUTOFF = 0, eDISKSAFE, eDISCHARGE, eCHARGE };
static const char * const bl_options[4] = {
[eSHUTOFF] = "shutoff",
[eDISKSAFE] = "disksafe",
[eDISCHARGE] = "discharge",
[eCHARGE] = "charge"
};
int fd = open(BATTERY_LEVELS_USER, O_RDONLY);
int line_num = 0;
unsigned short val;
unsigned short disksafe = *device_battery_tables.disksafe;
unsigned short shutoff = *device_battery_tables.shutoff;
char *value;
if (fd < 0)
return;
DEBUGF("%s %s\n", __func__, BATTERY_LEVELS_USER);
/* force order of reads to do error checking of values */
for(bl_op = 0; bl_op < ARRAYLEN(bl_options); bl_op++)
{
if(!battery_table_readln(fd, buf, sizeof(buf),
bl_options[bl_op], &value, &line_num))
{
continue;
}
switch(bl_op)
{
default:
goto error_loading;
case eSHUTOFF:
/*fall-through*/
case eDISKSAFE:
/* parse single short */
DEBUGF("%s ", bl_options[bl_op]);
while (*value != '\0' && !isdigit(*value))
value++;
if (*value)
{
val = atoi(value);
DEBUGF("value = %u\n", val);
if (bl_op == eDISKSAFE)
{
if (val < shutoff)
{
goto error_loading;
}
disksafe = val;
break;
}
/* shutoff */
shutoff = val;
break;
}
goto error_loading;
case eDISCHARGE:
/*fall-through*/
case eCHARGE:
/* parse array of short */
DEBUGF("%s = { ", bl_options[bl_op]);
val = shutoff; /* don't allow a value lower than shutoff */
i = 0;
while(i < PWRELEMS)
{
while (*value != '\0' && !isdigit(*value))
{value++;}
if (*value)
{
tmparr[i] = atoi(value);
while (isdigit(*value)) /* skip digits just read */
{value++;}
if (tmparr[i] < val)
{
goto error_loading; /* value is not >= previous */
}
val = tmparr[i];
DEBUGF("%u, ", val);
i++;
}
else if (!battery_table_readln(fd, buf, sizeof(buf),
NULL, &value, &line_num))
{
goto error_loading; /* failed to get another line */
}
} /* while */
DEBUGF("}\n");
/* if we made it here, the values should be OK to use */
if (bl_op == eCHARGE)
{
#if CONFIG_CHARGING
memcpy(device_battery_tables.charge, &tmparr, PWRELEMS);
#endif
break;
}
memcpy(device_battery_tables.discharge, &tmparr, PWRELEMS);
break;
} /* switch */
} /* for */
close(fd);
*device_battery_tables.disksafe = disksafe;
*device_battery_tables.shutoff = shutoff;
device_battery_tables.isdefault = false;
battery_status_update();
return;
error_loading:
if (fd >= 0)
close(fd);
splashf(HZ * 2, "Error line:(%d) loading %s", line_num, BATTERY_LEVELS_USER);
DEBUGF("Error line:(%d) loading %s\n", line_num, BATTERY_LEVELS_USER);
#endif /* ndef BOOTLOADER*/
#undef PWRELEMS
}
void powermgmt_init(void)
{
create_thread(power_thread, power_stack, sizeof(power_stack), 0,

View file

@ -23,7 +23,7 @@
#include "config.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/*
* about 10%, calibrated with C240v2 battery profile at
@ -32,13 +32,13 @@ const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
3600
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/*
* Below table is calibrated according to
@ -49,7 +49,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
};
/* 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: simple uncalibrated curve with 10% knee at 3.60V */
3400, 3600, 3670, 3740, 3810, 3880, 3950, 4020, 4090, 4160, 4230

View file

@ -22,27 +22,27 @@
#include "config.h"
/* The battery manufacturer's website shows discharge curves down to 3.0V,
so 'dangerous' and 'shutoff' levels of 3.4V and 3.3V should be safe.
so 'disksafe' and 'shutoff' levels of 3.4V and 3.3V should be safe.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
{ 3300, 3653, 3701, 3735, 3768, 3790, 3833, 3900, 3966, 4056, 4140 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3427, 3786, 3842, 3877, 3896, 3924, 3971, 4028, 4084, 4161, 4190
};

View file

@ -22,27 +22,27 @@
#include "config.h"
/* The battery manufacturer's website shows discharge curves down to 3.0V,
so 'dangerous' and 'shutoff' levels of 3.4V and 3.3V should be safe.
so 'disksafe' and 'shutoff' levels of 3.4V and 3.3V should be safe.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
{ 3300, 3653, 3701, 3735, 3768, 3790, 3833, 3900, 3966, 4056, 4140 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3333, 3757, 3815, 3845, 3867, 3900, 3950, 4008, 4078, 4166, 4167
};

View file

@ -22,27 +22,27 @@
#include "config.h"
/* The battery manufacturer's website shows discharge curves down to 3.0V,
so 'dangerous' and 'shutoff' levels of 3.4V and 3.3V should be safe.
so 'disksafe' and 'shutoff' levels of 3.4V and 3.3V should be safe.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
{ 3300, 3692, 3740, 3772, 3798, 3828, 3876, 3943, 4013, 4094, 4194 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3417, 3802, 3856, 3888, 3905, 3931, 3973, 4025, 4084, 4161, 4219
};

View file

@ -22,27 +22,27 @@
#include "config.h"
/* The battery manufacturer's website shows discharge curves down to 3.0V,
so 'dangerous' and 'shutoff' levels of 3.4V and 3.3V should be safe.
so 'disksafe' and 'shutoff' levels of 3.4V and 3.3V should be safe.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
{ 3300, 3653, 3701, 3735, 3768, 3790, 3833, 3900, 3966, 4056, 4140 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3427, 3786, 3842, 3877, 3896, 3924, 3971, 4028, 4084, 4161, 4190
};

View file

@ -23,25 +23,25 @@
#include "config.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/* Sansa Li Ion 750mAH, FIXME copied from e200v1 */
{ 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Sansa Li Ion 750mAH FIXME */
3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160

View file

@ -22,20 +22,20 @@
#include "config.h"
/* The battery manufacturer's website shows discharge curves down to 3.0V,
so 'dangerous' and 'shutoff' levels of 3.4V and 3.3V should be safe.
so 'disksafe' and 'shutoff' levels of 3.4V and 3.3V should be safe.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
{ 3300, 3676, 3715, 3749, 3783, 3812, 3850, 3918, 3982, 4065, 4148 }
@ -43,7 +43,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3364, 3816, 3879, 3903, 3934, 3983, 4051, 4119, 4188, 4188, 4188
};

View file

@ -22,27 +22,27 @@
#include "config.h"
/* The battery manufacturer's website shows discharge curves down to 3.0V,
so 'dangerous' and 'shutoff' levels of 3.4V and 3.3V should be safe.
so 'disksafe' and 'shutoff' levels of 3.4V and 3.3V should be safe.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
{ 3300, 3655, 3700, 3735, 3764, 3795, 3837, 3909, 3984, 4063, 4151 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3408, 3832, 3892, 3925, 3950, 3986, 4036, 4100, 4177, 4213, 4213

View file

@ -28,20 +28,20 @@
early uncalibrated values. But read-out value should be correct
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
900
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
1000
};
/* 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] =
{
/* TODO: simple uncalibrated curve, linear except for first 10% */
{ 1000, 1050, 1100, 1150, 1200, 1250, 1300, 1350, 1400, 1450, 1500 }

View file

@ -22,25 +22,25 @@
#include "powermgmt-target.h"
#include "power-imx233.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
0
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
0
};
/* 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] =
{
/* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */
{ 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Sansa Fuze+ Li Ion 600mAH figured from charge curve */
3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335

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] =
{
3659
};
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] =
{
/* Toshiba Gigabeat S Li Ion 700mAH figured from discharge curve */
{ 3659, 3719, 3745, 3761, 3785, 3813, 3856, 3926, 3984, 4040, 4121 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Toshiba Gigabeat S Li Ion 700mAH figured from charge curve */
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] =
{
3659
};
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 */
{ 3631, 3697, 3762, 3784, 3805, 3838, 3902, 3961, 4016, 4091, 4178 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* figured from charge curve */
3833, 3866, 3910, 3923, 3943, 3969, 4009, 4047, 4095, 4154, 4192

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] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */
{ 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Sansa Fuze+ Li Ion 600mAH figured from charge curve */
3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335

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

View file

@ -30,25 +30,25 @@
#include "power.h"
#include "power-gigabeat-s.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3659
};
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] =
{
/* Toshiba Gigabeat S Li Ion 700mAH figured from discharge curve */
{ 3659, 3719, 3745, 3761, 3785, 3813, 3856, 3926, 3984, 4040, 4121 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Toshiba Gigabeat S Li Ion 700mAH figured from charge curve */
4028, 4063, 4087, 4111, 4135, 4156, 4173, 4185, 4194, 4202, 4208

View file

@ -28,25 +28,25 @@
/* FIXME: Properly calibrate values. Current values "inherited" from
* iriver H100 */
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3380
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3020
};
/* 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] =
{
{ 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230
};

View file

@ -27,7 +27,7 @@
#include "pcf50605.h"
#include "audiohw.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
#if defined(IPOD_NANO)
3330
@ -43,7 +43,7 @@ const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
#endif
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
#if defined(IPOD_NANO)
3230
@ -60,7 +60,7 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
};
/* 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] =
{
#if defined(IPOD_NANO)
/* measured values */
@ -83,7 +83,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
#if defined(IPOD_NANO)
/* measured values */

View file

@ -24,7 +24,7 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
#if defined(IRIVER_H10)
3733
@ -33,7 +33,7 @@ const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
#endif
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
#if defined(IRIVER_H10)
3627
@ -43,7 +43,7 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
};
/* 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] =
{
#if defined(IRIVER_H10)
{ 3733, 3772, 3821, 3840, 3869, 3917, 3985, 4034, 4072, 4140, 4198 }
@ -53,7 +53,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
#if defined(IRIVER_H10)
3956, 3995, 4024, 4043, 4063, 4082, 4111, 4140, 4179, 4218, 4266

View file

@ -24,25 +24,25 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3450
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 },
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990
};

View file

@ -25,24 +25,24 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3515
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3486
};
/* 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] =
{
{ 3474, 3515, 3556, 3597, 3638, 3679, 3720, 3761, 3802, 3843, 3884 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3474, 3515, 3556, 3597, 3638, 3679, 3720, 3761, 3802, 3843, 3884
};

View file

@ -24,25 +24,25 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3500
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3550, 3630, 3690 ,3730, 3770, 3810, 3850, 3890, 3930, 3980 },
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3400, 3650, 3822, 3910 ,3950, 3990, 4030, 4070, 4110, 4150, 4200
};

View file

@ -24,25 +24,25 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3500
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3550, 3630, 3690 ,3730, 3770, 3810, 3850, 3890, 3930, 3980 },
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3400, 3650, 3822, 3910 ,3950, 3990, 4030, 4070, 4110, 4150, 4200
};

View file

@ -24,25 +24,25 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/* Sansa Li Ion 750mAH, took from battery benchs */
{ 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Sansa Li Ion 750mAH FIXME */
3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160

View file

@ -32,26 +32,26 @@
Charge curve have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
3350
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/* Calibrated curve */
{ 3300, 3468, 3521, 3562, 3609, 3644, 3691, 3767, 3837, 3919, 4100 }
};
/* 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: simple copy of discharge curve */
{ 3300, 3468, 3521, 3562, 3609, 3644, 3691, 3767, 3837, 3919, 4100 };

View file

@ -31,26 +31,26 @@
Discharge and charge curves have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* OF power off device when this value reached */
430
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
425
};
/* adc values 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] =
{
/* TODO: simple uncalibrated curve */
{ 425, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520 }
};
/* adc values of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
/* TODO: simple uncalibrated curve */
{ 425, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520 };

View file

@ -32,26 +32,26 @@
Charge curve have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
3350,
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300,
};
/* 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] =
{
/* FIXME: Uncalibrated curve */
{ 3300, 3350, 3433, 3516, 3600, 3683, 3767, 3850, 3933, 4017, 4100 }
};
/* 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: simple copy of discharge curve */
{ 3300, 3350, 3433, 3516, 3600, 3683, 3767, 3850, 3933, 4017, 4100 };

View file

@ -32,26 +32,26 @@
Charge curve have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
7050,
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
7000,
};
/* 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] =
{
/* FIXME: Uncalibrated curve */
{ 7000, 7050, 7100, 7150, 7200, 7250, 7300, 7350, 7400, 7450, 7500 }
};
/* 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: simple copy of discharge curve */
{ 7000, 7050, 7100, 7150, 7200, 7250, 7300, 7350, 7400, 7450, 7500 };

View file

@ -32,26 +32,26 @@
Charge curve have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* 5% */
3500,
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* 0% */
3300,
};
/* 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] =
{
{ 3300, 3570, 3660, 3696, 3712, 3742, 3798, 3865, 3935, 4020, 4130 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{ 3300, 3570, 3660, 3696, 3712, 3742, 3798, 3865, 3935, 4020, 4130 };
/* full-scale ADC readout (2^10) in millivolt */

View file

@ -32,26 +32,26 @@
Charge curve have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* 5% */
3500,
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* 0% */
3300,
};
/* 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] =
{
{ 3300, 3570, 3660, 3696, 3712, 3742, 3798, 3865, 3935, 4020, 4130 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{ 3300, 3570, 3660, 3696, 3712, 3742, 3798, 3865, 3935, 4020, 4130 };
/* full-scale ADC readout (2^10) in millivolt */

View file

@ -32,26 +32,26 @@
Charge curve have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* 5% */
3628,
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* 0% */
3300,
};
/* 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] =
{
{ 3300, 3649, 3701, 3726, 3745, 3778, 3831, 3904, 3965, 4056, 4160 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{ 3300, 3649, 3701, 3726, 3745, 3778, 3831, 3904, 3965, 4056, 4160 };
/* full-scale ADC readout (2^10) in millivolt */

View file

@ -28,26 +28,26 @@
* Battery voltage calculation and discharge/charge curves for the HiFi E.T MA9.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
6700
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
6600
};
/* 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] =
{
/* Uncalibrated curve */
{ 6600, 6936, 7042, 7124, 7218, 7288, 7382, 7534, 7674, 7838, 8200 }
};
/* 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: simple copy of discharge curve */
{ 6600, 6936, 7042, 7124, 7218, 7288, 7382, 7534, 7674, 7838, 8200 };

View file

@ -32,27 +32,27 @@
Discharge and charge curves have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
3300
};
/* 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] =
{
/* TODO: simple uncalibrated curve, linear except for first 10% */
{ 3300, 3600, 3665, 3730, 3795, 3860, 3925, 3990, 4055, 4120, 4185 }
};
/* 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: simple uncalibrated curve, linear except for first 10% */
{ 3300, 3600, 3665, 3730, 3795, 3860, 3925, 3990, 4055, 4120, 4185 };

View file

@ -25,25 +25,25 @@
#include "power.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3450
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
/* Toshiba Gigabeat Li Ion 830mAH figured from discharge curve */
{ 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Toshiba Gigabeat Li Ion 830mAH */
3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990

View file

@ -25,25 +25,25 @@
#include "powermgmt.h"
/* The following constants are dummy values since there is no battery */
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3450
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
/* Typical Li Ion 830mAH */
{ 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Typical Li Ion 830mAH */
3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990

View file

@ -25,25 +25,25 @@
#include "power.h"
#include "audiohw.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3600
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3350
};
/* 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] =
{
{ 3550, 3783, 3830, 3882, 3911, 3949, 3996, 4067, 4148, 4228, 4310 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3550, 3783, 3830, 3882, 3911, 3949, 3996, 4067, 4148, 4228, 4310
};

View file

@ -32,27 +32,27 @@
Discharge and charge curves have not been calibrated yet.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
3300
};
/* 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] =
{
/* TODO: simple uncalibrated curve, linear except for first 10% */
{ 3300, 3600, 3665, 3730, 3795, 3860, 3925, 3990, 4055, 4120, 4185 }
};
/* 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: simple uncalibrated curve, linear except for first 10% */
{ 3300, 3600, 3665, 3730, 3795, 3860, 3925, 3990, 4055, 4120, 4185 };

View file

@ -24,20 +24,20 @@
#include "adc.h"
#include "adc-target.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* TODO: this is just an initial guess */
3300
};
/* 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] =
{
/* TODO: simple uncalibrated curve, linear except for first 10% */
{ 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 }
@ -45,7 +45,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
#if CONFIG_CHARGING
/* 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: simple uncalibrated curve, linear except for first 10% */
3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200

View file

@ -26,25 +26,25 @@
#include "audiohw.h"
#include "adc-target.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3500
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
{ 3500, 3670, 3720, 3750, 3770, 3800, 3860, 3920, 3980, 4070, 4170 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3700, 3820, 3900, 3950, 3990, 4030, 4070, 4120, 4170, 4190, 4200
};

View file

@ -24,26 +24,26 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3199
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
/* NOTE: readout clips at around 4000mV */
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{
{ 3199, 3492, 3543, 3601, 3626, 3651, 3702, 3769, 3794, 3865, 3995 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
/* NOTE: these values may be rather inaccurate. Readout clips at around 4000mV */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3750, 3860, 3880, 3900, 3930, 3994, 4080, 4135, 4200, 4200, 4200
};

View file

@ -24,24 +24,24 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3523 /* 5% */
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3507 /* 3% */
};
/* 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] =
{
{ 3486, 3557, 3628, 3699, 3770, 3841, 3912, 3983, 4054, 4125, 4196 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3486, 3557, 3628, 3699, 3770, 3841, 3912, 3983, 4054, 4125, 4196
};

View file

@ -24,24 +24,24 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3659
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3609
};
/* 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] =
{
{ 3609, 3731, 3789, 3818, 3855, 3885, 3933, 3995, 4050, 4132, 4216 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3777, 3880, 3897, 3907, 3927, 3945, 4006, 4025, 4074, 4131, 4216
};

View file

@ -23,18 +23,18 @@
#include "config.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/* Taken from BertrikSikken's bench on 2008-09-22 */
@ -42,7 +42,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Sansa c200 has a 530 mAh LiPo battery */
3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200

View file

@ -23,25 +23,25 @@
#include "config.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/* Sansa Li Ion 750mAH, took from battery benchs */
{ 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Sansa Li Ion 750mAH */
3700, 3900, 3950, 3985, 4030, 4095, 4150, 4173, 4185, 4195, 4200

View file

@ -30,25 +30,25 @@ int _battery_voltage(void)
/* FIXME - next 4 functions taken from e200 - last 2 will need
to be updated */
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3400
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/* Sansa Li Ion 750mAH FIXME */
{ 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* Sansa Li Ion 750mAH FIXME */
3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160

View file

@ -29,18 +29,18 @@
unsigned short current_voltage = 3910;
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3380
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3300
};
/* 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] =
{
/* Standard D2 internal battery */
{ 3370, 3690, 3750, 3775, 3790, 3820, 3880, 3940, 3980, 4090, 4170 }
@ -50,7 +50,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* FIXME: voltages seem to be offset during charging (eg. 4500+) */
3370, 3690, 3750, 3775, 3790, 3820, 3880, 3940, 3980, 4090, 4170

View file

@ -27,24 +27,24 @@
/* THIS CONTAINS CURRENTLY DUMMY CODE! */
static const unsigned short current_voltage = 3910;
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
0
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
0
};
/* 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] =
{
{ 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320,
};

View file

@ -30,13 +30,13 @@ unsigned short current_aux = 4100;
static unsigned short current_voltage = 4100;
/* This specifies the battery level that writes are still safe */
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3600
};
/* Below this the player cannot be considered to operate reliably */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3580
};
@ -48,13 +48,13 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
/* 6.10 format */
/* 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] =
{
{ 3600, 3650, 3700, 3750, 3800, 3850, 3900, 3950, 4000, 4090, 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] =
{
4000, 4105, 4210, 4315, 4420, 4525, 4630, 4735, 4840, 4945, 5050,
};

View file

@ -32,24 +32,24 @@
#include "logf.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3450
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3508, 3630, 3703, 3727, 3750, 3803, 3870, 3941, 4026, 4142 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3540, 3788, 3860, 3890, 3916, 3956, 4016, 4085, 4164, 4180, 4190
};

View file

@ -23,25 +23,25 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3540
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3500
};
/* 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] =
{
/* average measured values from X5 and M5L */
{ 3500, 3650, 3720, 3740, 3760, 3790, 3840, 3900, 3950, 4040, 4120 }
};
/* 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: This is identical to the discharge curve.
* Calibrate charging curve using a battery_bench log. */

View file

@ -24,25 +24,25 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3540
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3500
};
/* 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] =
{
/* average measured values from X5 and M5L */
{ 3500, 3650, 3720, 3740, 3760, 3790, 3840, 3900, 3950, 4040, 4120 }
};
/* 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: This is identical to the discharge curve.
* Calibrate charging curve using a battery_bench log. */

View file

@ -24,25 +24,25 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3380
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3020
};
/* 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] =
{
/* Below 3370 the backlight starts flickering during HD access */
{ 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* values measured over one full charging cycle */
3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 /* LiPo */

View file

@ -24,25 +24,25 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3380
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3020
};
/* 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] =
{
/* Below 3370 the backlight starts flickering during HD access */
{ 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* values measured over one full charging cycle */
3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 /* LiPo */

View file

@ -23,24 +23,24 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3600
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3500
};
/* 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] =
{
{ 3500, 3566, 3597, 3619, 3644, 3676, 3732, 3806, 3868, 3937, 4004 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* values measured over one full charging cycle */
3386, 3872, 3904, 3942, 3996, 4029, 4033, 4036, 4038, 4039, 4041

View file

@ -23,24 +23,24 @@
#include "adc.h"
#include "powermgmt.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3600
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3500
};
/* 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] =
{
{ 3500, 3583, 3603, 3620, 3656, 3694, 3747, 3800, 3855, 3934, 4007 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
/* values measured over one full charging cycle */
3386, 3872, 3904, 3942, 3996, 4029, 4033, 4036, 4038, 4039, 4041

View file

@ -21,25 +21,25 @@
#include "power.h"
#include "power-agptek.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3470
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3675, 3715, 3750, 3775, 3810, 3850, 3915, 3985, 4060, 4155 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196
};

View file

@ -21,26 +21,26 @@
#include "power.h"
#include "power-erosq.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3435
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
/* ErosQ's 1300mAh battery */
{ 3400, 3478, 3547, 3581, 3618, 3654, 3725, 3820, 3909, 3999, 4159 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196
};

View file

@ -21,25 +21,25 @@
#include "power.h"
#include "power-fiio.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3470
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3639, 3697, 3723, 3757, 3786, 3836, 3906, 3980, 4050, 4159 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196
};

View file

@ -35,13 +35,13 @@
/* Based on batterymonitor with PISEN and Samsung SIII battery. */
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3600
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3500
};
@ -55,14 +55,14 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
< 3660 (0%), < 3730 (1% - 10%), < 3780 (11% - 20%), < 3830 (21% - 40%), < 3950 (41% - 60%),
< 4080 (61% - 80%), > 4081 (81% - 100%)
*/
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{
{ 3522, 3660, 3720, 3752, 3784, 3827, 3896, 3978, 4072, 4168, 4255 }
};
/* Copied from percent_to_volt_discharge. */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3500, 3544, 3578, 3623, 3660, 3773, 3782, 3853, 3980, 4130, 4360
};

View file

@ -37,26 +37,26 @@ static bool first_readout = true;
static int power_status = CHARGER_NOT_CONNECTED;
static int charging_status = BATT_NOT_CHARGING;
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3470
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3450
};
/* 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] =
{
{ 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 }
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200
};

View file

@ -56,19 +56,19 @@ void max17040_close(void)
}
#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE) == VOLTAGE_MEASURE
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3470
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3450
};
/* 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] =
{
{ 3450, 3502, 3550, 3587, 3623, 3669, 3742, 3836, 3926, 4026, 4200 }
};
@ -76,7 +76,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200
};

View file

@ -21,25 +21,25 @@
#include "power.h"
#include "power-nwz.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3470
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3450
};
/* 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] =
{
{ 3450, 3698, 3746, 3781, 3792, 3827, 3882, 3934, 3994, 4060, 4180 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200
};

View file

@ -21,25 +21,25 @@
#include "power.h"
#include "power-xduoo.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3443 /* 5% */
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3498, 3560, 3592, 3624, 3672, 3753, 3840, 3937, 4047, 4189 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196
};

View file

@ -76,24 +76,24 @@ static volatile bool pen_down = false;
static struct mutex battery_mtx;
static struct semaphore battery_done;
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
1600
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
1550
};
/* 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] =
{
{ 1550, 1790, 1810, 1825, 1855, 1865, 1875, 1900, 1930, 1985, 2200 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
1580, 1870, 1900, 1900, 1940, 1965, 1990, 2020, 2050, 2090, 2620
};

View file

@ -37,27 +37,27 @@
static volatile unsigned short bat_val;
static struct mutex battery_mtx;
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* TODO */
1000
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* TODO */
900
};
/* 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] =
{
/* TODO */
{ 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000 },
};
/* 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 */
1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000

View file

@ -199,20 +199,20 @@ void KEY_INT_IRQ(void)
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
/* 5% */
3414, 3634
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* 0% */
3307, 3307
};
/* 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] =
{
{ 3307, 3459, 3530, 3575, 3608, 3648, 3723, 3819, 3918, 4022, 4162 },
{ 3300, 3652, 3704, 3730, 3753, 3786, 3836, 3906, 3973, 4061, 4160 }
@ -220,7 +220,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
// { 3300, 3652, 3704, 3730, 3753, 3786, 3836, 3906, 3973, 4061, 4160 };
{ 3444, 3827, 3893, 3909, 3931, 4001, 4067, 4150, 4206, 4207, 4208 };
#endif /* CONFIG_CHARGING */

View file

@ -33,25 +33,25 @@
#include "i2c-x1000.h"
#include "devicedata.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3470
};
/* The OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3477, 3540, 3578, 3617, 3674, 3771, 3856, 3936, 4016, 4117 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3400, 3477, 3540, 3578, 3617, 3674, 3771, 3856, 3936, 4016, 4117
};

View file

@ -29,25 +29,25 @@
#include "axp-pmu.h"
#include "i2c-x1000.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3470
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3639, 3697, 3723, 3757, 3786, 3836, 3906, 3980, 4050, 4159 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196
};

View file

@ -47,25 +47,25 @@
* devices is getting confused.
*/
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] =
{
3470
};
/* the OF shuts down at this voltage */
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3400
};
/* 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] =
{
{ 3400, 3639, 3697, 3723, 3757, 3786, 3836, 3906, 3980, 4050, 4159 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{
3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196
};

View file

@ -61,3 +61,20 @@ As \setting{Battery Benchmark} needs to write the data held in memory to
disk in order to save them, it is possible that should Rockbox shut down
due to low battery then there will not be enough power remaining to write the
data to disk. Therefore all measurements since the previous save will be lost.
\subsubsection{Advanced}
On first run \setting{Battery Benchmark} will export the default battery tables
to '/.rockbox/battery\_levels.default'
You can use the values recorded by \setting{Battery Benchmark}
to more accurately reflect the capacity of your individual battery.
Once you have made your changes rename '.default' to '.cfg' and your custom
battery table will be loaded next boot.
\note{\setting{WARNING} be aware 'shutoff' and 'disksafe' levels are to protect your player
both over-discharge of the battery and to prevent dataloss.
Setting these values incorrectly may cause damage to your \dap{}, battery, data, or disk.
However, 'discharge' and 'charge' tables are only used to calibrate the battery
meter and should be safe to change to any value.
Each entry should be greater or equal to 'shutdown' and or the previous table entry
otherwise the battery tables will be rejected.
}

View file

@ -102,13 +102,13 @@ static void battery_status_update(void)
batt_current = charging ? BATT_CHARGE_STEP : BATT_DISCHARGE_STEP;
}
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { 3200 };
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = { 3200 };
unsigned short battery_level_disksafe[BATTERY_TYPES_COUNT] = { 3200 };
unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = { 3200 };
/* make the simulated curve nicely linear */
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{ { 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300 } };
const unsigned short percent_to_volt_charge[11] =
unsigned short percent_to_volt_charge[11] =
{ 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300 };
#if CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE