summaryrefslogtreecommitdiff
path: root/apps/status.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/status.c')
-rw-r--r--apps/status.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/apps/status.c b/apps/status.c
index 8d3d1748cb..2218768451 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -40,13 +40,15 @@
40#if CONFIG_KEYPAD == IRIVER_H100_PAD 40#if CONFIG_KEYPAD == IRIVER_H100_PAD
41#include "button.h" 41#include "button.h"
42#endif 42#endif
43#include "usb.h"
43 44
44static enum playmode ff_mode; 45static enum playmode ff_mode;
45 46
46static long switch_tick; 47static long switch_tick;
47static int battery_charge_step = 0;
48static bool plug_state;
49static bool battery_state = true; 48static bool battery_state = true;
49#ifdef HAVE_CHARGING
50static int battery_charge_step = 0;
51#endif
50 52
51struct status_info { 53struct status_info {
52 int battlevel; 54 int battlevel;
@@ -63,6 +65,10 @@ struct status_info {
63#if CONFIG_LED == LED_VIRTUAL 65#if CONFIG_LED == LED_VIRTUAL
64 bool led; /* disk LED simulation in the status bar */ 66 bool led; /* disk LED simulation in the status bar */
65#endif 67#endif
68#ifdef HAVE_USB_POWER
69 bool usb_power;
70#endif
71
66}; 72};
67 73
68void status_init(void) 74void status_init(void)
@@ -170,6 +176,9 @@ void status_draw(bool force_redraw)
170#if CONFIG_LED == LED_VIRTUAL 176#if CONFIG_LED == LED_VIRTUAL
171 info.led = led_read(HZ/2); /* delay should match polling interval */ 177 info.led = led_read(HZ/2); /* delay should match polling interval */
172#endif 178#endif
179#ifdef HAVE_USB_POWER
180 info.usb_power = usb_powered();
181#endif
173 182
174 /* only redraw if forced to, or info has changed */ 183 /* only redraw if forced to, or info has changed */
175 if (force_redraw || 184 if (force_redraw ||
@@ -183,10 +192,10 @@ void status_draw(bool force_redraw)
183 /* players always "redraw" */ 192 /* players always "redraw" */
184 { 193 {
185#endif 194#endif
186 195
196#ifdef HAVE_CHARGING
187 if (info.inserted) { 197 if (info.inserted) {
188 battery_state = true; 198 battery_state = true;
189 plug_state = true;
190#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200 199#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200
191 /* zero battery run time if charging */ 200 /* zero battery run time if charging */
192 if (charge_state > 0) { 201 if (charge_state > 0) {
@@ -212,8 +221,9 @@ void status_draw(bool force_redraw)
212 } 221 }
213 } 222 }
214 } 223 }
215 else { 224 else
216 plug_state=false; 225#endif /* HAVE_CHARGING */
226 {
217 if (info.battery_safe) 227 if (info.battery_safe)
218 battery_state = true; 228 battery_state = true;
219 else { 229 else {
@@ -228,8 +238,18 @@ void status_draw(bool force_redraw)
228 238
229#ifdef HAVE_LCD_BITMAP 239#ifdef HAVE_LCD_BITMAP
230 if (battery_state) 240 if (battery_state)
231 statusbar_icon_battery(info.battlevel, plug_state); 241 statusbar_icon_battery(info.battlevel);
232 242
243 /* draw power plug if charging */
244 if (info.inserted)
245 lcd_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS,
246 STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false);
247#ifdef HAVE_USB_POWER
248 else if (info.usb_power)
249 lcd_bitmap(bitmap_icons_7x8[Icon_USBPlug], ICON_PLUG_X_POS,
250 STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false);
251#endif
252
233 info.redraw_volume = statusbar_icon_volume(info.volume); 253 info.redraw_volume = statusbar_icon_volume(info.volume);
234 statusbar_icon_play_state(current_playmode() + Icon_Play); 254 statusbar_icon_play_state(current_playmode() + Icon_Play);
235 switch (info.repeat) { 255 switch (info.repeat) {