summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/recorder/icons.c28
-rw-r--r--apps/recorder/icons.h2
-rw-r--r--apps/status.c12
3 files changed, 26 insertions, 16 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index d1ee11dbed..3f6518903f 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -290,23 +290,33 @@ void statusbar_icon_lock(void)
/*
* Print time to status bar
*/
-void statusbar_time(void)
+void statusbar_time(int minutes)
{
- int hour,minute;
unsigned char buffer[6];
unsigned int width, height;
#if defined(LOADABLE_FONTS)
unsigned char *font;
#endif
- hour = rtc_read(0x03);
- minute = rtc_read(0x02);
+ int hour = minutes / 60;
+ int minute = minutes % 60;
+
+ if ( hour >= 0 &&
+ hour <= 23 &&
+ minute >= 0 &&
+ minute <= 59 )
+ {
+ snprintf(buffer, sizeof(buffer), "%d%d:%d%d",
+ (hour & 0x30) >> 4,
+ hour & 0x0f,
+ (minute & 0xf0) >> 4,
+ minute & 0x0f);
+ }
+ else
+ {
+ strncpy(buffer, "--:--", sizeof buffer);
+ }
- snprintf(buffer, sizeof(buffer), "%d%d:%d%d",
- (hour & 0x30) >> 4,
- hour & 0x0f,
- (minute & 0xf0) >> 4,
- minute & 0x0f);
#if defined(LCD_PROPFONTS)
lcd_getstringsize(buffer, 0, &width, &height);
#elif defined(LOADABLE_FONTS)
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index ff6a011b98..cebff7ca2c 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -86,6 +86,6 @@ extern void statusbar_icon_play_mode(int mode);
extern void statusbar_icon_shuffle(void);
extern void statusbar_icon_lock(void);
#ifdef HAVE_RTC
-extern void statusbar_time(void);
+extern void statusbar_time(int minutes);
#endif
#endif /* End HAVE_LCD_BITMAP */
diff --git a/apps/status.c b/apps/status.c
index c777a9e8ab..38a732a814 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -48,6 +48,7 @@ void status_init(void)
void status_set_playmode(enum playmode mode)
{
current_mode = mode;
+ status_draw();
}
#ifdef HAVE_LCD_BITMAP
@@ -63,10 +64,10 @@ bool statusbar(bool state)
void status_draw(void)
{
-#if defined(HAVE_LCD_CHARCELLS)
int battlevel = battery_level();
int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume);
+#if defined(HAVE_LCD_CHARCELLS)
lcd_icon(ICON_BATTERY, true);
if(battlevel > 25)
lcd_icon(ICON_BATTERY_1, true);
@@ -126,9 +127,6 @@ void status_draw(void)
}
#endif
#ifdef HAVE_LCD_BITMAP
- int battlevel = battery_level();
- int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume);
-
if(global_settings.statusbar && statusbar_enabled) {
statusbar_wipe();
#ifdef HAVE_CHARGE_CTRL
@@ -155,7 +153,8 @@ void status_draw(void)
}
}
- if(battery_state) statusbar_icon_battery(battlevel, plug_state);
+ if (battery_state)
+ statusbar_icon_battery(battlevel, plug_state);
#else
statusbar_icon_battery(battlevel, false);
#endif
@@ -170,8 +169,9 @@ void status_draw(void)
if (keys_locked)
statusbar_icon_lock();
#ifdef HAVE_RTC
- statusbar_time();
+ statusbar_time( rtc_read(3)*60 + rtc_read(2) );
#endif
+
#ifdef SIMULATOR
lcd_update();
#else