diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2011-07-19 20:48:16 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2011-07-19 20:48:16 +0000 |
commit | aa27d47782ad57fe586bd18988c64dd0f005421c (patch) | |
tree | 5bd3585d87db1b75da25954c1cf2e3be5ae7d978 | |
parent | 354d8fbc63f861401b402f96975a5ab3e27d1dff (diff) | |
download | rockbox-aa27d47782ad57fe586bd18988c64dd0f005421c.tar.gz rockbox-aa27d47782ad57fe586bd18988c64dd0f005421c.zip |
Set the default battery capacity for ipod video properly depending on detected RAM size.
Also set up a callback for the battery capacity setting (for all players) so changes take effect without having to reboot.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30170 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/settings_list.c | 12 | ||||
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/export/config/ipodvideo.h | 7 | ||||
-rw-r--r-- | firmware/target/arm/ipod/video/battery-video.c | 33 | ||||
-rw-r--r-- | firmware/target/arm/system-target.h | 1 | ||||
-rw-r--r-- | manual/configure_rockbox/system_options.tex | 6 |
6 files changed, 52 insertions, 8 deletions
diff --git a/apps/settings_list.c b/apps/settings_list.c index 019a14437e..62a2d94afa 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -784,10 +784,20 @@ const struct settings_list settings[] = { | |||
784 | #define BATTERY_CAPACITY_MAX BATTERY_CAPACITY_DEFAULT | 784 | #define BATTERY_CAPACITY_MAX BATTERY_CAPACITY_DEFAULT |
785 | #define BATTERY_CAPACITY_INC 0 | 785 | #define BATTERY_CAPACITY_INC 0 |
786 | #endif | 786 | #endif |
787 | #ifdef IPOD_VIDEO | ||
788 | /* its easier to leave this one un-macro()ed for the time being */ | ||
789 | { F_T_INT|F_DEF_ISFUNC|F_INT_SETTING, &global_settings.battery_capacity, | ||
790 | LANG_BATTERY_CAPACITY, FUNCTYPE(battery_default_capacity), | ||
791 | "battery capacity", NULL , { | ||
792 | .int_setting = (struct int_setting[]) { | ||
793 | { set_battery_capacity, UNIT_MAH, BATTERY_CAPACITY_MIN, | ||
794 | BATTERY_CAPACITY_MAX, BATTERY_CAPACITY_INC, NULL, NULL }}}}, | ||
795 | #else /* IPOD_VIDEO */ | ||
787 | INT_SETTING(0, battery_capacity, LANG_BATTERY_CAPACITY, | 796 | INT_SETTING(0, battery_capacity, LANG_BATTERY_CAPACITY, |
788 | BATTERY_CAPACITY_DEFAULT, "battery capacity", UNIT_MAH, | 797 | BATTERY_CAPACITY_DEFAULT, "battery capacity", UNIT_MAH, |
789 | BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX, | 798 | BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX, |
790 | BATTERY_CAPACITY_INC, NULL, NULL, NULL), | 799 | BATTERY_CAPACITY_INC, NULL, NULL, set_battery_capacity), |
800 | #endif /* IPOD_VIDEO */ | ||
791 | #endif | 801 | #endif |
792 | #if CONFIG_CHARGING | 802 | #if CONFIG_CHARGING |
793 | OFFON_SETTING(NVRAM(1), car_adapter_mode, | 803 | OFFON_SETTING(NVRAM(1), car_adapter_mode, |
diff --git a/firmware/SOURCES b/firmware/SOURCES index 4aef86f002..28e72e8bef 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1188,6 +1188,7 @@ target/arm/ipod/power-ipod.c | |||
1188 | target/arm/ipod/powermgmt-ipod-pcf.c | 1188 | target/arm/ipod/powermgmt-ipod-pcf.c |
1189 | target/arm/ipod/video/lcd-as-video.S | 1189 | target/arm/ipod/video/lcd-as-video.S |
1190 | target/arm/ipod/video/lcd-video.c | 1190 | target/arm/ipod/video/lcd-video.c |
1191 | target/arm/ipod/video/battery-video.c | ||
1191 | target/arm/usb-fw-pp502x.c | 1192 | target/arm/usb-fw-pp502x.c |
1192 | #endif /* SIMULATOR */ | 1193 | #endif /* SIMULATOR */ |
1193 | #endif /* IPOD_VIDEO */ | 1194 | #endif /* IPOD_VIDEO */ |
diff --git a/firmware/export/config/ipodvideo.h b/firmware/export/config/ipodvideo.h index 124f788860..dd21bb518a 100644 --- a/firmware/export/config/ipodvideo.h +++ b/firmware/export/config/ipodvideo.h | |||
@@ -136,8 +136,11 @@ | |||
136 | #define HAVE_HEADPHONE_DETECTION | 136 | #define HAVE_HEADPHONE_DETECTION |
137 | 137 | ||
138 | /* Type of mobile power */ | 138 | /* Type of mobile power */ |
139 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity for the */ | 139 | #define BATTERY_CAPACITY_DEFAULT 400 /* only for variable initialisation */ |
140 | /* 30GB model. 60/80GB would have 600 */ | 140 | #define BATTERY_CAPACITY_DEFAULT_THIN 400 /* default battery capacity for the |
141 | 30GB model */ | ||
142 | #define BATTERY_CAPACITY_DEFAULT_THICK 600 /* default battery capacity for the | ||
143 | 60/80GB model */ | ||
141 | #define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */ | 144 | #define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */ |
142 | #define BATTERY_CAPACITY_MAX 1400 /* max. capacity selectable */ | 145 | #define BATTERY_CAPACITY_MAX 1400 /* max. capacity selectable */ |
143 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | 146 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ |
diff --git a/firmware/target/arm/ipod/video/battery-video.c b/firmware/target/arm/ipod/video/battery-video.c new file mode 100644 index 0000000000..b4c460284b --- /dev/null +++ b/firmware/target/arm/ipod/video/battery-video.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id $ | ||
9 | * | ||
10 | * Default battery capacity for ipod video | ||
11 | * | ||
12 | * Copyright (c) 2011 Frank Gevaerts | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "system.h" | ||
26 | |||
27 | int battery_default_capacity(void) | ||
28 | { | ||
29 | if(probed_ramsize==64) | ||
30 | return BATTERY_CAPACITY_DEFAULT_THICK; | ||
31 | else | ||
32 | return BATTERY_CAPACITY_DEFAULT_THIN; | ||
33 | } | ||
diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h index eb2a07f7d3..e5a8b15f64 100644 --- a/firmware/target/arm/system-target.h +++ b/firmware/target/arm/system-target.h | |||
@@ -173,6 +173,7 @@ static inline void wake_core(int core) | |||
173 | 173 | ||
174 | #if defined(IPOD_VIDEO) && !defined(BOOTLOADER) | 174 | #if defined(IPOD_VIDEO) && !defined(BOOTLOADER) |
175 | extern unsigned char probed_ramsize; | 175 | extern unsigned char probed_ramsize; |
176 | int battery_default_capacity(void); | ||
176 | #endif | 177 | #endif |
177 | 178 | ||
178 | 179 | ||
diff --git a/manual/configure_rockbox/system_options.tex b/manual/configure_rockbox/system_options.tex index 9f47a7f63a..f53fa50406 100644 --- a/manual/configure_rockbox/system_options.tex +++ b/manual/configure_rockbox/system_options.tex | |||
@@ -39,7 +39,7 @@ | |||
39 | \opt{ipodmini}{400~mAh (1G) or 630~mAh (2G)}% | 39 | \opt{ipodmini}{400~mAh (1G) or 630~mAh (2G)}% |
40 | \opt{ipodcolor}{700~mAh}% | 40 | \opt{ipodcolor}{700~mAh}% |
41 | \opt{ipodnano}{300~mAh}% | 41 | \opt{ipodnano}{300~mAh}% |
42 | \opt{ipodvideo}{400~mAh}% | 42 | \opt{ipodvideo}{400~mAh (30~GB) or 600~mAh (60~GB and 80~GB)}% |
43 | \opt{ipod4g}{630~mAh}% | 43 | \opt{ipod4g}{630~mAh}% |
44 | \opt{ipod3g}{630~mAh}% | 44 | \opt{ipod3g}{630~mAh}% |
45 | \opt{ipod1g2g}{1200~mAh}% | 45 | \opt{ipod1g2g}{1200~mAh}% |
@@ -53,10 +53,6 @@ | |||
53 | calculation. Changing this setting has no effect whatsoever on | 53 | calculation. Changing this setting has no effect whatsoever on |
54 | actual battery life. This setting only affects the accuracy of the | 54 | actual battery life. This setting only affects the accuracy of the |
55 | runtime estimation as shown on screen. | 55 | runtime estimation as shown on screen. |
56 | \opt{ipodvideo}{Rockbox does not automatically distinguish | ||
57 | between the 60/80~GB models and the 30~GB models which determine the | ||
58 | default value. If your \dap{} is a 60~GB or 80~GB model | ||
59 | set the value to 600~mAh for more accuracy in the runtime estimation.} | ||
60 | \opt{iaudiom3,iaudiom5,iaudiox5}{Rockbox does not automatically distinguish | 56 | \opt{iaudiom3,iaudiom5,iaudiox5}{Rockbox does not automatically distinguish |
61 | between the ``L'' models and the ``simple'' models which determine the | 57 | between the ``L'' models and the ``simple'' models which determine the |
62 | default value. If your \dap{} is an | 58 | default value. If your \dap{} is an |