diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-06-06 22:23:52 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-06-06 22:23:52 +0000 |
commit | 0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f (patch) | |
tree | e3e77d4e6b25b82c82b3570cd8c4a988c7788e66 /apps/plugins | |
parent | 8c9e22580e220b793130ed3ac67b9c54e85b3d0f (diff) | |
download | rockbox-0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f.tar.gz rockbox-0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f.zip |
Work-in-progress rework of charging status reading & display: * Changed several charging related HAVE_* macros into one multi-value CONFIG_CHARGING. * Always use proper macros for charging states. * Battery symbol charging animation now starts from current level on all targets with charging. Two-colour animation kept for non-b&w targets. Round down fill level while charging as before, but round to nearest pixel value for discharging on all targets. * Charging anim fixed on player. * Some code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10080 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/battery_bench.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 552be8a1ac..210ecbd9dd 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c | |||
@@ -128,14 +128,14 @@ void exit_tsr(void) | |||
128 | /* use long for aligning */ | 128 | /* use long for aligning */ |
129 | unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)]; | 129 | unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)]; |
130 | 130 | ||
131 | #if defined(HAVE_CHARGING) || defined(HAVE_USB_POWER) | 131 | #if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) |
132 | unsigned int charge_state(void) | 132 | unsigned int charge_state(void) |
133 | { | 133 | { |
134 | unsigned int ret = 0; | 134 | unsigned int ret = 0; |
135 | #ifdef HAVE_CHARGING | 135 | #ifdef CONFIG_CHARGING |
136 | if(rb->charger_inserted()) | 136 | if(rb->charger_inserted()) |
137 | ret = BIT_CHARGER; | 137 | ret = BIT_CHARGER; |
138 | #ifdef HAVE_CHARGE_STATE | 138 | #if CONFIG_CHARGING == CHARGING_MONITOR |
139 | if(rb->charging_state()) | 139 | if(rb->charging_state()) |
140 | ret |= BIT_CHARGING; | 140 | ret |= BIT_CHARGING; |
141 | #endif | 141 | #endif |
@@ -154,7 +154,7 @@ void thread(void) | |||
154 | int fd, buffelements, tick = 1, i = 0, skipped = 0, exit = 0; | 154 | int fd, buffelements, tick = 1, i = 0, skipped = 0, exit = 0; |
155 | int fst = 0, lst = 0; /* first and last skipped tick */ | 155 | int fst = 0, lst = 0; /* first and last skipped tick */ |
156 | unsigned int last_voltage = 0; | 156 | unsigned int last_voltage = 0; |
157 | #if defined(HAVE_CHARGING) || defined(HAVE_USB_POWER) | 157 | #if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) |
158 | unsigned int last_state = 0; | 158 | unsigned int last_state = 0; |
159 | #endif | 159 | #endif |
160 | long sleep_time; | 160 | long sleep_time; |
@@ -202,9 +202,9 @@ void thread(void) | |||
202 | rb->fdprintf(fd, | 202 | rb->fdprintf(fd, |
203 | "%02d:%02d:%02d, %05d, %03d%%, " | 203 | "%02d:%02d:%02d, %05d, %03d%%, " |
204 | "%02d:%02d, %04d, %04d" | 204 | "%02d:%02d, %04d, %04d" |
205 | #ifdef HAVE_CHARGING | 205 | #ifdef CONFIG_CHARGING |
206 | ", %c" | 206 | ", %c" |
207 | #ifdef HAVE_CHARGE_STATE | 207 | #if CONFIG_CHARGING == CHARGING_MONITOR |
208 | ", %c" | 208 | ", %c" |
209 | #endif | 209 | #endif |
210 | #endif | 210 | #endif |
@@ -215,7 +215,7 @@ void thread(void) | |||
215 | 215 | ||
216 | HMS(secs), secs, bat[j].level, | 216 | HMS(secs), secs, bat[j].level, |
217 | bat[j].eta / 60, bat[j].eta % 60, | 217 | bat[j].eta / 60, bat[j].eta % 60, |
218 | #if defined(HAVE_CHARGING) || defined(HAVE_USB_POWER) | 218 | #if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) |
219 | (bat[j].voltage & | 219 | (bat[j].voltage & |
220 | (~(BIT_CHARGER|BIT_CHARGING|BIT_USB_POWER))) | 220 | (~(BIT_CHARGER|BIT_CHARGING|BIT_USB_POWER))) |
221 | *10, | 221 | *10, |
@@ -223,9 +223,9 @@ void thread(void) | |||
223 | bat[j].voltage * 10, | 223 | bat[j].voltage * 10, |
224 | #endif | 224 | #endif |
225 | temp + 1 + (j-i) | 225 | temp + 1 + (j-i) |
226 | #ifdef HAVE_CHARGING | 226 | #ifdef CONFIG_CHARGING |
227 | ,(bat[j].voltage & BIT_CHARGER)?'A':'-' | 227 | ,(bat[j].voltage & BIT_CHARGER)?'A':'-' |
228 | #ifdef HAVE_CHARGE_STATE | 228 | #if CONFIG_CHARGING == CHARGING_MONITOR |
229 | ,(bat[j].voltage & BIT_CHARGING)?'C':'-' | 229 | ,(bat[j].voltage & BIT_CHARGING)?'C':'-' |
230 | #endif | 230 | #endif |
231 | #endif | 231 | #endif |
@@ -260,7 +260,7 @@ void thread(void) | |||
260 | timeflag = true; | 260 | timeflag = true; |
261 | 261 | ||
262 | if(last_voltage != (current_voltage=rb->battery_voltage()) | 262 | if(last_voltage != (current_voltage=rb->battery_voltage()) |
263 | #if defined(HAVE_CHARGING) || defined(HAVE_USB_POWER) | 263 | #if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) |
264 | || last_state != charge_state() | 264 | || last_state != charge_state() |
265 | #endif | 265 | #endif |
266 | ) | 266 | ) |
@@ -280,7 +280,7 @@ void thread(void) | |||
280 | bat[i].level = rb->battery_level(); | 280 | bat[i].level = rb->battery_level(); |
281 | bat[i].eta = rb->battery_time(); | 281 | bat[i].eta = rb->battery_time(); |
282 | last_voltage = bat[i].voltage = current_voltage; | 282 | last_voltage = bat[i].voltage = current_voltage; |
283 | #if defined(HAVE_CHARGING) || defined(HAVE_USB_POWER) | 283 | #if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER) |
284 | bat[i].voltage |= last_state = charge_state(); | 284 | bat[i].voltage |= last_state = charge_state(); |
285 | #endif | 285 | #endif |
286 | i++; | 286 | i++; |
@@ -421,10 +421,10 @@ int main(void) | |||
421 | "Battery type: %d mAh Buffer Entries: %d\n" | 421 | "Battery type: %d mAh Buffer Entries: %d\n" |
422 | " Time:, Seconds:, Level:, Time Left:, Voltage[mV]:," | 422 | " Time:, Seconds:, Level:, Time Left:, Voltage[mV]:," |
423 | " M/DA:" | 423 | " M/DA:" |
424 | #ifdef HAVE_CHARGING | 424 | #ifdef CONFIG_CHARGING |
425 | ", C:" | 425 | ", C:" |
426 | #endif | 426 | #endif |
427 | #ifdef HAVE_CHARGE_STATE | 427 | #if CONFIG_CHARGING == CHARGING_MONITOR |
428 | ", S:" | 428 | ", S:" |
429 | #endif | 429 | #endif |
430 | #ifdef HAVE_USB_POWER | 430 | #ifdef HAVE_USB_POWER |