From b61e2632194956912437905c1fa03315ca7ef520 Mon Sep 17 00:00:00 2001 From: Zakk Roberts Date: Sat, 15 Apr 2006 12:31:33 +0000 Subject: Move the battery min/max capacity to player config files and add an increment setting (amount of mAh to increase/decrease by in the settings menu) for more precise battery value tweaking/limiting per-model. This allows the proper range for iAudio X5 - 950mAh, or 2250mAh for the X5L. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9678 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings_menu.c | 2 +- firmware/export/config-fmrecorder.h | 5 ++++- firmware/export/config-gigabeat.h | 4 ++++ firmware/export/config-gmini120.h | 4 ++++ firmware/export/config-gminisp.h | 4 ++++ firmware/export/config-h100.h | 5 ++++- firmware/export/config-h120.h | 5 ++++- firmware/export/config-h300.h | 5 ++++- firmware/export/config-iaudiox5.h | 7 +++++-- firmware/export/config-ipod3g.h | 5 ++++- firmware/export/config-ipod4g.h | 5 ++++- firmware/export/config-ipodcolor.h | 5 ++++- firmware/export/config-ipodmini.h | 5 ++++- firmware/export/config-ipodmini2g.h | 5 ++++- firmware/export/config-ipodnano.h | 5 ++++- firmware/export/config-ipodvideo.h | 5 ++++- firmware/export/config-ondiofm.h | 8 +++++--- firmware/export/config-ondiosp.h | 8 +++++--- firmware/export/config-player.h | 6 ++++-- firmware/export/config-recorder.h | 6 ++++-- firmware/export/config-recorderv2.h | 5 ++++- firmware/export/powermgmt.h | 18 ------------------ 22 files changed, 84 insertions(+), 43 deletions(-) diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 04f8c0c9af..14f1b57776 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -915,7 +915,7 @@ static bool battery_capacity(void) { return set_int(str(LANG_BATTERY_CAPACITY), "mAh", UNIT_MAH, &global_settings.battery_capacity, - &set_battery_capacity, 50, BATTERY_CAPACITY_MIN, + &set_battery_capacity, BATTERY_CAPACITY_INC, BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX, NULL ); } diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index 27e2f10f88..125956691b 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h @@ -63,7 +63,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIION2200 - +#define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ /* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */ #define BATTERY_SCALE_FACTOR 8081 diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index db99bf5d57..ec36de413e 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -52,6 +52,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 +#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ diff --git a/firmware/export/config-gmini120.h b/firmware/export/config-gmini120.h index 8ffe51c433..e402d9e3c1 100644 --- a/firmware/export/config-gmini120.h +++ b/firmware/export/config-gmini120.h @@ -45,6 +45,10 @@ /* Type of mobile power, FIXME: probably different, make new type */ #define CONFIG_BATTERY BATT_LIION2200 +#define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 6465 /* chosen values at random -- jyp */ diff --git a/firmware/export/config-gminisp.h b/firmware/export/config-gminisp.h index 4aa4723ca0..aa0bf09bb4 100644 --- a/firmware/export/config-gminisp.h +++ b/firmware/export/config-gminisp.h @@ -36,6 +36,10 @@ /* Type of mobile power, FIXME: probably different, make new type */ #define CONFIG_BATTERY BATT_LIION2200 +#define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 6465 /* chosen values at random -- jyp */ diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 20fcb75fdf..62d262c16b 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -81,7 +81,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ /* Define this if the platform can charge batteries */ diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index 34c10b7682..a577a369c7 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -73,7 +73,10 @@ #define CONFIG_I2C I2C_COLDFIRE #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ /* Define if we have a hardware defect that causes ticking on the audio line */ diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 41e3c827d5..947a42e776 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -74,7 +74,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ /* Define if we have a hardware defect that causes ticking on the audio line */ diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index b33bae913b..2a16bafc07 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -77,12 +77,15 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 +#define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ +#define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ /* define this if you have a real-time clock */ #define CONFIG_RTC RTC_PCF50606 -#define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ - /* Define this if you have ATA power-off control */ #define HAVE_ATA_POWER_OFF diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 3ac0844548..62950b8d09 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -60,7 +60,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 10 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 /* Define this if the platform can charge batteries */ diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 3eb354363a..68b5d5f3b9 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h @@ -62,7 +62,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 10 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 /* Define this if the platform can charge batteries */ diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 42cdf0fb5e..7da7f0fc4e 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h @@ -61,7 +61,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 700 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 10 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 /* Define this if the platform can charge batteries */ diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 04ea2190ea..047c9926ef 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -62,7 +62,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 400 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 10 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 /* Define this if the platform can charge batteries */ diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 82d282be3f..cd3daa9b81 100755 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -65,7 +65,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 400 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 /* Define this if the platform can charge batteries */ diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 98e307fa86..026355af60 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h @@ -66,7 +66,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 /* Define this if the platform can charge batteries */ diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 1f57432c56..54b32265e1 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h @@ -66,7 +66,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIPOL1300 - +#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 /* Define this if the platform can charge batteries */ diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index 9ec7e46753..acaba63264 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h @@ -41,9 +41,11 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_3AAA - -/* Battery scale factor (average from 3 Ondios) */ -#define BATTERY_SCALE_FACTOR 4735 +#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ +#define BATTERY_SCALE_FACTOR 4735 /* average from 3 Ondios */ /* Define this if you control power on PB5 (instead of the OFF button) */ #define HAVE_POWEROFF_ON_PB5 diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index a856450972..567bc0a161 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h @@ -31,9 +31,11 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_3AAA - -/* Battery scale factor (average from 3 Ondios) */ -#define BATTERY_SCALE_FACTOR 4735 +#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ +#define BATTERY_SCALE_FACTOR 4735 /* average from 3 Ondios */ /* Define this if you control power on PB5 (instead of the OFF button) */ #define HAVE_POWEROFF_ON_PB5 diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index aea9dde2ee..d587a8aa89 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h @@ -40,8 +40,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_4AA_NIMH - -/* Battery scale factor (?) */ +#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 6546 /* Define this if you must discharge the data line by driving it low diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index 130e199783..e4865d7e8f 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h @@ -57,8 +57,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_4AA_NIMH - -/* Battery scale factor (?) */ +#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 6465 /* Define this if you control power on PBDR (instead of PADR) */ diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index b3136f13cc..eed46f2823 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h @@ -60,7 +60,10 @@ /* Type of mobile power */ #define CONFIG_BATTERY BATT_LIION2200 - +#define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ /* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */ #define BATTERY_SCALE_FACTOR 8081 diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index b9ac996fc0..da78857072 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -19,24 +19,6 @@ #ifndef _POWERMGMT_H_ #define _POWERMGMT_H_ -#if CONFIG_BATTERY == BATT_LIION2200 /* FM Recorder, LiIon */ -#define BATTERY_CAPACITY_MIN 2200 -#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable in settings */ -#define BATTERY_TYPES_COUNT 1 -#elif CONFIG_BATTERY == BATT_3AAA /* Ondio */ -#define BATTERY_CAPACITY_MIN 500 -#define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable in settings */ -#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ -#elif CONFIG_BATTERY == BATT_LIPOL1300 /* iRiver H1x0 */ -#define BATTERY_CAPACITY_MIN 1300 -#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable in settings */ -#define BATTERY_TYPES_COUNT 1 -#else /* Recorder, NiMH */ -#define BATTERY_CAPACITY_MIN 1500 -#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable in settings */ -#define BATTERY_TYPES_COUNT 1 -#endif - #define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */ #define CHARGE_END_SHORTD 6 /* stop when N minutes have passed with -- cgit v1.2.3