1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Björn Stenberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
25 #include "backlight.h"
28 #ifdef HAVE_REMOTE_LCD
29 #include "lcd-remote.h"
35 #include "mp3_playback.h"
44 #include "powermgmt.h"
54 #include "statusbar.h"
55 #include "screen_access.h"
62 #ifdef HAVE_LCD_BITMAP
63 #include "bitmaps/usblogo.h"
66 #ifdef HAVE_REMOTE_LCD
67 #include "bitmaps/remote_usblogo.h"
70 #if (CONFIG_STORAGE & STORAGE_MMC)
73 #if CONFIG_CODEC == SWCODEC
77 #ifdef HAVE_LCD_BITMAP
78 #define SCROLLBAR_WIDTH 6
81 /* only used in set_time screen */
82 #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
83 static int clamp_value_wrap(int value
, int max
, int min
)
94 static int handle_usb_events(struct event_queue
*q
)
96 struct queue_event ev
;
99 /* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */
102 queue_wait_w_tmo(q
, &ev
, HZ
/4);
105 case SYS_USB_DISCONNECTED
:
106 usb_acknowledge(SYS_USB_DISCONNECTED_ACK
);
111 #if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB) \
112 && defined(HAVE_USB_POWER)
113 if((button_status() & ~USBPOWER_BTN_IGNORE
) == USBPOWER_BUTTON
)
115 usb_storage_try_release_storage();
118 if(TIME_AFTER(current_tick
,next_update
))
121 #if (CONFIG_STORAGE & STORAGE_MMC) /* USB-MMC bridge can report activity */
122 led(mmc_usb_active(HZ
));
123 #endif /* STORAGE_MMC */
124 gui_syncstatusbar_draw(&statusbars
, false);
126 next_update
=current_tick
+HZ
/2;
132 void usb_screen(void)
138 bool statusbar
= global_settings
.statusbar
; /* force the statusbar */
139 global_settings
.statusbar
= true;
141 show_main_backdrop();
143 #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
144 show_remote_main_backdrop();
148 screens
[i
].backlight_on();
149 screens
[i
].clear_display();
151 if (i
== SCREEN_REMOTE
)
153 screens
[i
].bitmap(remote_usblogo
,
154 (LCD_REMOTE_WIDTH
-BMPWIDTH_remote_usblogo
),
155 (LCD_REMOTE_HEIGHT
-BMPHEIGHT_remote_usblogo
)/2,
156 BMPWIDTH_remote_usblogo
, BMPHEIGHT_remote_usblogo
);
161 #ifdef HAVE_LCD_BITMAP
162 screens
[i
].transparent_bitmap(usblogo
,
163 (LCD_WIDTH
-BMPWIDTH_usblogo
),
164 (LCD_HEIGHT
-BMPHEIGHT_usblogo
)/2,
165 BMPWIDTH_usblogo
, BMPHEIGHT_usblogo
);
167 screens
[i
].double_height(false);
168 screens
[i
].puts_scroll(0, 0, "[USB Mode]");
169 status_set_param(false);
170 status_set_audio(false);
171 status_set_usb(true);
172 #endif /* HAVE_LCD_BITMAP */
180 while (button_get(true) & BUTTON_REL
);
182 usb_acknowledge(SYS_USB_CONNECTED_ACK
);
183 while(handle_usb_events(&button_queue
));
184 #endif /* SIMULATOR */
185 #ifdef HAVE_LCD_CHARCELLS
186 status_set_usb(false);
187 #endif /* HAVE_LCD_CHARCELLS */
189 screens
[i
].backlight_on();
190 global_settings
.statusbar
= statusbar
;
191 #endif /* USB_NONE */
194 #if (CONFIG_STORAGE & STORAGE_MMC)
195 int mmc_remove_request(void)
197 struct queue_event ev
;
200 screens
[i
].clear_display();
201 splash(0, ID2P(LANG_REMOVE_MMC
));
205 queue_wait_w_tmo(&button_queue
, &ev
, HZ
/2);
208 case SYS_HOTSWAP_EXTRACTED
:
209 return SYS_HOTSWAP_EXTRACTED
;
211 case SYS_USB_DISCONNECTED
:
212 return SYS_USB_DISCONNECTED
;
218 /* the charging screen is only used for archos targets */
219 #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) && defined(CPU_SH)
221 #ifdef HAVE_LCD_BITMAP
222 static void charging_display_info(bool animate
)
224 unsigned char charging_logo
[36];
225 const int pox_x
= (LCD_WIDTH
- sizeof(charging_logo
)) / 2;
226 const int pox_y
= 32;
227 static unsigned phase
= 3;
232 #ifdef NEED_ATA_POWER_BATT_MEASURE
233 if (ide_powered()) /* FM and V2 can only measure when ATA power is on */
236 int battv
= battery_voltage();
237 snprintf(buf
, 32, " Batt: %d.%02dV %d%% ", battv
/ 1000,
238 (battv
% 1000) / 10, battery_level());
242 #ifdef ARCHOS_RECORER
243 snprintf(buf
, 32, "Charge mode:");
246 if (charge_state
== CHARGING
)
247 snprintf(buf
, 32, str(LANG_BATTERY_CHARGE
));
248 else if (charge_state
== TOPOFF
)
249 snprintf(buf
, 32, str(LANG_BATTERY_TOPOFF_CHARGE
));
250 else if (charge_state
== TRICKLE
)
251 snprintf(buf
, 32, str(LANG_BATTERY_TRICKLE_CHARGE
));
253 snprintf(buf
, 32, "not charging");
256 if (!charger_enabled())
258 #endif /* ARCHOS_RECORER */
261 memset(charging_logo
+3, 0x00, 32);
262 charging_logo
[0] = 0x3C;
263 charging_logo
[1] = 0x24;
264 charging_logo
[2] = charging_logo
[35] = 0xFF;
267 { /* draw the outline */
269 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 8,
270 sizeof(charging_logo
), 8);
271 lcd_set_drawmode(DRMODE_FG
);
273 charging_logo
[0] = charging_logo
[1] = 0x00;
274 memset(charging_logo
+2, 0x80, 34);
275 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
, sizeof(charging_logo
), 8);
277 memset(charging_logo
+2, 0x01, 34);
278 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 16,
279 sizeof(charging_logo
), 8);
280 lcd_set_drawmode(DRMODE_SOLID
);
283 { /* animate the middle part */
284 for (i
= 3; i
<MIN(sizeof(charging_logo
)-1, phase
); i
++)
286 if ((i
-phase
) % 8 == 0)
287 { /* draw a "bubble" here */
289 bitpos
= (phase
+ i
/8) % 15; /* "bounce" effect */
291 bitpos
= 14 - bitpos
;
292 charging_logo
[i
] = 0x01 << bitpos
;
295 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 8,
296 sizeof(charging_logo
), 8);
301 #else /* not HAVE_LCD_BITMAP */
303 static unsigned long logo_chars
[4];
304 static const unsigned char logo_pattern
[] = {
305 0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, 0, /* char 1 */
306 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 2 */
307 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 3 */
308 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, 0, /* char 4 */
311 static void logo_lock_patterns(bool on
)
317 for (i
= 0; i
< 4; i
++)
318 logo_chars
[i
] = lcd_get_locked_pattern();
322 for (i
= 0; i
< 4; i
++)
323 lcd_unlock_pattern(logo_chars
[i
]);
327 static void charging_display_info(bool animate
)
331 static unsigned phase
= 3;
334 battv
= battery_voltage();
335 snprintf(buf
, sizeof(buf
), " %d.%02dV", battv
/ 1000, (battv
% 1000) / 10);
338 memcpy(buf
, logo_pattern
, 32); /* copy logo patterns */
340 if (!animate
) /* build the screen */
342 lcd_double_height(false);
343 lcd_puts(0, 0, "[Charging]");
344 for (i
= 0; i
< 4; i
++)
345 lcd_putc(i
, 1, logo_chars
[i
]);
347 else /* animate the logo */
349 for (i
= 3; i
< MIN(19, phase
); i
++)
351 if ((i
- phase
) % 5 == 0)
352 { /* draw a "bubble" here */
353 ypos
= (phase
+ i
/5) % 9; /* "bounce" effect */
356 buf
[5 - ypos
+ 8 * (i
/5)] |= 0x10u
>> (i
%5);
362 for (i
= 0; i
< 4; i
++)
363 lcd_define_pattern(logo_chars
[i
], buf
+ 8 * i
);
367 #endif /* (not) HAVE_LCD_BITMAP */
369 /* blocks while charging, returns on event:
370 1 if charger cable was removed
371 2 if Off/Stop key was pressed
372 3 if On key was pressed
373 4 if USB was connected */
375 int charging_screen(void)
380 ide_power_enable(false); /* power down the disk, else would be spinning */
383 backlight_set_timeout(global_settings
.backlight_timeout
);
384 #ifdef HAVE_REMOTE_LCD
385 remote_backlight_set_timeout(global_settings
.remote_backlight_timeout
);
387 backlight_set_timeout_plugged(global_settings
.backlight_timeout_plugged
);
389 #ifdef HAVE_LCD_CHARCELLS
390 logo_lock_patterns(true);
392 charging_display_info(false);
396 gui_syncstatusbar_draw(&statusbars
, false);
397 charging_display_info(true);
398 button
= get_action(CONTEXT_STD
,HZ
/3);
399 if (button
== ACTION_STD_OK
)
401 else if (usb_detect() == USB_INSERTED
)
403 else if (!charger_inserted())
407 #ifdef HAVE_LCD_CHARCELLS
408 logo_lock_patterns(false);
412 #endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING && defined(CPU_SH) */
415 void charging_splash(void)
417 splash(2*HZ
, str(LANG_BATTERY_CHARGE
));
418 button_clear_queue();
423 #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
425 /* little helper function for voice output */
426 static void say_time(int cursorpos
, const struct tm
*tm
)
431 if (!global_settings
.talk_menu
)
449 value
= tm
->tm_year
+ 1900;
456 if (cursorpos
== 4) /* month */
457 talk_id(LANG_MONTH_JANUARY
+ tm
->tm_mon
, false);
459 talk_value(value
, unit
, false);
466 #define SEPARATOR ":"
467 bool set_time_screen(const char* title
, struct tm
*tm
)
471 unsigned int i
, j
, s
;
473 unsigned int julianday
;
474 unsigned int realyear
;
476 unsigned int min
, max
;
477 unsigned int statusbar_height
= 0;
478 unsigned int separator_width
, weekday_width
;
479 unsigned int prev_line_height
;
480 int daysinmonth
[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
481 unsigned char buffer
[20];
482 struct viewport vp
[NB_SCREENS
];
485 /* 6 possible cursor possitions, 2 values stored for each: x, y */
486 unsigned int cursor
[6][2];
489 unsigned char *ptr
[6];
491 if(global_settings
.statusbar
)
492 statusbar_height
= STATUSBAR_HEIGHT
;
494 /* speak selection when screen is entered */
495 say_time(cursorpos
, tm
);
498 /* for easy acess in the drawing loop */
499 ptr
[0] = buffer
; /* hours */
500 ptr
[1] = buffer
+ 3; /* minutes */
501 ptr
[2] = buffer
+ 6; /* seconds */
502 ptr
[3] = buffer
+ 9; /* year */
503 ptr
[4] = str(LANG_MONTH_JANUARY
+ tm
->tm_mon
); /* monthname */
504 ptr
[5] = buffer
+ 14; /* day of month */
506 /* calculate the number of days in febuary */
507 realyear
= tm
->tm_year
+ 1900;
508 if((realyear
% 4 == 0 && !(realyear
% 100 == 0)) || realyear
% 400 == 0)
513 /* fix day if month or year changed */
514 if (tm
->tm_mday
> daysinmonth
[tm
->tm_mon
])
515 tm
->tm_mday
= daysinmonth
[tm
->tm_mon
];
517 /* calculate day of week */
518 julianday
= tm
->tm_mday
;
519 for(i
= 0; (int)i
< tm
->tm_mon
; i
++) {
520 julianday
+= daysinmonth
[i
];
523 tm
->tm_wday
= (realyear
+ julianday
+ (realyear
- 1) / 4 -
524 (realyear
- 1) / 100 + (realyear
- 1) / 400 + 7 - 1) % 7;
526 /* put all the numbers we want from the tm struct into
527 an easily printable buffer */
528 snprintf(buffer
, sizeof(buffer
),
529 "%02d " "%02d " "%02d " "%04d " "%02d",
530 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
,
531 tm
->tm_year
+1900, tm
->tm_mday
);
533 /* convert spaces in the buffer to '\0' to make it possible to work
534 directly on the buffer */
535 for(i
=0; i
< sizeof(buffer
); i
++)
543 viewport_set_defaults(&vp
[s
], s
);
544 screens
[s
].set_viewport(&vp
[s
]);
545 nb_lines
= viewport_get_nb_lines(&vp
[s
]);
547 /* minimum lines needed is 2 + title line */
550 vp
[s
].font
= FONT_SYSFIXED
;
551 nb_lines
= viewport_get_nb_lines(&vp
[s
]);
554 /* recalculate the positions and offsets */
556 screens
[s
].getstringsize(title
, NULL
, &prev_line_height
);
558 prev_line_height
= 0;
560 screens
[s
].getstringsize(SEPARATOR
, &separator_width
, NULL
);
563 screens
[s
].getstringsize(str(LANG_WEEKDAY_SUNDAY
+ tm
->tm_wday
),
564 &weekday_width
, NULL
);
565 screens
[s
].getstringsize(" ", &separator_width
, NULL
);
567 for(i
=0, j
=0; i
< 6; i
++)
569 if(i
==3) /* second row */
571 j
= weekday_width
+ separator_width
;
572 prev_line_height
*= 2;
574 screens
[s
].getstringsize(ptr
[i
], &width
, NULL
);
575 cursor
[i
][INDEX_Y
] = prev_line_height
+ statusbar_height
;
576 cursor
[i
][INDEX_X
] = j
;
577 j
+= width
+ separator_width
;
580 /* draw the screen */
581 screens
[s
].set_viewport(&vp
[s
]);
582 screens
[s
].clear_viewport();
583 /* display the screen title */
584 screens
[s
].puts_scroll(0, 0, title
);
586 /* these are not selectable, so we draw them outside the loop */
587 /* name of the week day */
588 screens
[s
].putsxy(0, cursor
[3][INDEX_Y
],
589 str(LANG_WEEKDAY_SUNDAY
+ tm
->tm_wday
));
591 /* draw the selected item with drawmode set to
592 DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable
593 items with drawmode DRMODE_SOLID */
596 if (cursorpos
== (int)i
)
597 vp
[s
].drawmode
= (DRMODE_SOLID
|DRMODE_INVERSEVID
);
599 screens
[s
].putsxy(cursor
[i
][INDEX_X
],
600 cursor
[i
][INDEX_Y
], ptr
[i
]);
602 vp
[s
].drawmode
= DRMODE_SOLID
;
604 screens
[s
].putsxy(cursor
[i
/4 +1][INDEX_X
] - separator_width
,
605 cursor
[0][INDEX_Y
], SEPARATOR
);
608 /* print help text */
610 screens
[s
].puts(0, 4, str(LANG_TIME_SET_BUTTON
));
612 screens
[s
].puts(0, 5, str(LANG_TIME_REVERT
));
613 screens
[s
].update_viewport();
614 screens
[s
].set_viewport(NULL
);
617 /* set the most common numbers */
620 /* calculate the minimum and maximum for the number under cursor */
624 valptr
= &tm
->tm_hour
;
627 valptr
= &tm
->tm_min
;
630 valptr
= &tm
->tm_sec
;
635 valptr
= &tm
->tm_year
;
639 valptr
= &tm
->tm_mon
;
643 max
= daysinmonth
[tm
->tm_mon
];
644 valptr
= &tm
->tm_mday
;
648 button
= get_action(CONTEXT_SETTINGS_TIME
, TIMEOUT_BLOCK
);
650 case ACTION_STD_PREV
:
651 cursorpos
= clamp_value_wrap(--cursorpos
, 5, 0);
652 say_time(cursorpos
, tm
);
654 case ACTION_STD_NEXT
:
655 cursorpos
= clamp_value_wrap(++cursorpos
, 5, 0);
656 say_time(cursorpos
, tm
);
658 case ACTION_SETTINGS_INC
:
659 case ACTION_SETTINGS_INCREPEAT
:
660 *valptr
= clamp_value_wrap(++(*valptr
), max
, min
);
661 say_time(cursorpos
, tm
);
663 case ACTION_SETTINGS_DEC
:
664 case ACTION_SETTINGS_DECREPEAT
:
665 *valptr
= clamp_value_wrap(--(*valptr
), max
, min
);
666 say_time(cursorpos
, tm
);
673 case ACTION_STD_CANCEL
:
679 if (default_event_handler(button
) == SYS_USB_CONNECTED
)
686 #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */
688 #if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
689 bool shutdown_screen(void)
693 long time_entered
= current_tick
;
697 splash(0, str(LANG_CONFIRM_SHUTDOWN
));
699 while(!done
&& TIME_BEFORE(current_tick
,time_entered
+HZ
*2))
701 button
= get_action(CONTEXT_STD
,HZ
);
704 case ACTION_STD_CANCEL
:
708 /* do nothing here, because ACTION_NONE might be caused
709 * by timeout or button release. In case of timeout the loop
710 * is terminated by TIME_BEFORE */
715 if(default_event_handler(button
) == SYS_USB_CONNECTED
)
725 static const int id3_headers
[]=
730 LANG_ID3_ALBUMARTIST
,
741 #if CONFIG_CODEC == SWCODEC
747 struct id3view_info
{
748 struct mp3entry
* id3
;
750 int info_id
[sizeof(id3_headers
)/sizeof(id3_headers
[0])];
752 static char * id3_get_info(int selected_item
, void* data
,
753 char *buffer
, size_t buffer_len
)
755 struct id3view_info
*info
= (struct id3view_info
*)data
;
756 struct mp3entry
* id3
=info
->id3
;
757 int info_no
=selected_item
/2;
758 if(!(selected_item
%2))
760 return( str(id3_headers
[info
->info_id
[info_no
]]));
766 switch(info
->info_id
[info_no
])
768 case 0:/*LANG_ID3_TITLE*/
771 case 1:/*LANG_ID3_ARTIST*/
774 case 2:/*LANG_ID3_ALBUM*/
777 case 3:/*LANG_ID3_ALBUMARTIST*/
778 val
=id3
->albumartist
;
780 case 4:/*LANG_ID3_GROUPING*/
783 case 5:/*LANG_ID3_DISCNUM*/
784 if (id3
->disc_string
)
785 val
= id3
->disc_string
;
786 else if (id3
->discnum
)
788 snprintf(buffer
, buffer_len
, "%d", id3
->discnum
);
792 case 6:/*LANG_ID3_TRACKNUM*/
793 if (id3
->track_string
)
794 val
= id3
->track_string
;
795 else if (id3
->tracknum
)
797 snprintf(buffer
, buffer_len
, "%d", id3
->tracknum
);
801 case 7:/*LANG_ID3_COMMENT*/
804 case 8:/*LANG_ID3_GENRE*/
805 val
= id3
->genre_string
;
807 case 9:/*LANG_ID3_YEAR*/
808 if (id3
->year_string
)
809 val
= id3
->year_string
;
812 snprintf(buffer
, buffer_len
, "%d", id3
->year
);
816 case 10:/*LANG_ID3_LENGTH*/
817 format_time(buffer
, buffer_len
, id3
->length
);
820 case 11:/*LANG_ID3_PLAYLIST*/
821 snprintf(buffer
, buffer_len
, "%d/%d",
822 playlist_get_display_index(), playlist_amount());
825 case 12:/*LANG_ID3_BITRATE*/
826 snprintf(buffer
, buffer_len
, "%d kbps%s", id3
->bitrate
,
827 id3
->vbr
? str(LANG_ID3_VBR
) : (const unsigned char*) "");
830 case 13:/*LANG_ID3_FREQUENCY*/
831 snprintf(buffer
, buffer_len
, "%ld Hz", id3
->frequency
);
834 #if CONFIG_CODEC == SWCODEC
835 case 14:/*LANG_ID3_TRACK_GAIN*/
836 val
=id3
->track_gain_string
;
838 case 15:/*LANG_ID3_ALBUM_GAIN*/
839 val
=id3
->album_gain_string
;
841 case 16:/*LANG_ID3_PATH*/
843 case 14:/*LANG_ID3_PATH*/
848 return val
&& *val
? val
: NULL
;
852 bool browse_id3(void)
854 struct gui_synclist id3_lists
;
855 struct mp3entry
* id3
= audio_current_track();
858 struct id3view_info info
;
861 for (i
=0; i
<sizeof(id3_headers
)/sizeof(id3_headers
[0]); i
++)
865 if (id3_get_info((i
*2)+1, &info
, temp
, 8) != NULL
)
866 info
.info_id
[info
.count
++] = i
;
869 gui_synclist_init(&id3_lists
, &id3_get_info
, &info
, true, 2, NULL
);
870 gui_synclist_set_nb_items(&id3_lists
, info
.count
*2);
871 gui_synclist_draw(&id3_lists
);
873 key
= get_action(CONTEXT_LIST
,HZ
/2);
874 if(key
!=ACTION_NONE
&& key
!=ACTION_UNKNOWN
875 && !gui_synclist_do_button(&id3_lists
, &key
,LIST_WRAP_UNLESS_HELD
))
877 return(default_event_handler(key
) == SYS_USB_CONNECTED
);
882 static char* runtime_get_data(int selected_item
, void* data
,
883 char* buffer
, size_t buffer_len
)
887 switch (selected_item
)
889 case 0: return str(LANG_RUNNING_TIME
);
890 case 1: t
= global_status
.runtime
; break;
891 case 2: return str(LANG_TOP_TIME
);
892 case 3: t
= global_status
.topruntime
; break;
897 snprintf(buffer
, buffer_len
, "%dh %dm %ds",
898 t
/ 3600, (t
% 3600) / 60, t
% 60);
902 static int runtime_speak_data(int selected_item
, void* data
)
906 (selected_item
< 2) ? LANG_RUNNING_TIME
: LANG_TOP_TIME
,
907 TALK_ID((selected_item
< 2) ? global_status
.runtime
908 : global_status
.topruntime
, UNIT_TIME
));
913 bool view_runtime(void)
915 static const char *lines
[]={ID2P(LANG_CLEAR_TIME
)};
916 static const struct text_message message
={lines
, 1};
918 struct gui_synclist lists
;
920 gui_synclist_init(&lists
, runtime_get_data
, NULL
, false, 2, NULL
);
921 #if !defined(HAVE_LCD_CHARCELLS)
922 gui_synclist_set_title(&lists
, str(LANG_RUNNING_TIME
), NOICON
);
924 gui_synclist_set_title(&lists
, NULL
, NOICON
);
926 if(global_settings
.talk_menu
)
927 gui_synclist_set_voice_callback(&lists
, runtime_speak_data
);
928 gui_synclist_set_icon_callback(&lists
, NULL
);
929 gui_synclist_set_nb_items(&lists
, 4);
930 gui_synclist_speak_item(&lists
);
934 if (charger_inserted())
936 global_status
.runtime
= 0;
941 global_status
.runtime
+= ((current_tick
- lasttime
) / HZ
);
943 lasttime
= current_tick
;
944 gui_synclist_draw(&lists
);
945 list_do_action(CONTEXT_STD
, HZ
,
946 &lists
, &action
, LIST_WRAP_UNLESS_HELD
);
947 if(action
== ACTION_STD_CANCEL
)
949 if(action
== ACTION_STD_OK
) {
950 if(gui_syncyesno_run(&message
, NULL
, NULL
)==YESNO_YES
)
952 if (!(gui_synclist_get_sel_pos(&lists
)/2))
953 global_status
.runtime
= 0;
955 global_status
.topruntime
= 0;
956 gui_synclist_speak_item(&lists
);
959 if(default_event_handler(action
) == SYS_USB_CONNECTED
)