Make sure statusbar is updated when time changes. Fixes FS #7388. Moved time variable around and added init of info struct.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13802 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Peter D'Hoye 2007-07-05 23:20:58 +00:00
parent 9b20dfd88f
commit 16b67e5812
2 changed files with 14 additions and 7 deletions

View file

@ -157,6 +157,10 @@ static void gui_statusbar_init(struct gui_statusbar * bar)
{
bar->redraw_volume = true;
bar->volume_icon_switch_tick = bar->battery_icon_switch_tick = current_tick;
memset((void*)&(bar->lastinfo), 0, sizeof(struct status_info));
#if CONFIG_RTC
bar->last_tm_min = 0;
#endif
}
void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
@ -239,11 +243,14 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
bar->info.led = led_read(HZ/2); /* delay should match polling interval */
#endif
#if CONFIG_RTC
bar->info.time = get_time();
bar->time = get_time();
#endif /* CONFIG_RTC */
/* only redraw if forced to, or info has changed */
if (force_redraw || bar->redraw_volume ||
#if CONFIG_RTC
(bar->time->tm_min != bar->last_tm_min) ||
#endif
memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
{
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
@ -313,7 +320,8 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
gui_statusbar_icon_lock_remote(display);
#endif
#if CONFIG_RTC
gui_statusbar_time(display, bar->info.time);
gui_statusbar_time(display, bar->time);
bar->last_tm_min = bar->time->tm_min;
#endif /* CONFIG_RTC */
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
if(!display->has_disk_led && bar->info.led)

View file

@ -33,10 +33,6 @@ struct status_info {
int volume;
int playmode;
int repeat;
#if CONFIG_RTC
struct tm *time;
#endif
#if CONFIG_CHARGING
bool inserted;
#endif
@ -65,7 +61,10 @@ struct gui_statusbar
struct status_info info;
struct status_info lastinfo;
#if CONFIG_RTC
struct tm *time;
int last_tm_min;
#endif
struct screen * display;
};