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"
55 #include "statusbar.h"
56 #include "screen_access.h"
63 #ifdef HAVE_LCD_BITMAP
64 #include "bitmaps/usblogo.h"
67 #ifdef HAVE_REMOTE_LCD
68 #include "bitmaps/remote_usblogo.h"
71 #if (CONFIG_STORAGE & STORAGE_MMC)
74 #if CONFIG_CODEC == SWCODEC
78 #ifdef HAVE_LCD_BITMAP
79 #define SCROLLBAR_WIDTH 6
82 /* only used in set_time screen */
83 #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
84 static int clamp_value_wrap(int value
, int max
, int min
)
100 bool statusbar
= global_settings
.statusbar
; /* force the statusbar */
101 global_settings
.statusbar
= true;
103 show_main_backdrop();
105 #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
106 show_remote_main_backdrop();
110 screens
[i
].backlight_on();
111 screens
[i
].clear_display();
113 if (i
== SCREEN_REMOTE
)
115 screens
[i
].bitmap(remote_usblogo
,
116 (LCD_REMOTE_WIDTH
-BMPWIDTH_remote_usblogo
),
117 (LCD_REMOTE_HEIGHT
-BMPHEIGHT_remote_usblogo
)/2,
118 BMPWIDTH_remote_usblogo
, BMPHEIGHT_remote_usblogo
);
123 #ifdef HAVE_LCD_BITMAP
124 screens
[i
].transparent_bitmap(usblogo
,
125 (LCD_WIDTH
-BMPWIDTH_usblogo
),
126 (LCD_HEIGHT
-BMPHEIGHT_usblogo
)/2,
127 BMPWIDTH_usblogo
, BMPHEIGHT_usblogo
);
129 screens
[i
].double_height(false);
130 screens
[i
].puts_scroll(0, 0, "[USB Mode]");
131 status_set_param(false);
132 status_set_audio(false);
133 status_set_usb(true);
134 #endif /* HAVE_LCD_BITMAP */
141 gui_syncstatusbar_draw(&statusbars
, true);
143 while (button_get(true) & BUTTON_REL
);
145 usb_acknowledge(SYS_USB_CONNECTED_ACK
);
146 while(usb_wait_for_disconnect_w_tmo(&button_queue
, HZ
)) {
148 #if (CONFIG_STORAGE & STORAGE_MMC) /* USB-MMC bridge can report activity */
149 led(mmc_usb_active(HZ
));
150 #endif /* STORAGE_MMC */
151 gui_syncstatusbar_draw(&statusbars
, false);
154 #endif /* SIMULATOR */
155 #ifdef HAVE_LCD_CHARCELLS
156 status_set_usb(false);
157 #endif /* HAVE_LCD_CHARCELLS */
159 screens
[i
].backlight_on();
160 global_settings
.statusbar
= statusbar
;
161 #endif /* USB_NONE */
164 #if (CONFIG_STORAGE & STORAGE_MMC)
165 int mmc_remove_request(void)
167 struct queue_event ev
;
170 screens
[i
].clear_display();
171 splash(0, ID2P(LANG_REMOVE_MMC
));
175 queue_wait_w_tmo(&button_queue
, &ev
, HZ
/2);
178 case SYS_HOTSWAP_EXTRACTED
:
179 return SYS_HOTSWAP_EXTRACTED
;
181 case SYS_USB_DISCONNECTED
:
182 return SYS_USB_DISCONNECTED
;
188 /* the charging screen is only used for archos targets */
189 #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) && defined(CPU_SH)
191 #ifdef HAVE_LCD_BITMAP
192 static void charging_display_info(bool animate
)
194 unsigned char charging_logo
[36];
195 const int pox_x
= (LCD_WIDTH
- sizeof(charging_logo
)) / 2;
196 const int pox_y
= 32;
197 static unsigned phase
= 3;
202 #ifdef NEED_ATA_POWER_BATT_MEASURE
203 if (ide_powered()) /* FM and V2 can only measure when ATA power is on */
206 int battv
= battery_voltage();
207 snprintf(buf
, 32, " Batt: %d.%02dV %d%% ", battv
/ 1000,
208 (battv
% 1000) / 10, battery_level());
212 #ifdef ARCHOS_RECORER
213 snprintf(buf
, 32, "Charge mode:");
216 if (charge_state
== CHARGING
)
217 snprintf(buf
, 32, str(LANG_BATTERY_CHARGE
));
218 else if (charge_state
== TOPOFF
)
219 snprintf(buf
, 32, str(LANG_BATTERY_TOPOFF_CHARGE
));
220 else if (charge_state
== TRICKLE
)
221 snprintf(buf
, 32, str(LANG_BATTERY_TRICKLE_CHARGE
));
223 snprintf(buf
, 32, "not charging");
226 if (!charger_enabled())
228 #endif /* ARCHOS_RECORER */
231 memset(charging_logo
+3, 0x00, 32);
232 charging_logo
[0] = 0x3C;
233 charging_logo
[1] = 0x24;
234 charging_logo
[2] = charging_logo
[35] = 0xFF;
237 { /* draw the outline */
239 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 8,
240 sizeof(charging_logo
), 8);
241 lcd_set_drawmode(DRMODE_FG
);
243 charging_logo
[0] = charging_logo
[1] = 0x00;
244 memset(charging_logo
+2, 0x80, 34);
245 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
, sizeof(charging_logo
), 8);
247 memset(charging_logo
+2, 0x01, 34);
248 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 16,
249 sizeof(charging_logo
), 8);
250 lcd_set_drawmode(DRMODE_SOLID
);
253 { /* animate the middle part */
254 for (i
= 3; i
<MIN(sizeof(charging_logo
)-1, phase
); i
++)
256 if ((i
-phase
) % 8 == 0)
257 { /* draw a "bubble" here */
259 bitpos
= (phase
+ i
/8) % 15; /* "bounce" effect */
261 bitpos
= 14 - bitpos
;
262 charging_logo
[i
] = 0x01 << bitpos
;
265 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 8,
266 sizeof(charging_logo
), 8);
271 #else /* not HAVE_LCD_BITMAP */
273 static unsigned long logo_chars
[4];
274 static const unsigned char logo_pattern
[] = {
275 0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, 0, /* char 1 */
276 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 2 */
277 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 3 */
278 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, 0, /* char 4 */
281 static void logo_lock_patterns(bool on
)
287 for (i
= 0; i
< 4; i
++)
288 logo_chars
[i
] = lcd_get_locked_pattern();
292 for (i
= 0; i
< 4; i
++)
293 lcd_unlock_pattern(logo_chars
[i
]);
297 static void charging_display_info(bool animate
)
301 static unsigned phase
= 3;
304 battv
= battery_voltage();
305 snprintf(buf
, sizeof(buf
), " %d.%02dV", battv
/ 1000, (battv
% 1000) / 10);
308 memcpy(buf
, logo_pattern
, 32); /* copy logo patterns */
310 if (!animate
) /* build the screen */
312 lcd_double_height(false);
313 lcd_puts(0, 0, "[Charging]");
314 for (i
= 0; i
< 4; i
++)
315 lcd_putc(i
, 1, logo_chars
[i
]);
317 else /* animate the logo */
319 for (i
= 3; i
< MIN(19, phase
); i
++)
321 if ((i
- phase
) % 5 == 0)
322 { /* draw a "bubble" here */
323 ypos
= (phase
+ i
/5) % 9; /* "bounce" effect */
326 buf
[5 - ypos
+ 8 * (i
/5)] |= 0x10u
>> (i
%5);
332 for (i
= 0; i
< 4; i
++)
333 lcd_define_pattern(logo_chars
[i
], buf
+ 8 * i
);
337 #endif /* (not) HAVE_LCD_BITMAP */
339 /* blocks while charging, returns on event:
340 1 if charger cable was removed
341 2 if Off/Stop key was pressed
342 3 if On key was pressed
343 4 if USB was connected */
345 int charging_screen(void)
350 ide_power_enable(false); /* power down the disk, else would be spinning */
353 backlight_set_timeout(global_settings
.backlight_timeout
);
354 #ifdef HAVE_REMOTE_LCD
355 remote_backlight_set_timeout(global_settings
.remote_backlight_timeout
);
357 backlight_set_timeout_plugged(global_settings
.backlight_timeout_plugged
);
358 gui_syncstatusbar_draw(&statusbars
, true);
360 #ifdef HAVE_LCD_CHARCELLS
361 logo_lock_patterns(true);
363 charging_display_info(false);
367 gui_syncstatusbar_draw(&statusbars
, false);
368 charging_display_info(true);
369 button
= get_action(CONTEXT_STD
,HZ
/3);
370 if (button
== ACTION_STD_OK
)
372 else if (usb_detect() == USB_INSERTED
)
374 else if (!charger_inserted())
378 #ifdef HAVE_LCD_CHARCELLS
379 logo_lock_patterns(false);
383 #endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING && defined(CPU_SH) */
386 void charging_splash(void)
388 splash(2*HZ
, str(LANG_BATTERY_CHARGE
));
389 button_clear_queue();
394 #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
396 /* little helper function for voice output */
397 static void say_time(int cursorpos
, const struct tm
*tm
)
402 if (!global_settings
.talk_menu
)
420 value
= tm
->tm_year
+ 1900;
427 if (cursorpos
== 4) /* month */
428 talk_id(LANG_MONTH_JANUARY
+ tm
->tm_mon
, false);
430 talk_value(value
, unit
, false);
437 #define SEPARATOR ":"
438 bool set_time_screen(const char* title
, struct tm
*tm
)
442 unsigned int i
, j
, s
;
444 unsigned int julianday
;
445 unsigned int realyear
;
447 unsigned int min
, max
;
448 unsigned int statusbar_height
= 0;
449 unsigned int separator_width
, weekday_width
;
450 unsigned int prev_line_height
;
451 int daysinmonth
[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
452 unsigned char buffer
[20];
453 struct viewport vp
[NB_SCREENS
];
456 /* 6 possible cursor possitions, 2 values stored for each: x, y */
457 unsigned int cursor
[6][2];
460 unsigned char *ptr
[6];
462 if(global_settings
.statusbar
)
463 statusbar_height
= STATUSBAR_HEIGHT
;
465 /* speak selection when screen is entered */
466 say_time(cursorpos
, tm
);
469 /* for easy acess in the drawing loop */
470 ptr
[0] = buffer
; /* hours */
471 ptr
[1] = buffer
+ 3; /* minutes */
472 ptr
[2] = buffer
+ 6; /* seconds */
473 ptr
[3] = buffer
+ 9; /* year */
474 ptr
[4] = str(LANG_MONTH_JANUARY
+ tm
->tm_mon
); /* monthname */
475 ptr
[5] = buffer
+ 14; /* day of month */
477 /* calculate the number of days in febuary */
478 realyear
= tm
->tm_year
+ 1900;
479 if((realyear
% 4 == 0 && !(realyear
% 100 == 0)) || realyear
% 400 == 0)
484 /* fix day if month or year changed */
485 if (tm
->tm_mday
> daysinmonth
[tm
->tm_mon
])
486 tm
->tm_mday
= daysinmonth
[tm
->tm_mon
];
488 /* calculate day of week */
489 julianday
= tm
->tm_mday
;
490 for(i
= 0; (int)i
< tm
->tm_mon
; i
++) {
491 julianday
+= daysinmonth
[i
];
494 tm
->tm_wday
= (realyear
+ julianday
+ (realyear
- 1) / 4 -
495 (realyear
- 1) / 100 + (realyear
- 1) / 400 + 7 - 1) % 7;
497 /* put all the numbers we want from the tm struct into
498 an easily printable buffer */
499 snprintf(buffer
, sizeof(buffer
),
500 "%02d " "%02d " "%02d " "%04d " "%02d",
501 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
,
502 tm
->tm_year
+1900, tm
->tm_mday
);
504 /* convert spaces in the buffer to '\0' to make it possible to work
505 directly on the buffer */
506 for(i
=0; i
< sizeof(buffer
); i
++)
514 viewport_set_defaults(&vp
[s
], s
);
515 screens
[s
].set_viewport(&vp
[s
]);
516 nb_lines
= viewport_get_nb_lines(&vp
[s
]);
518 /* minimum lines needed is 2 + title line */
521 vp
[s
].font
= FONT_SYSFIXED
;
522 nb_lines
= viewport_get_nb_lines(&vp
[s
]);
525 /* recalculate the positions and offsets */
527 screens
[s
].getstringsize(title
, NULL
, &prev_line_height
);
529 prev_line_height
= 0;
531 screens
[s
].getstringsize(SEPARATOR
, &separator_width
, NULL
);
534 screens
[s
].getstringsize(str(LANG_WEEKDAY_SUNDAY
+ tm
->tm_wday
),
535 &weekday_width
, NULL
);
536 screens
[s
].getstringsize(" ", &separator_width
, NULL
);
538 for(i
=0, j
=0; i
< 6; i
++)
540 if(i
==3) /* second row */
542 j
= weekday_width
+ separator_width
;;
543 prev_line_height
*= 2;
545 screens
[s
].getstringsize(ptr
[i
], &width
, NULL
);
546 cursor
[i
][INDEX_Y
] = prev_line_height
+ statusbar_height
;
547 cursor
[i
][INDEX_X
] = j
;
548 j
+= width
+ separator_width
;
551 /* draw the screen */
552 screens
[s
].set_viewport(&vp
[s
]);
553 screens
[s
].clear_viewport();
554 /* display the screen title */
555 screens
[s
].puts_scroll(0, 0, title
);
557 /* these are not selectable, so we draw them outside the loop */
558 /* name of the week day */
559 screens
[s
].putsxy(0, cursor
[3][INDEX_Y
],
560 str(LANG_WEEKDAY_SUNDAY
+ tm
->tm_wday
));
562 /* draw the selected item with drawmode set to
563 DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable
564 items with drawmode DRMODE_SOLID */
567 if (cursorpos
== (int)i
)
568 vp
[s
].drawmode
= (DRMODE_SOLID
|DRMODE_INVERSEVID
);
570 screens
[s
].putsxy(cursor
[i
][INDEX_X
],
571 cursor
[i
][INDEX_Y
], ptr
[i
]);
573 vp
[s
].drawmode
= DRMODE_SOLID
;
575 screens
[s
].putsxy(cursor
[i
/4 +1][INDEX_X
] - separator_width
,
576 cursor
[0][INDEX_Y
], SEPARATOR
);
579 /* print help text */
581 screens
[s
].puts(0, 4, str(LANG_TIME_SET_BUTTON
));
583 screens
[s
].puts(0, 5, str(LANG_TIME_REVERT
));
584 screens
[s
].update_viewport();
585 screens
[s
].set_viewport(NULL
);
587 gui_syncstatusbar_draw(&statusbars
, true);
589 /* set the most common numbers */
592 /* calculate the minimum and maximum for the number under cursor */
596 valptr
= &tm
->tm_hour
;
599 valptr
= &tm
->tm_min
;
602 valptr
= &tm
->tm_sec
;
607 valptr
= &tm
->tm_year
;
611 valptr
= &tm
->tm_mon
;
615 max
= daysinmonth
[tm
->tm_mon
];
616 valptr
= &tm
->tm_mday
;
620 button
= get_action(CONTEXT_SETTINGS_TIME
, TIMEOUT_BLOCK
);
622 case ACTION_STD_PREV
:
623 cursorpos
= clamp_value_wrap(--cursorpos
, 5, 0);
624 say_time(cursorpos
, tm
);
626 case ACTION_STD_NEXT
:
627 cursorpos
= clamp_value_wrap(++cursorpos
, 5, 0);
628 say_time(cursorpos
, tm
);
630 case ACTION_SETTINGS_INC
:
631 case ACTION_SETTINGS_INCREPEAT
:
632 *valptr
= clamp_value_wrap(++(*valptr
), max
, min
);
633 say_time(cursorpos
, tm
);
635 case ACTION_SETTINGS_DEC
:
636 case ACTION_SETTINGS_DECREPEAT
:
637 *valptr
= clamp_value_wrap(--(*valptr
), max
, min
);
638 say_time(cursorpos
, tm
);
645 case ACTION_STD_CANCEL
:
651 if (default_event_handler(button
) == SYS_USB_CONNECTED
)
658 #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */
660 #if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
661 bool shutdown_screen(void)
665 long time_entered
= current_tick
;
669 splash(0, str(LANG_CONFIRM_SHUTDOWN
));
671 while(!done
&& TIME_BEFORE(current_tick
,time_entered
+HZ
*2))
673 button
= get_action(CONTEXT_STD
,HZ
);
676 case ACTION_STD_CANCEL
:
680 /* do nothing here, because ACTION_NONE might be caused
681 * by timeout or button release. In case of timeout the loop
682 * is terminated by TIME_BEFORE */
687 if(default_event_handler(button
) == SYS_USB_CONNECTED
)
697 static const int id3_headers
[]=
702 LANG_ID3_ALBUMARTIST
,
713 #if CONFIG_CODEC == SWCODEC
719 struct id3view_info
{
720 struct mp3entry
* id3
;
722 int info_id
[sizeof(id3_headers
)/sizeof(id3_headers
[0])];
724 static char * id3_get_info(int selected_item
, void* data
,
725 char *buffer
, size_t buffer_len
)
727 struct id3view_info
*info
= (struct id3view_info
*)data
;
728 struct mp3entry
* id3
=info
->id3
;
729 int info_no
=selected_item
/2;
730 if(!(selected_item
%2))
732 return( str(id3_headers
[info
->info_id
[info_no
]]));
738 switch(info
->info_id
[info_no
])
740 case 0:/*LANG_ID3_TITLE*/
743 case 1:/*LANG_ID3_ARTIST*/
746 case 2:/*LANG_ID3_ALBUM*/
749 case 3:/*LANG_ID3_ALBUMARTIST*/
750 val
=id3
->albumartist
;
752 case 4:/*LANG_ID3_GROUPING*/
755 case 5:/*LANG_ID3_DISCNUM*/
756 if (id3
->disc_string
)
757 val
= id3
->disc_string
;
758 else if (id3
->discnum
)
760 snprintf(buffer
, buffer_len
, "%d", id3
->discnum
);
764 case 6:/*LANG_ID3_TRACKNUM*/
765 if (id3
->track_string
)
766 val
= id3
->track_string
;
767 else if (id3
->tracknum
)
769 snprintf(buffer
, buffer_len
, "%d", id3
->tracknum
);
773 case 7:/*LANG_ID3_COMMENT*/
776 case 8:/*LANG_ID3_GENRE*/
777 val
= id3
->genre_string
;
779 case 9:/*LANG_ID3_YEAR*/
780 if (id3
->year_string
)
781 val
= id3
->year_string
;
784 snprintf(buffer
, buffer_len
, "%d", id3
->year
);
788 case 10:/*LANG_ID3_LENGTH*/
789 format_time(buffer
, buffer_len
, id3
->length
);
792 case 11:/*LANG_ID3_PLAYLIST*/
793 snprintf(buffer
, buffer_len
, "%d/%d",
794 playlist_get_display_index(), playlist_amount());
797 case 12:/*LANG_ID3_BITRATE*/
798 snprintf(buffer
, buffer_len
, "%d kbps%s", id3
->bitrate
,
799 id3
->vbr
? str(LANG_ID3_VBR
) : (const unsigned char*) "");
802 case 13:/*LANG_ID3_FREQUENCY*/
803 snprintf(buffer
, buffer_len
, "%ld Hz", id3
->frequency
);
806 #if CONFIG_CODEC == SWCODEC
807 case 14:/*LANG_ID3_TRACK_GAIN*/
808 val
=id3
->track_gain_string
;
810 case 15:/*LANG_ID3_ALBUM_GAIN*/
811 val
=id3
->album_gain_string
;
813 case 16:/*LANG_ID3_PATH*/
815 case 14:/*LANG_ID3_PATH*/
820 return val
&& *val
? val
: NULL
;
824 bool browse_id3(void)
826 struct gui_synclist id3_lists
;
827 struct mp3entry
* id3
= audio_current_track();
830 struct id3view_info info
;
833 for (i
=0; i
<sizeof(id3_headers
)/sizeof(id3_headers
[0]); i
++)
837 if (id3_get_info((i
*2)+1, &info
, temp
, 8) != NULL
)
838 info
.info_id
[info
.count
++] = i
;
841 gui_synclist_init(&id3_lists
, &id3_get_info
, &info
, true, 2, NULL
);
842 gui_synclist_set_nb_items(&id3_lists
, info
.count
*2);
843 gui_synclist_draw(&id3_lists
);
844 gui_syncstatusbar_draw(&statusbars
, true);
846 gui_syncstatusbar_draw(&statusbars
, false);
847 key
= get_action(CONTEXT_LIST
,HZ
/2);
848 if(key
!=ACTION_NONE
&& key
!=ACTION_UNKNOWN
849 && !gui_synclist_do_button(&id3_lists
, &key
,LIST_WRAP_UNLESS_HELD
))
851 return(default_event_handler(key
) == SYS_USB_CONNECTED
);
856 static char* runtime_get_data(int selected_item
, void* data
,
857 char* buffer
, size_t buffer_len
)
861 switch (selected_item
)
863 case 0: return str(LANG_RUNNING_TIME
);
864 case 1: t
= global_status
.runtime
; break;
865 case 2: return str(LANG_TOP_TIME
);
866 case 3: t
= global_status
.topruntime
; break;
871 snprintf(buffer
, buffer_len
, "%dh %dm %ds",
872 t
/ 3600, (t
% 3600) / 60, t
% 60);
876 static int runtime_speak_data(int selected_item
, void* data
)
880 (selected_item
< 2) ? LANG_RUNNING_TIME
: LANG_TOP_TIME
,
881 TALK_ID((selected_item
< 2) ? global_status
.runtime
882 : global_status
.topruntime
, UNIT_TIME
));
887 bool view_runtime(void)
889 static const char *lines
[]={ID2P(LANG_CLEAR_TIME
)};
890 static const struct text_message message
={lines
, 1};
892 struct gui_synclist lists
;
894 gui_synclist_init(&lists
, runtime_get_data
, NULL
, false, 2, NULL
);
895 #if !defined(HAVE_LCD_CHARCELLS)
896 gui_synclist_set_title(&lists
, str(LANG_RUNNING_TIME
), NOICON
);
898 gui_synclist_set_title(&lists
, NULL
, NOICON
);
900 if(global_settings
.talk_menu
)
901 gui_synclist_set_voice_callback(&lists
, runtime_speak_data
);
902 gui_synclist_set_icon_callback(&lists
, NULL
);
903 gui_synclist_set_nb_items(&lists
, 4);
904 gui_synclist_speak_item(&lists
);
908 if (charger_inserted())
910 global_status
.runtime
= 0;
915 global_status
.runtime
+= ((current_tick
- lasttime
) / HZ
);
917 lasttime
= current_tick
;
918 gui_synclist_draw(&lists
);
919 gui_syncstatusbar_draw(&statusbars
, true);
920 list_do_action(CONTEXT_STD
, HZ
,
921 &lists
, &action
, LIST_WRAP_UNLESS_HELD
);
922 if(action
== ACTION_STD_CANCEL
)
924 if(action
== ACTION_STD_OK
) {
925 if(gui_syncyesno_run(&message
, NULL
, NULL
)==YESNO_YES
)
927 if (!(gui_synclist_get_sel_pos(&lists
)/2))
928 global_status
.runtime
= 0;
930 global_status
.topruntime
= 0;
931 gui_synclist_speak_item(&lists
);
934 if(default_event_handler(action
) == SYS_USB_CONNECTED
)