From 0fac492c3da8b46ad1cf5a668e5d851c63443a94 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 17 Aug 2007 06:45:18 +0000 Subject: First step of powermanagement rework: * Move target specific stuff into target tree, starting with battery voltage tables and voltage reading. (This revealed some incorrect percent_to_voltage_charging mappings). * Voltage reading on 1st gen ipods is now correct. * Clean up obsolete config #defines. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14375 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-e200.h | 3 --- firmware/export/config-fmrecorder.h | 4 ---- firmware/export/config-gigabeat.h | 4 ---- firmware/export/config-h10.h | 3 --- firmware/export/config-h100.h | 3 --- firmware/export/config-h10_5gb.h | 3 --- firmware/export/config-h120.h | 2 -- firmware/export/config-h300.h | 3 --- firmware/export/config-iaudiom5.h | 4 ---- firmware/export/config-iaudiox5.h | 4 ---- firmware/export/config-ifp7xx.h | 6 +++--- firmware/export/config-ipod1g2g.h | 3 --- firmware/export/config-ipod3g.h | 3 --- firmware/export/config-ipod4g.h | 3 --- firmware/export/config-ipodcolor.h | 3 --- firmware/export/config-ipodmini.h | 3 --- firmware/export/config-ipodmini2g.h | 3 --- firmware/export/config-ipodnano.h | 4 ---- firmware/export/config-ipodvideo.h | 25 ++++++++----------------- firmware/export/config-ondiofm.h | 6 +++--- firmware/export/config-ondiosp.h | 6 +++--- firmware/export/config-player.h | 6 +++--- firmware/export/config-recorder.h | 6 +++--- firmware/export/config-recorderv2.h | 4 ---- firmware/export/config-tpj1022.h | 3 --- firmware/export/config.h | 14 -------------- firmware/export/powermgmt.h | 10 +++++++++- 27 files changed, 32 insertions(+), 109 deletions(-) (limited to 'firmware/export') diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index 17f06b5cea..5a23b276eb 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h @@ -106,14 +106,11 @@ #define HAVE_MULTIVOLUME -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIION750 #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ #define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 0 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -#define BATTERY_SCALE_FACTOR 5005 /* ADC should read 0x3ff=5.12V */ /* Hardware controlled charging? FIXME */ #define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index a41c69a7bf..b237bd5804 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h @@ -60,15 +60,11 @@ #define CONFIG_I2C I2C_PLAYREC -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIION2200 #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ #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 /* Hardware controlled charging with monitoring */ #define CONFIG_CHARGING CHARGING_MONITOR diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 319ad4e916..ba6b714a17 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -79,15 +79,11 @@ #define HAVE_HEADPHONE_DETECTION -/* Type of mobile power - check this out */ -#define CONFIG_BATTERY BATT_LIION830 /* could change this later */ #define BATTERY_CAPACITY_DEFAULT 2000 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ #define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 25 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -/* ADC[0] is (530) at discharge and 625 at full charge */ -#define BATTERY_SCALE_FACTOR 6450 /* Hardware controlled charging with monitoring */ #define CONFIG_CHARGING CHARGING_MONITOR diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index 502b5b106e..b54397f46c 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h @@ -93,14 +93,11 @@ #define AB_REPEAT_ENABLE 1 -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LPCS355385 #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ #define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 10 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -#define BATTERY_SCALE_FACTOR 4688 /* Hardware controlled charging */ #define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 3d6f217ebb..c661e1df14 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -91,14 +91,11 @@ #define HAVE_AGC -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ #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 */ /* Hardware controlled charging */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index 254f59fa35..d45b6e3064 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h @@ -79,14 +79,11 @@ #define AB_REPEAT_ENABLE 1 -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_BP009 #define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 700 /* min. capacity selectable */ #define BATTERY_CAPACITY_MAX 900 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 10 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -#define BATTERY_SCALE_FACTOR 4688 /* Hardware controlled charging */ #define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index bf13f3e1d7..6fc9aa2406 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -91,13 +91,11 @@ #define HAVE_AGC -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ #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 */ /* Hardware controlled charging */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 91c175fc7d..483582080e 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -88,14 +88,11 @@ #define HAVE_AGC -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ #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 */ /* Hardware controlled charging with monitoring */ #define CONFIG_CHARGING CHARGING_MONITOR diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h index 4ab8e2c0dc..3e98f4e748 100644 --- a/firmware/export/config-iaudiom5.h +++ b/firmware/export/config-iaudiom5.h @@ -84,15 +84,11 @@ /* TLV320 has no tone controls, so we use the software ones */ #define HAVE_SW_TONE_CONTROLS -/* Type of mobile power */ -#define X5_BATT_CONFIG 2 -#define CONFIG_BATTERY BATT_IAUDIO_X5M5 #define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */ #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 5859 /* (420703125 + 35900) / 71800 */ /* Hardware controlled charging? FIXME */ #define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index c02b2a78f4..c78137c721 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -98,15 +98,11 @@ /* TLV320 has no tone controls, so we use the software ones */ #define HAVE_SW_TONE_CONTROLS -/* Type of mobile power */ -#define X5_BATT_CONFIG 2 -#define CONFIG_BATTERY BATT_IAUDIO_X5M5 #define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */ #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 5859 /* (420703125 + 35900) / 71800 */ /* Hardware controlled charging? FIXME */ #define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h index 65915df30e..20421ea5be 100644 --- a/firmware/export/config-ifp7xx.h +++ b/firmware/export/config-ifp7xx.h @@ -60,14 +60,14 @@ /* define this if you have a flash memory storage */ #define HAVE_FLASH_STORAGE -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_1AA #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ #define BATTERY_CAPACITY_MAX 2800 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 50 /* capacity increment */ #define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ -#define BATTERY_SCALE_FACTOR 3000 /* TODO: only roughly correct */ + +/* define this if the unit should not shut down on low battery. */ +#define NO_LOW_BATTERY_SHUTDOWN #ifndef SIMULATOR diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h index ff3e7b5636..d51a7437ec 100644 --- a/firmware/export/config-ipod1g2g.h +++ b/firmware/export/config-ipod1g2g.h @@ -69,14 +69,11 @@ /* Define this if you can detect headphones */ #define HAVE_HEADPHONE_DETECTION -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 1200 /* min. capacity selectable */ #define BATTERY_CAPACITY_MAX 1900 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 50 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -#define BATTERY_SCALE_FACTOR 25882 /* Hardware controlled charging? FIXME */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 64aa14941b..e4be8c7d6e 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -72,14 +72,11 @@ /* Define this if you can detect headphones */ #define HAVE_HEADPHONE_DETECTION -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ #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 /* Hardware controlled charging? FIXME */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 46c1e53235..84c38f8506 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h @@ -82,14 +82,11 @@ /* Define this if you can detect headphones */ #define HAVE_HEADPHONE_DETECTION -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ #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 /* Hardware controlled charging? FIXME */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 586d6727bc..c1098c71fe 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h @@ -73,14 +73,11 @@ /* Define this if you can detect headphones */ #define HAVE_HEADPHONE_DETECTION -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */ #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 /* Hardware controlled charging? FIXME */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 3b215a43c5..54d0e2c230 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -78,14 +78,11 @@ /* Define this if you can detect headphones */ #define HAVE_HEADPHONE_DETECTION -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ #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 /* Hardware controlled charging? FIXME */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 76c64f47d4..5a851fffee 100644 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -78,14 +78,11 @@ /* Define this if you can detect headphones */ #define HAVE_HEADPHONE_DETECTION -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIPOL1300 #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ #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 /* Hardware controlled charging? FIXME */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index a2f9e3249b..d3c229593f 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h @@ -79,8 +79,6 @@ /* define this if you have a flash memory storage */ #define HAVE_FLASH_STORAGE -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIION300 #define BATTERY_CAPACITY_DEFAULT 300 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 200 /* min. capacity selectable */ #define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ @@ -101,8 +99,6 @@ /* Define this if you want to use the PP5020 i2c interface */ #define CONFIG_I2C I2C_PP5020 -#define BATTERY_SCALE_FACTOR 5840 - /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 0f2da5360a..b792f6f5dc 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h @@ -8,9 +8,6 @@ /* For Rolo and boot loader */ #define MODEL_NUMBER 5 -/* For battery type (30GB by default, undefine here to use 60/80GB model) */ -#define CONFIG_BATTERY_IPOD_VIDEO_30GB - /* define this if you have recording possibility */ #define HAVE_RECORDING @@ -81,22 +78,16 @@ /* Type of mobile power */ #if (MEM==32) /* this is the 30GB-model */ -# define CONFIG_BATTERY BATT_LIION400 -# define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity for the 30GB model */ -# define BATTERY_CAPACITY_MIN 300 /* 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 BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity for the 30GB model */ +# define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */ +# define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */ #else /* these are the 60/80GB-models */ -# define CONFIG_BATTERY BATT_LIION400 /* FIXME: we assume to have same discharge behaviour as 30GB iPOD */ -# define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity for the 60/80GB model */ -# define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ -# define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ -# define BATTERY_CAPACITY_INC 50 /* capacity increment */ -# define BATTERY_TYPES_COUNT 1 /* only one type */ -# define BATTERY_SCALE_FACTOR 5865 +# define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity for the 60/80GB model */ +# define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ +# define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */ #endif +#define BATTERY_CAPACITY_INC 50 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ /* Hardware controlled charging with monitoring */ #define CONFIG_CHARGING CHARGING_MONITOR diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index 335ce855fc..1a288c5c87 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h @@ -52,14 +52,14 @@ /* define this if more than one device/partition can be used */ #define HAVE_MULTIVOLUME -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_3AAA #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ #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 the unit should not shut down on low battery. */ +#define NO_LOW_BATTERY_SHUTDOWN /* define this if the unit can be powered or charged via USB */ #define HAVE_USB_POWER diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index 0ceb72e936..9d3dd729f2 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h @@ -41,14 +41,14 @@ /* define this if more than one device/partition can be used */ #define HAVE_MULTIVOLUME -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_3AAA #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ #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 the unit should not shut down on low battery. */ +#define NO_LOW_BATTERY_SHUTDOWN /* define this if the unit can be powered or charged via USB */ #define HAVE_USB_POWER diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index bd89b0bb2e..723b852d3d 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h @@ -27,14 +27,14 @@ /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_4AA_NIMH #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ #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 the unit should not shut down on low battery. */ +#define NO_LOW_BATTERY_SHUTDOWN /* Hardware controlled charging */ #define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index 4569c8bfd0..bb57ba5666 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h @@ -51,14 +51,14 @@ #define CONFIG_I2C I2C_PLAYREC -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_4AA_NIMH #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ #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 the unit should not shut down on low battery. */ +#define NO_LOW_BATTERY_SHUTDOWN /* Software controlled charging */ #define CONFIG_CHARGING CHARGING_CONTROL diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index d28595d154..f06aa92550 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h @@ -57,15 +57,11 @@ #define CONFIG_I2C I2C_PLAYREC -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LIION2200 #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ #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 /* Hardware controlled charging with monitoring */ #define CONFIG_CHARGING CHARGING_MONITOR diff --git a/firmware/export/config-tpj1022.h b/firmware/export/config-tpj1022.h index be2da37412..067bb4f6f2 100644 --- a/firmware/export/config-tpj1022.h +++ b/firmware/export/config-tpj1022.h @@ -57,8 +57,6 @@ /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT -/* Type of mobile power */ -#define CONFIG_BATTERY BATT_LPCS355385 #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity TODO: check this, probably different for different models too */ @@ -66,7 +64,6 @@ #define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 10 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -#define BATTERY_SCALE_FACTOR 5865 /* Hardware controlled charging? FIXME */ //#define CONFIG_CHARGING CHARGING_SIMPLE diff --git a/firmware/export/config.h b/firmware/export/config.h index df5300c0b8..44583183b1 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -71,20 +71,6 @@ #define H300_REMOTE 2 #define X5_REMOTE 3 -/* CONFIG_BATTERY */ -#define BATT_LIION2200 2200 /* FM/V2 recorder type */ -#define BATT_4AA_NIMH 1500 -#define BATT_3AAA 1000 /* Ondio */ -#define BATT_IAUDIO_X5M5 950 -#define BATT_LIPOL1300 1300 /* the type used in iRiver h1x0 models */ -#define BATT_LPCS355385 1550 /* iriver h10 20Gb - SKC LPCS355385 */ -#define BATT_BP009 820 /* iriver H10 5/6Gb - iriver BP009 */ -#define BATT_LIION830 830 /* Toshiba Gigabeat Fxx and Xxx series MK11-2740 */ -#define BATT_LIION750 750 /* Sansa e200 LiIon 3,7V */ -#define BATT_LIION400 400 /* iPOD 5G/5.5G Video 30GB LiIon 400mAh */ -#define BATT_LIION300 300 /* iPOD nano LiIon 300mAh */ -#define BATT_1AA 333 /* iRiver iFP: Alkaline, NiHM */ - /* CONFIG_CHARGING */ #define CHARGING_SIMPLE 1 /* Simple, hardware controlled charging */ #define CHARGING_MONITOR 2 /* Hardware controlled charging with monitoring */ diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 89a0350bb7..858b5015ec 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -19,6 +19,8 @@ #ifndef _POWERMGMT_H_ #define _POWERMGMT_H_ +#include + #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 @@ -137,6 +139,12 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute #endif /* not HAVE_MMC */ 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]; +#if CONFIG_CHARGING +extern const unsigned short percent_to_volt_charge[11]; +#endif /* Start up power management thread */ void powermgmt_init(void); @@ -146,7 +154,7 @@ void powermgmt_init(void); /* Returns battery statust */ int battery_level(void); /* percent */ int battery_time(void); /* minutes */ -int battery_adc_voltage(void); /* voltage from ADC in millivolts */ +unsigned int battery_adc_voltage(void); /* voltage from ADC in millivolts */ unsigned int battery_voltage(void); /* filtered batt. voltage in millivolts */ /* read unfiltered battery info */ -- cgit v1.2.3