diff options
-rw-r--r-- | apps/settings.c | 8 | ||||
-rw-r--r-- | firmware/export/config-fmrecorder.h | 2 | ||||
-rw-r--r-- | firmware/export/config-gigabeat.h | 2 | ||||
-rw-r--r-- | firmware/export/config-gmini120.h | 2 | ||||
-rw-r--r-- | firmware/export/config-gminisp.h | 2 | ||||
-rw-r--r-- | firmware/export/config-h100.h | 2 | ||||
-rw-r--r-- | firmware/export/config-h120.h | 2 | ||||
-rw-r--r-- | firmware/export/config-h300.h | 2 | ||||
-rw-r--r-- | firmware/export/config-iaudiox5.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ipod3g.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ipod4g.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ipodcolor.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ipodmini.h | 2 | ||||
-rwxr-xr-x | firmware/export/config-ipodmini2g.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ipodnano.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ipodvideo.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ondiofm.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ondiosp.h | 2 | ||||
-rw-r--r-- | firmware/export/config-player.h | 2 | ||||
-rw-r--r-- | firmware/export/config-recorder.h | 2 | ||||
-rw-r--r-- | firmware/export/config-recorderv2.h | 2 | ||||
-rw-r--r-- | firmware/powermgmt.c | 38 |
22 files changed, 63 insertions, 23 deletions
diff --git a/apps/settings.c b/apps/settings.c index 1316969726..2eeb6a937e 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR; | |||
94 | #include "dsp.h" | 94 | #include "dsp.h" |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | #define CONFIG_BLOCK_VERSION 40 | 97 | #define CONFIG_BLOCK_VERSION 40 |
98 | #define CONFIG_BLOCK_SIZE 512 | 98 | #define CONFIG_BLOCK_SIZE 512 |
99 | #define RTC_BLOCK_SIZE 44 | 99 | #define RTC_BLOCK_SIZE 44 |
100 | 100 | ||
@@ -273,7 +273,7 @@ static const struct bit_entry rtc_bits[] = | |||
273 | {14, S_O(max_files_in_dir), 400, | 273 | {14, S_O(max_files_in_dir), 400, |
274 | "max files in dir", NULL }, /* 50...10000 */ | 274 | "max files in dir", NULL }, /* 50...10000 */ |
275 | /* battery */ | 275 | /* battery */ |
276 | {12, S_O(battery_capacity), BATTERY_CAPACITY_MIN, "battery capacity", | 276 | {12, S_O(battery_capacity), BATTERY_CAPACITY_DEFAULT, "battery capacity", |
277 | NULL }, /* 1500...3200 for NiMH, 2200...3200 for LiIon, | 277 | NULL }, /* 1500...3200 for NiMH, 2200...3200 for LiIon, |
278 | 500...1500 for Alkaline */ | 278 | 500...1500 for Alkaline */ |
279 | #ifdef HAVE_CHARGING | 279 | #ifdef HAVE_CHARGING |
@@ -1612,7 +1612,7 @@ bool settings_save_config(void) | |||
1612 | fdprintf(fd, "# .cfg file created by rockbox %s - " | 1612 | fdprintf(fd, "# .cfg file created by rockbox %s - " |
1613 | "http://www.rockbox.org\r\n#\r\n#\r\n# wps / rwps / language" | 1613 | "http://www.rockbox.org\r\n#\r\n#\r\n# wps / rwps / language" |
1614 | " / font / fmpreset / backdrop \r\n#\r\n", appsversion); | 1614 | " / font / fmpreset / backdrop \r\n#\r\n", appsversion); |
1615 | 1615 | ||
1616 | if (global_settings.wps_file[0] != 0) | 1616 | if (global_settings.wps_file[0] != 0) |
1617 | fdprintf(fd, "wps: %s/%s.wps\r\n", WPS_DIR, | 1617 | fdprintf(fd, "wps: %s/%s.wps\r\n", WPS_DIR, |
1618 | global_settings.wps_file); | 1618 | global_settings.wps_file); |
@@ -1721,7 +1721,7 @@ void settings_reset(void) { | |||
1721 | global_settings.superbass = sound_default(SOUND_SUPERBASS); | 1721 | global_settings.superbass = sound_default(SOUND_SUPERBASS); |
1722 | #endif | 1722 | #endif |
1723 | global_settings.contrast = lcd_default_contrast(); | 1723 | global_settings.contrast = lcd_default_contrast(); |
1724 | 1724 | ||
1725 | #ifdef CONFIG_TUNER | 1725 | #ifdef CONFIG_TUNER |
1726 | global_settings.fmr_file[0] = '\0'; | 1726 | global_settings.fmr_file[0] = '\0'; |
1727 | #endif | 1727 | #endif |
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index 125956691b..8711640e93 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h | |||
@@ -44,6 +44,8 @@ | |||
44 | /* Define this for LCD backlight available */ | 44 | /* Define this for LCD backlight available */ |
45 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 45 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ |
46 | 46 | ||
47 | #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ | ||
48 | |||
47 | #ifndef SIMULATOR | 49 | #ifndef SIMULATOR |
48 | 50 | ||
49 | /* Define this if you have a SH7034 */ | 51 | /* Define this if you have a SH7034 */ |
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index ec36de413e..83a92ce140 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h | |||
@@ -42,6 +42,8 @@ | |||
42 | /* Define this if you have the WM8975 audio codec */ | 42 | /* Define this if you have the WM8975 audio codec */ |
43 | #define HAVE_WM8751 | 43 | #define HAVE_WM8751 |
44 | 44 | ||
45 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | ||
46 | |||
45 | #ifndef SIMULATOR | 47 | #ifndef SIMULATOR |
46 | 48 | ||
47 | /* Define this if you have a Motorola SCF5249 */ | 49 | /* Define this if you have a Motorola SCF5249 */ |
diff --git a/firmware/export/config-gmini120.h b/firmware/export/config-gmini120.h index e402d9e3c1..42424bb7b1 100644 --- a/firmware/export/config-gmini120.h +++ b/firmware/export/config-gmini120.h | |||
@@ -30,6 +30,8 @@ | |||
30 | /* The number of bytes reserved for loadable plugins */ | 30 | /* The number of bytes reserved for loadable plugins */ |
31 | #define PLUGIN_BUFFER_SIZE 0x80000 | 31 | #define PLUGIN_BUFFER_SIZE 0x80000 |
32 | 32 | ||
33 | #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ | ||
34 | |||
33 | #ifndef SIMULATOR | 35 | #ifndef SIMULATOR |
34 | 36 | ||
35 | /* Define this if you have a TCC730 (CalmRISC16) */ | 37 | /* Define this if you have a TCC730 (CalmRISC16) */ |
diff --git a/firmware/export/config-gminisp.h b/firmware/export/config-gminisp.h index aa0bf09bb4..e066661061 100644 --- a/firmware/export/config-gminisp.h +++ b/firmware/export/config-gminisp.h | |||
@@ -21,6 +21,8 @@ | |||
21 | /* The number of bytes reserved for loadable plugins */ | 21 | /* The number of bytes reserved for loadable plugins */ |
22 | #define PLUGIN_BUFFER_SIZE 0x80000 | 22 | #define PLUGIN_BUFFER_SIZE 0x80000 |
23 | 23 | ||
24 | #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ | ||
25 | |||
24 | #ifndef SIMULATOR | 26 | #ifndef SIMULATOR |
25 | 27 | ||
26 | /* Define this if you have a TCC730 (CalmRISC16) */ | 28 | /* Define this if you have a TCC730 (CalmRISC16) */ |
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 62d262c16b..942f18adf3 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h | |||
@@ -58,6 +58,8 @@ | |||
58 | /* The number of bytes reserved for loadable plugins */ | 58 | /* The number of bytes reserved for loadable plugins */ |
59 | #define PLUGIN_BUFFER_SIZE 0x80000 | 59 | #define PLUGIN_BUFFER_SIZE 0x80000 |
60 | 60 | ||
61 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | ||
62 | |||
61 | #define AB_REPEAT_ENABLE 1 | 63 | #define AB_REPEAT_ENABLE 1 |
62 | 64 | ||
63 | #define CONFIG_TUNER TEA5767 | 65 | #define CONFIG_TUNER TEA5767 |
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index a577a369c7..186203c648 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h | |||
@@ -64,6 +64,8 @@ | |||
64 | /* define this if you have recording possibility */ | 64 | /* define this if you have recording possibility */ |
65 | #define HAVE_RECORDING 1 | 65 | #define HAVE_RECORDING 1 |
66 | 66 | ||
67 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | ||
68 | |||
67 | #ifndef SIMULATOR | 69 | #ifndef SIMULATOR |
68 | 70 | ||
69 | /* Define this if you have a Motorola SCF5249 */ | 71 | /* Define this if you have a Motorola SCF5249 */ |
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 947a42e776..ae1940c987 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -64,6 +64,8 @@ | |||
64 | /* define this if you have recording possibility */ | 64 | /* define this if you have recording possibility */ |
65 | #define HAVE_RECORDING 1 | 65 | #define HAVE_RECORDING 1 |
66 | 66 | ||
67 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | ||
68 | |||
67 | #ifndef SIMULATOR | 69 | #ifndef SIMULATOR |
68 | 70 | ||
69 | /* Define this if you have a Motorola SCF5249 */ | 71 | /* Define this if you have a Motorola SCF5249 */ |
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 2a16bafc07..4690feb8fe 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h | |||
@@ -53,6 +53,8 @@ | |||
53 | /* The number of bytes reserved for loadable plugins */ | 53 | /* The number of bytes reserved for loadable plugins */ |
54 | #define PLUGIN_BUFFER_SIZE 0x80000 | 54 | #define PLUGIN_BUFFER_SIZE 0x80000 |
55 | 55 | ||
56 | #define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */ | ||
57 | |||
56 | #ifndef SIMULATOR | 58 | #ifndef SIMULATOR |
57 | 59 | ||
58 | /* Define this if you have a Motorola SCF5250 */ | 60 | /* Define this if you have a Motorola SCF5250 */ |
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 62950b8d09..a611dfdcaa 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h | |||
@@ -50,6 +50,8 @@ | |||
50 | /* Define this for LCD backlight available */ | 50 | /* Define this for LCD backlight available */ |
51 | #define CONFIG_BACKLIGHT BL_IPOD3G /* port controlled */ | 51 | #define CONFIG_BACKLIGHT BL_IPOD3G /* port controlled */ |
52 | 52 | ||
53 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ | ||
54 | |||
53 | #ifndef SIMULATOR | 55 | #ifndef SIMULATOR |
54 | 56 | ||
55 | /* Define this if you have a PortalPlayer PP5002 */ | 57 | /* Define this if you have a PortalPlayer PP5002 */ |
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 68b5d5f3b9..fa664acdb6 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h | |||
@@ -52,6 +52,8 @@ | |||
52 | /* Define this for LCD backlight available */ | 52 | /* Define this for LCD backlight available */ |
53 | #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ | 53 | #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ |
54 | 54 | ||
55 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ | ||
56 | |||
55 | #ifndef SIMULATOR | 57 | #ifndef SIMULATOR |
56 | 58 | ||
57 | /* Define this if you have a PortalPlayer PP5020 */ | 59 | /* Define this if you have a PortalPlayer PP5020 */ |
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 7da7f0fc4e..b8f3d89346 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h | |||
@@ -51,6 +51,8 @@ | |||
51 | /* Define this for LCD backlight available */ | 51 | /* Define this for LCD backlight available */ |
52 | #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ | 52 | #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ |
53 | 53 | ||
54 | #define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */ | ||
55 | |||
54 | #ifndef SIMULATOR | 56 | #ifndef SIMULATOR |
55 | 57 | ||
56 | /* Define this if you have a PortalPlayer PP5020 */ | 58 | /* Define this if you have a PortalPlayer PP5020 */ |
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 047c9926ef..64be801577 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h | |||
@@ -52,6 +52,8 @@ | |||
52 | /* Define this for LCD backlight available */ | 52 | /* Define this for LCD backlight available */ |
53 | #define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */ | 53 | #define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */ |
54 | 54 | ||
55 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ | ||
56 | |||
55 | #ifndef SIMULATOR | 57 | #ifndef SIMULATOR |
56 | 58 | ||
57 | /* Define this if you have a PortalPlayer PP5020 */ | 59 | /* Define this if you have a PortalPlayer PP5020 */ |
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index cd3daa9b81..454309a786 100755 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h | |||
@@ -55,6 +55,8 @@ | |||
55 | /* We can fade the backlight by using PWM */ | 55 | /* We can fade the backlight by using PWM */ |
56 | #define HAVE_BACKLIGHT_PWM_FADING | 56 | #define HAVE_BACKLIGHT_PWM_FADING |
57 | 57 | ||
58 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ | ||
59 | |||
58 | #ifndef SIMULATOR | 60 | #ifndef SIMULATOR |
59 | 61 | ||
60 | /* Define this if you have a PortalPlayer PP5020 */ | 62 | /* Define this if you have a PortalPlayer PP5020 */ |
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 026355af60..b7116bf249 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h | |||
@@ -54,6 +54,8 @@ | |||
54 | /* We can fade the backlight by using PWM */ | 54 | /* We can fade the backlight by using PWM */ |
55 | #define HAVE_BACKLIGHT_PWM_FADING | 55 | #define HAVE_BACKLIGHT_PWM_FADING |
56 | 56 | ||
57 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | ||
58 | |||
57 | #ifndef SIMULATOR | 59 | #ifndef SIMULATOR |
58 | 60 | ||
59 | /* The Nano actually has a PP5021 - but it's register compatible with | 61 | /* The Nano actually has a PP5021 - but it's register compatible with |
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 54b32265e1..1bbcfec157 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -54,6 +54,8 @@ | |||
54 | /* We can fade the backlight by using PWM */ | 54 | /* We can fade the backlight by using PWM */ |
55 | #define HAVE_BACKLIGHT_PWM_FADING | 55 | #define HAVE_BACKLIGHT_PWM_FADING |
56 | 56 | ||
57 | #define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */ | ||
58 | |||
57 | #ifndef SIMULATOR | 59 | #ifndef SIMULATOR |
58 | 60 | ||
59 | /* The Nano actually has a PP5021 - but it's register compatible with | 61 | /* The Nano actually has a PP5021 - but it's register compatible with |
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index acaba63264..cb2033a9dc 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h | |||
@@ -28,6 +28,8 @@ | |||
28 | /* Define this if you have a MAS3587F */ | 28 | /* Define this if you have a MAS3587F */ |
29 | #define CONFIG_CODEC MAS3587F | 29 | #define CONFIG_CODEC MAS3587F |
30 | 30 | ||
31 | #define BATTERY_CAPACITY_DEFAULT 500 /* default battery capacity */ | ||
32 | |||
31 | #ifndef SIMULATOR | 33 | #ifndef SIMULATOR |
32 | 34 | ||
33 | /* Define this if you have a SH7034 */ | 35 | /* Define this if you have a SH7034 */ |
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index 567bc0a161..3612300353 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h | |||
@@ -21,6 +21,8 @@ | |||
21 | /* Define this if you have a MAS3539F */ | 21 | /* Define this if you have a MAS3539F */ |
22 | #define CONFIG_CODEC MAS3539F | 22 | #define CONFIG_CODEC MAS3539F |
23 | 23 | ||
24 | #define BATTERY_CAPACITY_DEFAULT 500 /* default battery capacity */ | ||
25 | |||
24 | #ifndef SIMULATOR | 26 | #ifndef SIMULATOR |
25 | 27 | ||
26 | /* Define this if you have a SH7034 */ | 28 | /* Define this if you have a SH7034 */ |
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index d587a8aa89..324a0a2300 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h | |||
@@ -23,6 +23,8 @@ | |||
23 | /* Define this for LCD backlight available */ | 23 | /* Define this for LCD backlight available */ |
24 | #define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ | 24 | #define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ |
25 | 25 | ||
26 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ | ||
27 | |||
26 | #ifndef SIMULATOR | 28 | #ifndef SIMULATOR |
27 | 29 | ||
28 | /* Define this if you have a SH7034 */ | 30 | /* Define this if you have a SH7034 */ |
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index e4865d7e8f..92dd07695d 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h | |||
@@ -38,6 +38,8 @@ | |||
38 | /* Define this for LCD backlight available */ | 38 | /* Define this for LCD backlight available */ |
39 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 39 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ |
40 | 40 | ||
41 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ | ||
42 | |||
41 | #ifndef SIMULATOR | 43 | #ifndef SIMULATOR |
42 | 44 | ||
43 | /* Define this if you have a SH7034 */ | 45 | /* Define this if you have a SH7034 */ |
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index eed46f2823..b508836080 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h | |||
@@ -41,6 +41,8 @@ | |||
41 | /* Define this for LCD backlight available */ | 41 | /* Define this for LCD backlight available */ |
42 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 42 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ |
43 | 43 | ||
44 | #define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */ | ||
45 | |||
44 | #ifndef SIMULATOR | 46 | #ifndef SIMULATOR |
45 | 47 | ||
46 | /* Define this if you have a SH7034 */ | 48 | /* Define this if you have a SH7034 */ |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index fb2d886042..4c6db6d44c 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -185,7 +185,7 @@ static const short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | |||
185 | #else /* NiMH */ | 185 | #else /* NiMH */ |
186 | /* original values were taken directly after charging, but it should show | 186 | /* original values were taken directly after charging, but it should show |
187 | 100% after turning off the device for some hours, too */ | 187 | 100% after turning off the device for some hours, too */ |
188 | { 450, 481, 491, 497, 503, 507, 512, 514, 517, 525, 540 } | 188 | { 450, 481, 491, 497, 503, 507, 512, 514, 517, 525, 540 } |
189 | /* orig. values: ...,528,560 */ | 189 | /* orig. values: ...,528,560 */ |
190 | #endif | 190 | #endif |
191 | }; | 191 | }; |
@@ -197,7 +197,7 @@ charger_input_state_type charger_input_state IDATA_ATTR; | |||
197 | static const short percent_to_volt_charge[11] = | 197 | static const short percent_to_volt_charge[11] = |
198 | { | 198 | { |
199 | #if CONFIG_BATTERY == BATT_LIPOL1300 | 199 | #if CONFIG_BATTERY == BATT_LIPOL1300 |
200 | /* Calibrated for 1900 mAh Ionity battery (estimated 90% charge when | 200 | /* Calibrated for 1900 mAh Ionity battery (estimated 90% charge when |
201 | entering in trickle-charging). We will never reach 100%. */ | 201 | entering in trickle-charging). We will never reach 100%. */ |
202 | 340, 390, 394, 399, 400, 404, 407, 413, 417, 422, 426 | 202 | 340, 390, 394, 399, 400, 404, 407, 413, 417, 422, 426 |
203 | #else | 203 | #else |
@@ -243,11 +243,11 @@ int pid_i = 0; /* PID integral term */ | |||
243 | */ | 243 | */ |
244 | static unsigned int battery_centivolts;/* filtered battery voltage, centvolts */ | 244 | static unsigned int battery_centivolts;/* filtered battery voltage, centvolts */ |
245 | static unsigned int avgbat; /* average battery voltage (filtering) */ | 245 | static unsigned int avgbat; /* average battery voltage (filtering) */ |
246 | #define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ | 246 | #define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ |
247 | 247 | ||
248 | /* battery level (0-100%) of this minute, updated once per minute */ | 248 | /* battery level (0-100%) of this minute, updated once per minute */ |
249 | static int battery_percent = -1; | 249 | static int battery_percent = -1; |
250 | static int battery_capacity = BATTERY_CAPACITY_MIN; /* default value, mAH */ | 250 | static int battery_capacity = BATTERY_CAPACITY_DEFAULT; /* default value, mAh */ |
251 | static int battery_type = 0; | 251 | static int battery_type = 0; |
252 | 252 | ||
253 | /* Power history: power_history[0] is the newest sample */ | 253 | /* Power history: power_history[0] is the newest sample */ |
@@ -348,7 +348,7 @@ static int voltage_to_percent(int voltage, const short* table) | |||
348 | else | 348 | else |
349 | if (voltage >= table[10]) | 349 | if (voltage >= table[10]) |
350 | return 100; | 350 | return 100; |
351 | else { | 351 | else { |
352 | /* search nearest value */ | 352 | /* search nearest value */ |
353 | int i = 0; | 353 | int i = 0; |
354 | while ((i < 10) && (table[i+1] < voltage)) | 354 | while ((i < 10) && (table[i+1] < voltage)) |
@@ -405,7 +405,7 @@ static void battery_status_update(void) | |||
405 | else | 405 | else |
406 | #endif | 406 | #endif |
407 | { | 407 | { |
408 | powermgmt_est_runningtime_min = level * battery_capacity / 100 | 408 | powermgmt_est_runningtime_min = level * battery_capacity / 100 |
409 | * 60 / runcurrent(); | 409 | * 60 / runcurrent(); |
410 | } | 410 | } |
411 | } | 411 | } |
@@ -515,7 +515,7 @@ static int runcurrent(void) | |||
515 | 515 | ||
516 | /* Check to see whether or not we've received an alarm in the last second */ | 516 | /* Check to see whether or not we've received an alarm in the last second */ |
517 | #ifdef HAVE_ALARM_MOD | 517 | #ifdef HAVE_ALARM_MOD |
518 | static void power_thread_rtc_process(void) | 518 | static void power_thread_rtc_process(void) |
519 | { | 519 | { |
520 | if (rtc_check_alarm_flag()) { | 520 | if (rtc_check_alarm_flag()) { |
521 | rtc_enable_alarm(false); | 521 | rtc_enable_alarm(false); |
@@ -592,7 +592,7 @@ static void power_thread_sleep(int ticks) | |||
592 | } | 592 | } |
593 | break; | 593 | break; |
594 | } | 594 | } |
595 | 595 | ||
596 | #endif /* HAVE_CHARGE_STATE */ | 596 | #endif /* HAVE_CHARGE_STATE */ |
597 | 597 | ||
598 | small_ticks = MIN(HZ/2, ticks); | 598 | small_ticks = MIN(HZ/2, ticks); |
@@ -674,7 +674,7 @@ static void power_thread(void) | |||
674 | 674 | ||
675 | /* initialize the voltages for the exponential filter */ | 675 | /* initialize the voltages for the exponential filter */ |
676 | 676 | ||
677 | avgbat = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR * | 677 | avgbat = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR * |
678 | BATT_AVE_SAMPLES; | 678 | BATT_AVE_SAMPLES; |
679 | battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000; | 679 | battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000; |
680 | 680 | ||
@@ -682,7 +682,7 @@ static void power_thread(void) | |||
682 | fd = -1; | 682 | fd = -1; |
683 | wrcount = 0; | 683 | wrcount = 0; |
684 | #endif | 684 | #endif |
685 | 685 | ||
686 | while (1) | 686 | while (1) |
687 | { | 687 | { |
688 | /* rotate the power history */ | 688 | /* rotate the power history */ |
@@ -690,7 +690,7 @@ static void power_thread(void) | |||
690 | phps = phpd - 1; | 690 | phps = phpd - 1; |
691 | for (i = 0; i < POWER_HISTORY_LEN-1; i++) | 691 | for (i = 0; i < POWER_HISTORY_LEN-1; i++) |
692 | *phpd-- = *phps--; | 692 | *phpd-- = *phps--; |
693 | 693 | ||
694 | /* insert new value at the start, in centivolts 8-) */ | 694 | /* insert new value at the start, in centivolts 8-) */ |
695 | power_history[0] = battery_centivolts; | 695 | power_history[0] = battery_centivolts; |
696 | 696 | ||
@@ -732,7 +732,7 @@ static void power_thread(void) | |||
732 | } else { | 732 | } else { |
733 | charge_state = TOPOFF; | 733 | charge_state = TOPOFF; |
734 | target_voltage = TOPOFF_VOLTAGE; | 734 | target_voltage = TOPOFF_VOLTAGE; |
735 | } | 735 | } |
736 | } else { | 736 | } else { |
737 | /* | 737 | /* |
738 | * Start the charger full strength | 738 | * Start the charger full strength |
@@ -743,8 +743,8 @@ static void power_thread(void) | |||
743 | if (charge_max_time_idle > i) { | 743 | if (charge_max_time_idle > i) { |
744 | charge_max_time_idle = i; | 744 | charge_max_time_idle = i; |
745 | } | 745 | } |
746 | charge_max_time_now = charge_max_time_idle; | 746 | charge_max_time_now = charge_max_time_idle; |
747 | 747 | ||
748 | snprintf(power_message, POWER_MESSAGE_LEN, | 748 | snprintf(power_message, POWER_MESSAGE_LEN, |
749 | "ChgAt %d%% max %dm", battery_level(), | 749 | "ChgAt %d%% max %dm", battery_level(), |
750 | charge_max_time_now); | 750 | charge_max_time_now); |
@@ -895,7 +895,7 @@ static void power_thread(void) | |||
895 | * plugged in, but it doesn't appear to be necessary and will | 895 | * plugged in, but it doesn't appear to be necessary and will |
896 | * generate more heat [gvb]. | 896 | * generate more heat [gvb]. |
897 | */ | 897 | */ |
898 | 898 | ||
899 | pid_p = target_voltage - battery_centivolts; | 899 | pid_p = target_voltage - battery_centivolts; |
900 | if((pid_p > PID_DEADZONE) || (pid_p < -PID_DEADZONE)) | 900 | if((pid_p > PID_DEADZONE) || (pid_p < -PID_DEADZONE)) |
901 | pid_p = pid_p * PID_PCONST; | 901 | pid_p = pid_p * PID_PCONST; |
@@ -980,7 +980,7 @@ static void power_thread(void) | |||
980 | } | 980 | } |
981 | } | 981 | } |
982 | if(fd >= 0) { | 982 | if(fd >= 0) { |
983 | snprintf(debug_message, DEBUG_MESSAGE_LEN, | 983 | snprintf(debug_message, DEBUG_MESSAGE_LEN, |
984 | "%d, %d, %d, %d, %d, %d, %d, %d\n", | 984 | "%d, %d, %d, %d, %d, %d, %d, %d\n", |
985 | powermgmt_last_cycle_startstop_min, battery_centivolts, | 985 | powermgmt_last_cycle_startstop_min, battery_centivolts, |
986 | battery_percent, charger_input_state, charge_state, | 986 | battery_percent, charger_input_state, charge_state, |
@@ -1002,7 +1002,7 @@ void powermgmt_init(void) | |||
1002 | { | 1002 | { |
1003 | /* init history to 0 */ | 1003 | /* init history to 0 */ |
1004 | memset(power_history, 0x00, sizeof(power_history)); | 1004 | memset(power_history, 0x00, sizeof(power_history)); |
1005 | 1005 | ||
1006 | create_thread(power_thread, power_stack, sizeof(power_stack), | 1006 | create_thread(power_thread, power_stack, sizeof(power_stack), |
1007 | power_thread_name); | 1007 | power_thread_name); |
1008 | } | 1008 | } |
@@ -1015,12 +1015,12 @@ void sys_poweroff(void) | |||
1015 | /* If the main thread fails to shut down the system, we will force a | 1015 | /* If the main thread fails to shut down the system, we will force a |
1016 | power off after an 8 second timeout */ | 1016 | power off after an 8 second timeout */ |
1017 | shutdown_timeout = HZ*8; | 1017 | shutdown_timeout = HZ*8; |
1018 | 1018 | ||
1019 | queue_post(&button_queue, SYS_POWEROFF, NULL); | 1019 | queue_post(&button_queue, SYS_POWEROFF, NULL); |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | /* Various hardware housekeeping tasks relating to shutting down the jukebox */ | 1022 | /* Various hardware housekeeping tasks relating to shutting down the jukebox */ |
1023 | void shutdown_hw(void) | 1023 | void shutdown_hw(void) |
1024 | { | 1024 | { |
1025 | #ifndef SIMULATOR | 1025 | #ifndef SIMULATOR |
1026 | #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) | 1026 | #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) |