summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c18
-rw-r--r--apps/gui/gwps-common.c6
-rw-r--r--apps/gui/statusbar.c228
-rw-r--r--apps/gui/statusbar.h26
-rw-r--r--apps/main.c6
-rw-r--r--apps/main_menu.c8
-rw-r--r--apps/misc.c6
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/plugin.h4
-rw-r--r--apps/plugins/battery_bench.c26
-rw-r--r--apps/screens.c16
-rw-r--r--apps/settings.c10
-rw-r--r--apps/settings_menu.c14
-rw-r--r--apps/status.c6
-rw-r--r--apps/status.h6
-rw-r--r--apps/tree.c4
16 files changed, 182 insertions, 208 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index fac570d39a..d426356d11 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1334,8 +1334,8 @@ bool view_battery(void)
1334 snprintf(buf, 30, "External: %d.%02d V", y / 100, y % 100); 1334 snprintf(buf, 30, "External: %d.%02d V", y / 100, y % 100);
1335 lcd_puts(0, 2, buf); 1335 lcd_puts(0, 2, buf);
1336#endif 1336#endif
1337#ifdef HAVE_CHARGING 1337#ifdef CONFIG_CHARGING
1338#ifdef HAVE_CHARGE_CTRL 1338#if CONFIG_CHARGING == CHARGING_CONTROL
1339 snprintf(buf, 30, "Chgr: %s %s", 1339 snprintf(buf, 30, "Chgr: %s %s",
1340 charger_inserted() ? "present" : "absent", 1340 charger_inserted() ? "present" : "absent",
1341 charger_enabled ? "on" : "off"); 1341 charger_enabled ? "on" : "off");
@@ -1345,8 +1345,8 @@ bool view_battery(void)
1345 snprintf(buf, 30, "long delta: %d", long_delta); 1345 snprintf(buf, 30, "long delta: %d", long_delta);
1346 lcd_puts(0, 6, buf); 1346 lcd_puts(0, 6, buf);
1347 lcd_puts(0, 7, power_message); 1347 lcd_puts(0, 7, power_message);
1348#else /* !HAVE_CHARGE_CTRL */ 1348#else /* CONFIG_CHARGING != CHARGING_CONTROL */
1349#if defined IPOD_NANO || defined IPOD_VIDEO 1349#if defined IPOD_NANO || defined IPOD_VIDEO
1350 int usb_pwr = (GPIOL_INPUT_VAL & 0x10)?true:false; 1350 int usb_pwr = (GPIOL_INPUT_VAL & 0x10)?true:false;
1351 int ext_pwr = (GPIOL_INPUT_VAL & 0x08)?false:true; 1351 int ext_pwr = (GPIOL_INPUT_VAL & 0x08)?false:true;
1352 int dock = (GPIOA_INPUT_VAL & 0x10)?true:false; 1352 int dock = (GPIOA_INPUT_VAL & 0x10)?true:false;
@@ -1373,8 +1373,8 @@ bool view_battery(void)
1373 charger_inserted() ? "present" : "absent"); 1373 charger_inserted() ? "present" : "absent");
1374 lcd_puts(0, 3, buf); 1374 lcd_puts(0, 3, buf);
1375#endif 1375#endif
1376#endif /* !HAVE_CHARGE_CTRL */ 1376#endif /* CONFIG_CHARGING != CHARGING_CONTROL */
1377#endif /* HAVE_CHARGING */ 1377#endif /* CONFIG_CHARGING */
1378 break; 1378 break;
1379 1379
1380 case 2: /* voltage deltas: */ 1380 case 2: /* voltage deltas: */
@@ -1393,7 +1393,7 @@ bool view_battery(void)
1393 case 3: /* remaining time estimation: */ 1393 case 3: /* remaining time estimation: */
1394 lcd_clear_display(); 1394 lcd_clear_display();
1395 1395
1396#ifdef HAVE_CHARGE_CTRL 1396#if CONFIG_CHARGING == CHARGING_CONTROL
1397 snprintf(buf, 30, "charge_state: %d", charge_state); 1397 snprintf(buf, 30, "charge_state: %d", charge_state);
1398 lcd_puts(0, 0, buf); 1398 lcd_puts(0, 0, buf);
1399 1399
@@ -1408,7 +1408,7 @@ bool view_battery(void)
1408 1408
1409 snprintf(buf, 30, "Trickle sec: %d/60", trickle_sec); 1409 snprintf(buf, 30, "Trickle sec: %d/60", trickle_sec);
1410 lcd_puts(0, 4, buf); 1410 lcd_puts(0, 4, buf);
1411#endif /* HAVE_CHARGE_CTRL */ 1411#endif /* CONFIG_CHARGING == CHARGING_CONTROL */
1412 1412
1413 snprintf(buf, 30, "Last PwrHist: %d.%02d V", 1413 snprintf(buf, 30, "Last PwrHist: %d.%02d V",
1414 power_history[0] / 100, 1414 power_history[0] / 100,
@@ -1465,7 +1465,7 @@ static bool view_runtime(void)
1465#endif 1465#endif
1466 1466
1467 if (state & 1) { 1467 if (state & 1) {
1468#ifdef HAVE_CHARGING 1468#ifdef CONFIG_CHARGING
1469 if (charger_inserted() 1469 if (charger_inserted()
1470#ifdef HAVE_USB_POWER 1470#ifdef HAVE_USB_POWER
1471 || usb_powered() 1471 || usb_powered()
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 5ab6ce8c82..171784c0ad 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -823,7 +823,7 @@ static char* get_tag(struct wps_data* wps_data,
823 } 823 }
824 } 824 }
825 825
826#ifdef HAVE_CHARGING 826#ifdef CONFIG_CHARGING
827 case 'p': /* External power plugged in? */ 827 case 'p': /* External power plugged in? */
828 { 828 {
829 if(charger_input_state==CHARGER) 829 if(charger_input_state==CHARGER)
@@ -832,9 +832,7 @@ static char* get_tag(struct wps_data* wps_data,
832 return NULL; 832 return NULL;
833 } 833 }
834#endif 834#endif
835#if defined(HAVE_CHARGE_CTRL) || \ 835#if CONFIG_CHARGING >= CHARGING_MONITOR
836 defined (HAVE_CHARGE_STATE) || \
837 CONFIG_BATTERY == BATT_LIION2200
838 case 'c': /* Charging */ 836 case 'c': /* Charging */
839 { 837 {
840 if (charge_state == CHARGING || charge_state == TOPOFF) { 838 if (charge_state == CHARGING || charge_state == TOPOFF) {
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index c9b27aea7c..b5d8b7c9ed 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -107,37 +107,73 @@ struct gui_syncstatusbar statusbars;
107 107
108void gui_statusbar_init(struct gui_statusbar * bar) 108void gui_statusbar_init(struct gui_statusbar * bar)
109{ 109{
110 bar->last_volume = -1000; /* -1000 means "first update ever" */ 110 bar->redraw_volume = true;
111 bar->battery_icon_switch_tick = 0; 111 bar->volume_icon_switch_tick = bar->battery_icon_switch_tick = current_tick;
112 bar->animated_level = 0;
113} 112}
114 113
115void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) 114void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
116{ 115{
117 struct screen * display = bar->display; 116 struct screen * display = bar->display;
118#ifdef CONFIG_RTC
119 struct tm* tm; /* For Time */
120#endif /* CONFIG_RTC */
121 117
122#ifdef HAVE_LCD_CHARCELLS 118#ifdef HAVE_LCD_CHARCELLS
123 int vol; 119 int val;
124 (void)force_redraw; /* players always "redraw" */ 120 (void)force_redraw; /* players always "redraw" */
125#endif /* HAVE_LCD_CHARCELLS */ 121#endif /* HAVE_LCD_CHARCELLS */
126 122
127 bar->info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume); 123 bar->info.battlevel = battery_level();
128#ifdef HAVE_CHARGING 124#ifdef HAVE_USB_POWER
125 bar->info.usb_power = usb_powered();
126#endif
127#ifdef CONFIG_CHARGING
129 bar->info.inserted = (charger_input_state == CHARGER); 128 bar->info.inserted = (charger_input_state == CHARGER);
129 if (bar->info.inserted)
130 {
131 bar->info.battery_state = true;
132
133#if CONFIG_CHARGING >= CHARGING_MONITOR
134
135 /* zero battery run time if charging */
136 if (charge_state > DISCHARGING)
137 lasttime = current_tick;
138
139 /* animate battery if charging */
140 if ((charge_state == DISCHARGING) || (charge_state == TRICKLE))
141 {
142 bar->info.batt_charge_step = -1;
143 }
144 else
145 {
146#else
147 lasttime = current_tick;
148 {
130#endif 149#endif
131 bar->info.battlevel = battery_level(); 150 /* animate in (max.) 4 steps, starting near the current charge level */
132 bar->info.battery_safe = battery_level_safe(); 151 if (TIME_AFTER(current_tick, bar->battery_icon_switch_tick))
152 {
153 if (++bar->info.batt_charge_step > 3)
154 bar->info.batt_charge_step = bar->info.battlevel / 34;
155 bar->battery_icon_switch_tick = current_tick + HZ;
156 }
157 }
158 }
159 else
160#endif
161 {
162 bar->info.batt_charge_step = -1;
163 if (battery_level_safe())
164 bar->info.battery_state = true;
165 else
166 /* blink battery if level is low */
167 if (TIME_AFTER(current_tick, bar->battery_icon_switch_tick) &&
168 (bar->info.battlevel > -1))
169 {
170 bar->info.battery_state = !bar->info.battery_state;
171 bar->battery_icon_switch_tick = current_tick + HZ;
172 }
173 }
133 174
175 bar->info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume);
134#ifdef HAVE_LCD_BITMAP 176#ifdef HAVE_LCD_BITMAP
135#ifdef CONFIG_RTC
136 tm = get_time();
137 bar->info.hour = tm->tm_hour;
138 bar->info.minute = tm->tm_min;
139#endif /* CONFIG_RTC */
140
141 bar->info.shuffle = global_settings.playlist_shuffle; 177 bar->info.shuffle = global_settings.playlist_shuffle;
142#ifdef HAS_BUTTON_HOLD 178#ifdef HAS_BUTTON_HOLD
143 bar->info.keylock = button_hold(); 179 bar->info.keylock = button_hold();
@@ -149,24 +185,25 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
149#endif 185#endif
150 bar->info.repeat = global_settings.repeat_mode; 186 bar->info.repeat = global_settings.repeat_mode;
151 bar->info.playmode = current_playmode(); 187 bar->info.playmode = current_playmode();
188
152#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) 189#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
153 if(!display->has_disk_led) 190 if(!display->has_disk_led)
154 bar->info.led = led_read(HZ/2); /* delay should match polling interval */ 191 bar->info.led = led_read(HZ/2); /* delay should match polling interval */
155#endif 192#endif
156 193#ifdef CONFIG_RTC
157#ifdef HAVE_USB_POWER 194 {
158 bar->info.usb_power = usb_powered(); 195 struct tm* tm = get_time();
159#endif /* HAVE_USB_POWER */ 196 bar->info.hour = tm->tm_hour;
197 bar->info.minute = tm->tm_min;
198 }
199#endif /* CONFIG_RTC */
160 200
161 /* only redraw if forced to, or info has changed */ 201 /* only redraw if forced to, or info has changed */
162 if (force_redraw || 202 if (force_redraw || bar->redraw_volume ||
163 bar->info.inserted ||
164 !bar->info.battery_safe ||
165 bar->info.redraw_volume ||
166 memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) 203 memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
167 { 204 {
168 display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 205 display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
169 display->fillrect(0,0,display->width,8); 206 display->fillrect(0, 0, display->width, STATUSBAR_HEIGHT);
170 display->set_drawmode(DRMODE_SOLID); 207 display->set_drawmode(DRMODE_SOLID);
171 208
172#else 209#else
@@ -175,65 +212,10 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
175 { 212 {
176#endif /* HAVE_LCD_BITMAP */ 213#endif /* HAVE_LCD_BITMAP */
177 214
178#ifdef HAVE_CHARGING
179 if (bar->info.inserted) {
180 battery_state = true;
181#if defined(HAVE_CHARGE_CTRL) || \
182 defined(HAVE_CHARGE_STATE) || \
183 CONFIG_BATTERY == BATT_LIION2200
184 /* zero battery run time if charging */
185 if (charge_state > DISCHARGING) {
186 lasttime = current_tick;
187 }
188
189 /* animate battery if charging */
190 if ((charge_state == CHARGING)
191#ifdef HAVE_CHARGE_CTRL
192 || (charge_state == TOPOFF)
193#endif
194 ) {
195#else
196 lasttime = current_tick;
197 {
198#endif
199 /* animate in three steps (34% per step for a better look) */
200#ifndef HAVE_CHARGE_STATE
201 bar->info.battlevel = 0;
202#endif
203 if(TIME_AFTER(current_tick, bar->battery_icon_switch_tick)) {
204 if (bar->animated_level == 100)
205 {
206 bar->animated_level = bar->info.battlevel;
207 }
208 else
209 {
210 bar->animated_level += 34;
211 if (bar->animated_level > 100)
212 bar->animated_level = 100;
213 }
214 bar->battery_icon_switch_tick = current_tick + HZ;
215 }
216 }
217 }
218 else
219#endif /* HAVE_CHARGING */
220 {
221 bar->animated_level = 0;
222 if (bar->info.battery_safe)
223 battery_state = true;
224 else {
225 /* blink battery if level is low */
226 if(TIME_AFTER(current_tick, bar->battery_icon_switch_tick) &&
227 (bar->info.battlevel > -1)) {
228 bar->battery_icon_switch_tick = current_tick+HZ;
229 battery_state = !battery_state;
230 }
231 }
232 }
233#ifdef HAVE_LCD_BITMAP 215#ifdef HAVE_LCD_BITMAP
234 if (battery_state) 216 if (bar->info.battery_state)
235 gui_statusbar_icon_battery(display, bar->info.battlevel, 217 gui_statusbar_icon_battery(display, bar->info.battlevel,
236 bar->animated_level); 218 bar->info.batt_charge_step);
237#ifdef HAVE_USB_POWER 219#ifdef HAVE_USB_POWER
238 if (bar->info.usb_power) 220 if (bar->info.usb_power)
239 display->mono_bitmap(bitmap_icons_7x8[Icon_USBPlug], 221 display->mono_bitmap(bitmap_icons_7x8[Icon_USBPlug],
@@ -243,14 +225,15 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
243 else 225 else
244#endif /* HAVE_USB_POWER */ 226#endif /* HAVE_USB_POWER */
245 /* draw power plug if charging */ 227 /* draw power plug if charging */
228#ifdef CONFIG_CHARGING
246 if (bar->info.inserted) 229 if (bar->info.inserted)
247 display->mono_bitmap(bitmap_icons_7x8[Icon_Plug], 230 display->mono_bitmap(bitmap_icons_7x8[Icon_Plug],
248 STATUSBAR_PLUG_X_POS, 231 STATUSBAR_PLUG_X_POS,
249 STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH, 232 STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH,
250 STATUSBAR_HEIGHT); 233 STATUSBAR_HEIGHT);
234#endif
251 235
252 bar->info.redraw_volume = gui_statusbar_icon_volume(bar, 236 bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume);
253 bar->info.volume);
254 gui_statusbar_icon_play_state(display, current_playmode() + 237 gui_statusbar_icon_play_state(display, current_playmode() +
255 Icon_Play); 238 Icon_Play);
256 239
@@ -292,20 +275,24 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
292 275
293 276
294#ifdef HAVE_LCD_CHARCELLS 277#ifdef HAVE_LCD_CHARCELLS
295 if (bar->info.battlevel > -1) 278 display->icon(ICON_BATTERY, bar->info.battery_state);
296 display->icon(ICON_BATTERY, battery_state); 279
297 display->icon(ICON_BATTERY_1, bar->info.battlevel > 25); 280 if (bar->info.batt_charge_step > -1)
298 display->icon(ICON_BATTERY_2, bar->info.battlevel > 50); 281 val = bar->info.batt_charge_step;
299 display->icon(ICON_BATTERY_3, bar->info.battlevel > 75); 282 else
300 283 val = (bar->info.battlevel * 3 + 50) / 100;
301 vol = 100 * (bar->info.volume - sound_min(SOUND_VOLUME)) 284 display->icon(ICON_BATTERY_1, val >= 1);
285 display->icon(ICON_BATTERY_2, val >= 2);
286 display->icon(ICON_BATTERY_3, val >= 3);
287
288 val = 10 * (bar->info.volume - sound_min(SOUND_VOLUME))
302 / (sound_max(SOUND_VOLUME) - sound_min(SOUND_VOLUME)); 289 / (sound_max(SOUND_VOLUME) - sound_min(SOUND_VOLUME));
303 display->icon(ICON_VOLUME, true); 290 display->icon(ICON_VOLUME, true);
304 display->icon(ICON_VOLUME_1, vol > 10); 291 display->icon(ICON_VOLUME_1, val >= 1);
305 display->icon(ICON_VOLUME_2, vol > 30); 292 display->icon(ICON_VOLUME_2, val >= 3);
306 display->icon(ICON_VOLUME_3, vol > 50); 293 display->icon(ICON_VOLUME_3, val >= 5);
307 display->icon(ICON_VOLUME_4, vol > 70); 294 display->icon(ICON_VOLUME_4, val >= 7);
308 display->icon(ICON_VOLUME_5, vol > 90); 295 display->icon(ICON_VOLUME_5, val >= 9);
309 296
310 display->icon(ICON_PLAY, current_playmode() == STATUS_PLAY); 297 display->icon(ICON_PLAY, current_playmode() == STATUS_PLAY);
311 display->icon(ICON_PAUSE, current_playmode() == STATUS_PAUSE); 298 display->icon(ICON_PAUSE, current_playmode() == STATUS_PAUSE);
@@ -326,40 +313,41 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
326 * Print battery icon to status bar 313 * Print battery icon to status bar
327 */ 314 */
328void gui_statusbar_icon_battery(struct screen * display, int percent, 315void gui_statusbar_icon_battery(struct screen * display, int percent,
329 int animated_percent) 316 int batt_charge_step)
330{ 317{
331 int fill, endfill; 318 int fill, endfill;
332 char buffer[5]; 319 char buffer[5];
333 unsigned int width, height; 320 unsigned int width, height;
334#if LCD_DEPTH > 1 321#if LCD_DEPTH > 1
335 unsigned int prevfg = LCD_DEFAULT_FG; 322 unsigned int prevfg = 0;
336#endif 323#endif
337 324
338 /* fill battery */ 325#ifdef CONFIG_CHARGING
339 fill = percent; 326 if (batt_charge_step >= 0)
340 if (fill < 0) 327 {
341 fill = 0; 328 fill = percent * (STATUSBAR_BATTERY_WIDTH-3) / 100;
342 if (fill > 100) 329 endfill = 34 * batt_charge_step * (STATUSBAR_BATTERY_WIDTH-3) / 100;
343 fill = 100; 330 }
344 331 else
345 endfill = animated_percent; 332#else
346 if (endfill < 0) 333 (void)batt_charge_step;
347 endfill = 0; 334#endif
348 if (endfill > 100) 335 {
349 endfill = 100; 336 fill = endfill = (percent * (STATUSBAR_BATTERY_WIDTH-3) + 50) / 100;
350 337 }
351#if (defined(HAVE_CHARGE_CTRL) || defined(HAVE_CHARGE_STATE)) && \ 338
352 !defined(SIMULATOR) /* Certain charge controlled targets */ 339#if CONFIG_CHARGING == CHARGING_MONITOR && !defined(SIMULATOR)
340 /* Certain charge controlled targets */
353 /* show graphical animation when charging instead of numbers */ 341 /* show graphical animation when charging instead of numbers */
354 if ((global_settings.battery_display) && 342 if ((global_settings.battery_display) &&
355 (charge_state != 1) && 343 (charge_state != CHARGING) &&
356 (percent > -1)) { 344 (percent > -1)) {
357#else /* all others */ 345#else /* all others */
358 if (global_settings.battery_display && (percent > -1)) { 346 if (global_settings.battery_display && (percent > -1)) {
359#endif 347#endif
360 /* Numeric display */ 348 /* Numeric display */
361 display->setfont(FONT_SYSFIXED); 349 display->setfont(FONT_SYSFIXED);
362 snprintf(buffer, sizeof(buffer), "%3d", fill); 350 snprintf(buffer, sizeof(buffer), "%3d", percent);
363 display->getstringsize(buffer, &width, &height); 351 display->getstringsize(buffer, &width, &height);
364 if (height <= STATUSBAR_HEIGHT) 352 if (height <= STATUSBAR_HEIGHT)
365 display->putsxy(STATUSBAR_BATTERY_X_POS 353 display->putsxy(STATUSBAR_BATTERY_X_POS
@@ -374,7 +362,6 @@ void gui_statusbar_icon_battery(struct screen * display, int percent,
374 display->vline(STATUSBAR_BATTERY_X_POS + 17, STATUSBAR_Y_POS + 2, 362 display->vline(STATUSBAR_BATTERY_X_POS + 17, STATUSBAR_Y_POS + 2,
375 STATUSBAR_Y_POS + 4); 363 STATUSBAR_Y_POS + 4);
376 364
377 fill = fill * 15 / 100;
378 display->fillrect(STATUSBAR_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, 365 display->fillrect(STATUSBAR_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1,
379 fill, 5); 366 fill, 5);
380#if LCD_DEPTH > 1 367#if LCD_DEPTH > 1
@@ -384,9 +371,8 @@ void gui_statusbar_icon_battery(struct screen * display, int percent,
384 display->set_foreground(LCD_DARKGRAY); 371 display->set_foreground(LCD_DARKGRAY);
385 } 372 }
386#endif 373#endif
387 endfill = endfill * 15 / 100 - fill; 374 display->fillrect(STATUSBAR_BATTERY_X_POS + 1 + fill,
388 display->fillrect(STATUSBAR_BATTERY_X_POS + 1 + fill, 375 STATUSBAR_Y_POS + 1, endfill - fill, 5);
389 STATUSBAR_Y_POS + 1, endfill, 5);
390#if LCD_DEPTH > 1 376#if LCD_DEPTH > 1
391 if (display->depth > 1) 377 if (display->depth > 1)
392 display->set_foreground(prevfg); 378 display->set_foreground(prevfg);
@@ -507,6 +493,7 @@ void gui_statusbar_icon_lock(struct screen * display)
507 STATUSBAR_LOCKM_WIDTH, STATUSBAR_HEIGHT); 493 STATUSBAR_LOCKM_WIDTH, STATUSBAR_HEIGHT);
508} 494}
509 495
496#ifdef HAS_REMOTE_BUTTON_HOLD
510/* 497/*
511 * Print remote lock when remote hold is enabled 498 * Print remote lock when remote hold is enabled
512 */ 499 */
@@ -516,6 +503,7 @@ void gui_statusbar_icon_lock_remote(struct screen * display)
516 STATUSBAR_LOCKR_X_POS, STATUSBAR_Y_POS, 503 STATUSBAR_LOCKR_X_POS, STATUSBAR_Y_POS,
517 STATUSBAR_LOCKR_WIDTH, STATUSBAR_HEIGHT); 504 STATUSBAR_LOCKR_WIDTH, STATUSBAR_HEIGHT);
518} 505}
506#endif
519 507
520#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) 508#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
521/* 509/*
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index 03add6a6d9..a03c294523 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -31,38 +31,40 @@
31 31
32struct status_info { 32struct status_info {
33 int battlevel; 33 int battlevel;
34 int batt_charge_step;
34 int volume; 35 int volume;
36 int playmode;
37 int repeat;
35#ifdef CONFIG_RTC 38#ifdef CONFIG_RTC
36 int hour; 39 int hour;
37 int minute; 40 int minute;
38#endif 41#endif
39 int playmode; 42
40 int repeat; 43#ifdef CONFIG_CHARGING
41 bool inserted; 44 bool inserted;
45#endif
46#ifdef HAVE_USB_POWER
47 bool usb_power;
48#endif
49 bool battery_state;
42 bool shuffle; 50 bool shuffle;
43 bool keylock; 51 bool keylock;
44#ifdef HAS_REMOTE_BUTTON_HOLD 52#ifdef HAS_REMOTE_BUTTON_HOLD
45 bool keylockremote; 53 bool keylockremote;
46#endif 54#endif
47 bool battery_safe;
48 bool redraw_volume; /* true if the volume gauge needs updating */
49#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) 55#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
50 bool led; /* disk LED simulation in the status bar */ 56 bool led; /* disk LED simulation in the status bar */
51#endif 57#endif
52 58
53#ifdef HAVE_USB_POWER
54 bool usb_power;
55#endif
56}; 59};
57 60
58struct gui_statusbar 61struct gui_statusbar
59{ 62{
60 /* Volume icon stuffs */ 63 long battery_icon_switch_tick;
64
61 long volume_icon_switch_tick; 65 long volume_icon_switch_tick;
62 int last_volume; 66 int last_volume;
63 67 bool redraw_volume; /* true if the volume gauge needs updating */
64 long battery_icon_switch_tick;
65 int animated_level;
66 68
67 struct status_info info; 69 struct status_info info;
68 struct status_info lastinfo; 70 struct status_info lastinfo;
@@ -95,7 +97,7 @@ extern void gui_statusbar_init(struct gui_statusbar * bar);
95 */ 97 */
96extern void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw); 98extern void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw);
97 99
98void gui_statusbar_icon_battery(struct screen * display, int percent, int animated_percent); 100void gui_statusbar_icon_battery(struct screen * display, int percent, int batt_charge_step);
99bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int volume); 101bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int volume);
100void gui_statusbar_icon_play_state(struct screen * display, int state); 102void gui_statusbar_icon_play_state(struct screen * display, int state);
101void gui_statusbar_icon_play_mode(struct screen * display, int mode); 103void gui_statusbar_icon_play_mode(struct screen * display, int mode);
diff --git a/apps/main.c b/apps/main.c
index 0771b287f8..5867f79d2f 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -228,7 +228,7 @@ void init(void)
228{ 228{
229 int rc; 229 int rc;
230 bool mounted = false; 230 bool mounted = false;
231#if defined(HAVE_CHARGING) && (CONFIG_CPU == SH7034) 231#if defined(CONFIG_CHARGING) && (CONFIG_CPU == SH7034)
232 /* if nobody initialized ATA before, I consider this a cold start */ 232 /* if nobody initialized ATA before, I consider this a cold start */
233 bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */ 233 bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */
234#endif 234#endif
@@ -295,7 +295,7 @@ void init(void)
295 screen_access_init(); 295 screen_access_init();
296 gui_syncstatusbar_init(&statusbars); 296 gui_syncstatusbar_init(&statusbars);
297 297
298#if defined(HAVE_CHARGING) && (CONFIG_CPU == SH7034) 298#if defined(CONFIG_CHARGING) && (CONFIG_CPU == SH7034)
299 if (coldstart && charger_inserted() 299 if (coldstart && charger_inserted()
300 && !global_settings.car_adapter_mode 300 && !global_settings.car_adapter_mode
301#ifdef ATA_POWER_PLAYERSTYLE 301#ifdef ATA_POWER_PLAYERSTYLE
@@ -433,7 +433,7 @@ void init(void)
433 } 433 }
434#endif /* #ifdef AUTOROCK */ 434#endif /* #ifdef AUTOROCK */
435 435
436#ifdef HAVE_CHARGING 436#ifdef CONFIG_CHARGING
437 car_adapter_mode_init(); 437 car_adapter_mode_init();
438#endif 438#endif
439} 439}
diff --git a/apps/main_menu.c b/apps/main_menu.c
index e6c2bb76c2..eb94498c7e 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -169,12 +169,12 @@ bool show_info(void)
169#endif 169#endif
170 lcd_puts_scroll(0, y++, (unsigned char *)s); 170 lcd_puts_scroll(0, y++, (unsigned char *)s);
171 171
172#ifdef HAVE_CHARGE_CTRL 172#if CONFIG_CHARGING == CHARGING_CONTROL
173 if (charge_state == 1) 173 if (charge_state == CHARGING)
174 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_CHARGE)); 174 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_CHARGE));
175 else if (charge_state == 2) 175 else if (charge_state == TOPOFF)
176 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TOPOFF_CHARGE)); 176 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TOPOFF_CHARGE));
177 else if (charge_state == 3) 177 else if (charge_state == TRICKLE)
178 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TRICKLE_CHARGE)); 178 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TRICKLE_CHARGE));
179 else 179 else
180#endif 180#endif
diff --git a/apps/misc.c b/apps/misc.c
index 96f913a7f9..0ab826c796 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -491,7 +491,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
491 return false; 491 return false;
492 } 492 }
493 493
494#if defined(HAVE_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) 494#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
495 if(!charger_inserted()) 495 if(!charger_inserted())
496#endif 496#endif
497 { 497 {
@@ -509,7 +509,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
509 return false; 509 return false;
510} 510}
511 511
512#ifdef HAVE_CHARGING 512#ifdef CONFIG_CHARGING
513static bool waiting_to_resume_play = false; 513static bool waiting_to_resume_play = false;
514static long play_resume_tick; 514static long play_resume_tick;
515 515
@@ -584,7 +584,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
584 if (!clean_shutdown(callback, parameter)) 584 if (!clean_shutdown(callback, parameter))
585 return SYS_POWEROFF; 585 return SYS_POWEROFF;
586 break; 586 break;
587#ifdef HAVE_CHARGING 587#ifdef CONFIG_CHARGING
588 case SYS_CHARGER_CONNECTED: 588 case SYS_CHARGER_CONNECTED:
589 car_adapter_mode_processing(true); 589 car_adapter_mode_processing(true);
590 return SYS_CHARGER_CONNECTED; 590 return SYS_CHARGER_CONNECTED;
diff --git a/apps/plugin.c b/apps/plugin.c
index 1b1c406af4..1bc4817ecd 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -58,7 +58,7 @@
58#include "dsp.h" 58#include "dsp.h"
59#endif 59#endif
60 60
61#ifdef HAVE_CHARGING 61#ifdef CONFIG_CHARGING
62#include "power.h" 62#include "power.h"
63#endif 63#endif
64 64
@@ -359,9 +359,9 @@ static const struct plugin_api rockbox_api = {
359#ifndef SIMULATOR 359#ifndef SIMULATOR
360 battery_voltage, 360 battery_voltage,
361#endif 361#endif
362#ifdef HAVE_CHARGING 362#ifdef CONFIG_CHARGING
363 charger_inserted, 363 charger_inserted,
364# ifdef HAVE_CHARGE_STATE 364# if CONFIG_CHARGING == CHARGING_MONITOR
365 charging_state, 365 charging_state,
366# endif 366# endif
367#endif 367#endif
diff --git a/apps/plugin.h b/apps/plugin.h
index de8f267ec8..b4990b8fb6 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -421,9 +421,9 @@ struct plugin_api {
421#ifndef SIMULATOR 421#ifndef SIMULATOR
422 unsigned int (*battery_voltage)(void); 422 unsigned int (*battery_voltage)(void);
423#endif 423#endif
424#ifdef HAVE_CHARGING 424#ifdef CONFIG_CHARGING
425 bool (*charger_inserted)(void); 425 bool (*charger_inserted)(void);
426# ifdef HAVE_CHARGE_STATE 426# if CONFIG_CHARGING == CHARGING_MONITOR
427 bool (*charging_state)(void); 427 bool (*charging_state)(void);
428# endif 428# endif
429#endif 429#endif
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 */
129unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)]; 129unsigned 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)
132unsigned int charge_state(void) 132unsigned 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
diff --git a/apps/screens.c b/apps/screens.c
index 20a0b58749..51201525d4 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -149,7 +149,7 @@ unsigned short adc_read(int channel)
149} 149}
150#endif 150#endif
151 151
152#if defined(HAVE_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) 152#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
153 153
154#ifdef HAVE_LCD_BITMAP 154#ifdef HAVE_LCD_BITMAP
155void charging_display_info(bool animate) 155void charging_display_info(bool animate)
@@ -178,16 +178,16 @@ void charging_display_info(bool animate)
178 lcd_puts(0, 7, buf); 178 lcd_puts(0, 7, buf);
179 } 179 }
180 180
181#ifdef HAVE_CHARGE_CTRL 181#if CONFIG_CHARGING == CHARGING_CONTROL
182 182
183 snprintf(buf, 32, "Charge mode:"); 183 snprintf(buf, 32, "Charge mode:");
184 lcd_puts(0, 2, buf); 184 lcd_puts(0, 2, buf);
185 185
186 if (charge_state == 1) 186 if (charge_state == CHARGING)
187 snprintf(buf, 32, str(LANG_BATTERY_CHARGE)); 187 snprintf(buf, 32, str(LANG_BATTERY_CHARGE));
188 else if (charge_state == 2) 188 else if (charge_state == TOPOFF)
189 snprintf(buf, 32, str(LANG_BATTERY_TOPOFF_CHARGE)); 189 snprintf(buf, 32, str(LANG_BATTERY_TOPOFF_CHARGE));
190 else if (charge_state == 3) 190 else if (charge_state == TRICKLE)
191 snprintf(buf, 32, str(LANG_BATTERY_TRICKLE_CHARGE)); 191 snprintf(buf, 32, str(LANG_BATTERY_TRICKLE_CHARGE));
192 else 192 else
193 snprintf(buf, 32, "not charging"); 193 snprintf(buf, 32, "not charging");
@@ -195,7 +195,7 @@ void charging_display_info(bool animate)
195 lcd_puts(0, 3, buf); 195 lcd_puts(0, 3, buf);
196 if (!charger_enabled) 196 if (!charger_enabled)
197 animate = false; 197 animate = false;
198#endif /* HAVE_CHARGE_CTRL */ 198#endif /* CONFIG_CHARGING == CHARGING_CONTROL */
199 199
200 200
201 /* middle part */ 201 /* middle part */
@@ -351,7 +351,7 @@ int charging_screen(void)
351#endif 351#endif
352 return rc; 352 return rc;
353} 353}
354#endif /* HAVE_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */ 354#endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */
355 355
356#if (CONFIG_KEYPAD != PLAYER_PAD) 356#if (CONFIG_KEYPAD != PLAYER_PAD)
357/* returns: 357/* returns:
@@ -660,7 +660,7 @@ bool quick_screen_f3(int button_enter)
660#endif /* BUTTON_F3 */ 660#endif /* BUTTON_F3 */
661#endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */ 661#endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */
662 662
663#if defined(HAVE_CHARGING) || defined(SIMULATOR) 663#if defined(CONFIG_CHARGING) || defined(SIMULATOR)
664void charging_splash(void) 664void charging_splash(void)
665{ 665{
666 gui_syncsplash(2*HZ, true, (unsigned char *)str(LANG_BATTERY_CHARGE)); 666 gui_syncsplash(2*HZ, true, (unsigned char *)str(LANG_BATTERY_CHARGE));
diff --git a/apps/settings.c b/apps/settings.c
index 0d6ee1d376..6d7f250436 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -243,7 +243,7 @@ static const struct bit_entry rtc_bits[] =
243 {6, S_O(contrast), 40, "contrast", NULL }, 243 {6, S_O(contrast), 40, "contrast", NULL },
244#ifdef CONFIG_BACKLIGHT 244#ifdef CONFIG_BACKLIGHT
245 {5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf }, 245 {5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
246#ifdef HAVE_CHARGING 246#ifdef CONFIG_CHARGING
247 {5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged", 247 {5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged",
248 backlight_times_conf }, 248 backlight_times_conf },
249#endif 249#endif
@@ -276,7 +276,7 @@ static const struct bit_entry rtc_bits[] =
276 {12, S_O(battery_capacity), BATTERY_CAPACITY_DEFAULT, "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 CONFIG_CHARGING
280 {1, S_O(car_adapter_mode), false, "car adapter mode", off_on }, 280 {1, S_O(car_adapter_mode), false, "car adapter mode", off_on },
281#endif 281#endif
282 /* tuner */ 282 /* tuner */
@@ -296,7 +296,7 @@ static const struct bit_entry rtc_bits[] =
296 {1, S_O(remote_flip_display), false, "remote flip display", off_on }, 296 {1, S_O(remote_flip_display), false, "remote flip display", off_on },
297 {5, S_O(remote_backlight_timeout), 5, "remote backlight timeout", 297 {5, S_O(remote_backlight_timeout), 5, "remote backlight timeout",
298 backlight_times_conf }, 298 backlight_times_conf },
299#ifdef HAVE_CHARGING 299#ifdef CONFIG_CHARGING
300 {5, S_O(remote_backlight_timeout_plugged), 11, 300 {5, S_O(remote_backlight_timeout_plugged), 11,
301 "remote backlight timeout plugged", backlight_times_conf }, 301 "remote backlight timeout plugged", backlight_times_conf },
302#endif 302#endif
@@ -1018,13 +1018,13 @@ void settings_apply(void)
1018 lcd_remote_emireduce(global_settings.remote_reduce_ticking); 1018 lcd_remote_emireduce(global_settings.remote_reduce_ticking);
1019#endif 1019#endif
1020 remote_backlight_set_timeout(global_settings.remote_backlight_timeout); 1020 remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
1021#ifdef HAVE_CHARGING 1021#ifdef CONFIG_CHARGING
1022 remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged); 1022 remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
1023#endif 1023#endif
1024#endif 1024#endif
1025#ifdef CONFIG_BACKLIGHT 1025#ifdef CONFIG_BACKLIGHT
1026 backlight_set_timeout(global_settings.backlight_timeout); 1026 backlight_set_timeout(global_settings.backlight_timeout);
1027#ifdef HAVE_CHARGING 1027#ifdef CONFIG_CHARGING
1028 backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged); 1028 backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
1029#endif 1029#endif
1030#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) 1030#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index bcf5a784c0..821ad53dec 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -81,7 +81,7 @@ void dac_line_in(bool enable);
81#include "backdrop.h" 81#include "backdrop.h"
82#endif 82#endif
83 83
84#ifdef HAVE_CHARGING 84#ifdef CONFIG_CHARGING
85static bool car_adapter_mode(void) 85static bool car_adapter_mode(void)
86{ 86{
87 return set_bool( str(LANG_CAR_ADAPTER_MODE), 87 return set_bool( str(LANG_CAR_ADAPTER_MODE),
@@ -177,7 +177,7 @@ static bool caption_backlight(void)
177 &global_settings.caption_backlight); 177 &global_settings.caption_backlight);
178} 178}
179 179
180#ifdef HAVE_CHARGING 180#ifdef CONFIG_CHARGING
181static bool backlight_timer_plugged(void) 181static bool backlight_timer_plugged(void)
182{ 182{
183 return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING), 183 return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
@@ -248,7 +248,7 @@ static bool remote_backlight_timer(void)
248 remote_backlight_set_timeout ); 248 remote_backlight_set_timeout );
249} 249}
250 250
251#ifdef HAVE_CHARGING 251#ifdef CONFIG_CHARGING
252static bool remote_backlight_timer_plugged(void) 252static bool remote_backlight_timer_plugged(void)
253{ 253{
254 return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING), 254 return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
@@ -1715,7 +1715,7 @@ static bool lcd_settings_menu(void)
1715 static const struct menu_item items[] = { 1715 static const struct menu_item items[] = {
1716#ifdef CONFIG_BACKLIGHT 1716#ifdef CONFIG_BACKLIGHT
1717 { ID2P(LANG_BACKLIGHT), backlight_timer }, 1717 { ID2P(LANG_BACKLIGHT), backlight_timer },
1718#ifdef HAVE_CHARGING 1718#ifdef CONFIG_CHARGING
1719 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged }, 1719 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged },
1720#endif 1720#endif
1721 { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight }, 1721 { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
@@ -1763,7 +1763,7 @@ static bool lcd_remote_settings_menu(void)
1763 1763
1764 static const struct menu_item items[] = { 1764 static const struct menu_item items[] = {
1765 { ID2P(LANG_BACKLIGHT), remote_backlight_timer }, 1765 { ID2P(LANG_BACKLIGHT), remote_backlight_timer },
1766#ifdef HAVE_CHARGING 1766#ifdef CONFIG_CHARGING
1767 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), 1767 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING),
1768 remote_backlight_timer_plugged }, 1768 remote_backlight_timer_plugged },
1769#endif 1769#endif
@@ -1860,10 +1860,8 @@ static bool battery_settings_menu(void)
1860 { ID2P(LANG_BATTERY_TYPE), battery_type }, 1860 { ID2P(LANG_BATTERY_TYPE), battery_type },
1861#endif 1861#endif
1862#else 1862#else
1863#ifndef HAVE_CHARGE_CTRL
1864 { "Dummy", NULL }, /* to have an entry at all, in the simulator */ 1863 { "Dummy", NULL }, /* to have an entry at all, in the simulator */
1865#endif 1864#endif
1866#endif
1867 }; 1865 };
1868 1866
1869 m=menu_init( items, sizeof(items) / sizeof(*items), NULL, 1867 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
@@ -1975,7 +1973,7 @@ static bool system_settings_menu(void)
1975#if CONFIG_CODEC == MAS3507D 1973#if CONFIG_CODEC == MAS3507D
1976 { ID2P(LANG_LINE_IN), line_in }, 1974 { ID2P(LANG_LINE_IN), line_in },
1977#endif 1975#endif
1978#ifdef HAVE_CHARGING 1976#ifdef CONFIG_CHARGING
1979 { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode }, 1977 { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode },
1980#endif 1978#endif
1981 }; 1979 };
diff --git a/apps/status.c b/apps/status.c
index 5c5fb3eaa6..ca8a4d63ef 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -49,12 +49,6 @@
49 49
50enum playmode ff_mode; 50enum playmode ff_mode;
51 51
52long switch_tick;
53bool battery_state = true;
54#ifdef HAVE_CHARGING
55int battery_charge_step = 0;
56#endif
57
58void status_init(void) 52void status_init(void)
59{ 53{
60 ff_mode = 0; 54 ff_mode = 0;
diff --git a/apps/status.h b/apps/status.h
index 68319257b8..f42352be8e 100644
--- a/apps/status.h
+++ b/apps/status.h
@@ -21,12 +21,6 @@
21 21
22extern enum playmode ff_mode; 22extern enum playmode ff_mode;
23 23
24extern long switch_tick;
25extern bool battery_state;
26#ifdef HAVE_CHARGING
27extern int battery_charge_step;
28#endif
29
30#if defined(HAVE_LCD_CHARCELLS) 24#if defined(HAVE_LCD_CHARCELLS)
31extern bool record; 25extern bool record;
32extern bool audio; 26extern bool audio;
diff --git a/apps/tree.c b/apps/tree.c
index 35cefb163d..72e7bc4504 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -644,7 +644,7 @@ static bool dirbrowse(void)
644 if (!global_settings.party_mode) 644 if (!global_settings.party_mode)
645 audio_stop(); 645 audio_stop();
646 } 646 }
647#if defined(HAVE_CHARGING) && \ 647#if defined(CONFIG_CHARGING) && \
648 (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF) 648 (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
649 else { 649 else {
650 if (!charger_inserted()) { 650 if (!charger_inserted()) {
@@ -658,7 +658,7 @@ static bool dirbrowse(void)
658#endif 658#endif
659 } 659 }
660 break; 660 break;
661#if defined(HAVE_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) 661#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
662 case TREE_OFF | BUTTON_REPEAT: 662 case TREE_OFF | BUTTON_REPEAT:
663 if (charger_inserted()) { 663 if (charger_inserted()) {
664 charging_splash(); 664 charging_splash();