1
0
Fork 0
forked from len0rd/rockbox

Fixed time display in statusbar.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2087 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Markus Braun 2002-08-30 19:44:58 +00:00
parent 5bade50b6a
commit 4e4dfc0848
3 changed files with 13 additions and 15 deletions

View file

@ -290,7 +290,7 @@ void statusbar_icon_lock(void)
/* /*
* Print time to status bar * Print time to status bar
*/ */
void statusbar_time(int minutes) void statusbar_time(int hour, int minute)
{ {
unsigned char buffer[6]; unsigned char buffer[6];
unsigned int width, height; unsigned int width, height;
@ -298,22 +298,13 @@ void statusbar_time(int minutes)
unsigned char *font; unsigned char *font;
#endif #endif
int hour = minutes / 60;
int minute = minutes % 60;
if ( hour >= 0 && if ( hour >= 0 &&
hour <= 23 && hour <= 23 &&
minute >= 0 && minute >= 0 &&
minute <= 59 ) minute <= 59 ) {
{ snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute);
snprintf(buffer, sizeof(buffer), "%d%d:%d%d",
(hour & 0x30) >> 4,
hour & 0x0f,
(minute & 0xf0) >> 4,
minute & 0x0f);
} }
else else {
{
strncpy(buffer, "--:--", sizeof buffer); strncpy(buffer, "--:--", sizeof buffer);
} }

View file

@ -86,6 +86,6 @@ extern void statusbar_icon_play_mode(int mode);
extern void statusbar_icon_shuffle(void); extern void statusbar_icon_shuffle(void);
extern void statusbar_icon_lock(void); extern void statusbar_icon_lock(void);
#ifdef HAVE_RTC #ifdef HAVE_RTC
extern void statusbar_time(int minutes); extern void statusbar_time(int hour, int minute);
#endif #endif
#endif /* End HAVE_LCD_BITMAP */ #endif /* End HAVE_LCD_BITMAP */

View file

@ -69,6 +69,9 @@ void status_draw(void)
{ {
int battlevel = battery_level(); int battlevel = battery_level();
int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume); int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume);
#ifdef HAVE_LCD_BITMAP
int hour, minute;
#endif
#if defined(HAVE_LCD_CHARCELLS) #if defined(HAVE_LCD_CHARCELLS)
lcd_icon(ICON_BATTERY, true); lcd_icon(ICON_BATTERY, true);
@ -172,7 +175,11 @@ void status_draw(void)
if (keys_locked) if (keys_locked)
statusbar_icon_lock(); statusbar_icon_lock();
#ifdef HAVE_RTC #ifdef HAVE_RTC
statusbar_time( rtc_read(3)*60 + rtc_read(2) ); hour = rtc_read(3);
hour = ((hour & 0x30) >> 4) * 10 + (hour & 0x0f);
minute = rtc_read(2);
minute = ((minute & 0x70) >> 4) * 10 + (minute & 0x0f);
statusbar_time(hour, minute);
#endif #endif
#ifdef SIMULATOR #ifdef SIMULATOR