1
0
Fork 0
forked from len0rd/rockbox

Consistent battery capacity handling for settings and menu, adapted allowed range for Ondio

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5243 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2004-10-10 10:28:21 +00:00
parent ccfa4cd97a
commit fe32456fe0
3 changed files with 11 additions and 9 deletions

View file

@ -217,13 +217,9 @@ static const struct bit_entry rtc_bits[] =
{1, S_O(discharge), 0, "deep discharge", off_on },
{1, S_O(trickle_charge), true, "trickle charge", off_on },
#endif
#if CONFIG_BATTERY == BATT_LIION2200
{12, S_O(battery_capacity), 2200, "battery capacity", NULL }, /* 1500...3200 */
#elif CONFIG_BATTERY == BATT_4AA_NIMH
{12, S_O(battery_capacity), 1500, "battery capacity", NULL }, /* 1500...3200 */
#elif CONFIG_BATTERY == BATT_3AAA_ALKALINE
{12, S_O(battery_capacity), 1000, "battery capacity", NULL },
#endif
{12, S_O(battery_capacity), BATTERY_CAPACITY_MIN, "battery capacity",
NULL }, /* 1500...3200 for NiMH, 2200...3200 for LiIon,
1000...2000 for Alkaline */
#ifdef HAVE_CHARGING
{1, S_O(car_adapter_mode), false, "car adapter mode", off_on },
#endif

View file

@ -703,7 +703,8 @@ static bool battery_capacity(void)
{
return set_int(str(LANG_BATTERY_CAPACITY), "mAh", UNIT_MAH,
&global_settings.battery_capacity,
&set_battery_capacity, 50, 1500, BATTERY_CAPACITY_MAX );
&set_battery_capacity, 50, BATTERY_CAPACITY_MIN,
BATTERY_CAPACITY_MAX );
}
#endif

View file

@ -24,20 +24,25 @@
#define BATTERY_LEVEL_EMPTY 265 /* 2.65V */
#define BATTERY_LEVEL_DANGEROUS 280 /* 2.80V */
#define BATTERY_LEVEL_FULL 400 /* 4.00V */
#define BATTERY_CAPACITY_MIN 2200
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable in settings */
#elif CONFIG_BATTERY == BATT_3AAA_ALKALINE /* Ondio, Alkalines */
#define BATTERY_LEVEL_SHUTDOWN 250 /* 2.50V */
#define BATTERY_LEVEL_EMPTY 260 /* 2.60V */
#define BATTERY_LEVEL_DANGEROUS 270 /* 2.80V */
#define BATTERY_LEVEL_FULL 450 /* 4.50V */
#define BATTERY_CAPACITY_MIN 1000
#define BATTERY_CAPACITY_MAX 2000 /* max. capacity selectable in settings */
#else /* Recorder, NiMH */
#define BATTERY_LEVEL_SHUTDOWN 450 /* 4.50V */
#define BATTERY_LEVEL_EMPTY 465 /* 4.65V */
#define BATTERY_LEVEL_DANGEROUS 475 /* 4.75V */
#define BATTERY_LEVEL_FULL 585 /* 5.85V */
#define BATTERY_CAPACITY_MIN 1500
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable in settings */
#endif
#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_EMPTY)
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity that can be selected in settings menu, min. is always 1500 */
#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */
#define POWER_AVG_N 4 /* how many samples to take for each measurement */