From 34a4111adeb00c5bd806c54622c14a2b80d05226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Wed, 3 Dec 2003 23:21:13 +0000 Subject: [PATCH] Battery meter now shows '?' after boot instead of nothing at all. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4103 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/icons.c | 17 +++++++++++++---- apps/status.c | 7 ++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 2b37be5e62..3467d2bb3d 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c @@ -158,17 +158,19 @@ void statusbar_icon_battery(int percent, bool charging) fill = 100; #ifdef SIMULATOR - if (global_settings.battery_type) { + if (global_settings.battery_type && (percent > -1)) { #else #ifdef HAVE_CHARGE_CTRL /* Recorder */ /* show graphical animation when charging instead of numbers */ - if ((global_settings.battery_type) && (charge_state != 1)) { + if ((global_settings.battery_type) && + (charge_state != 1) && + (percent > -1)) { #else /* FM */ - if (global_settings.battery_type) { + if (global_settings.battery_type && (percent > -1)) { #endif /* HAVE_CHARGE_CTRL */ #endif /* Numeric display */ - snprintf(buffer, sizeof(buffer), "%3d", percent); + snprintf(buffer, sizeof(buffer), "%3d", fill); lcd_setfont(FONT_SYSFIXED); lcd_getstringsize(buffer, &width, &height); if (height <= STATUSBAR_HEIGHT) @@ -188,6 +190,13 @@ void statusbar_icon_battery(int percent, bool charging) lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5); } + if (percent == -1) { + lcd_setfont(FONT_SYSFIXED); + lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 - 4, + STATUSBAR_Y_POS, "?"); + lcd_setfont(FONT_UI); + } + /* draw power plug if charging */ if (charging) lcd_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS, diff --git a/apps/status.c b/apps/status.c index 7e9233a63f..68d6ac74c1 100644 --- a/apps/status.c +++ b/apps/status.c @@ -40,7 +40,7 @@ static enum playmode current_mode = STATUS_STOP; static long switch_tick; static int battery_charge_step = 0; static bool plug_state; -static bool battery_state; +static bool battery_state = true; struct status_info { int battlevel; @@ -167,7 +167,8 @@ void status_draw(bool force_redraw) battery_state = true; else { /* blink battery if level is low */ - if(TIME_AFTER(current_tick, switch_tick)) { + if(TIME_AFTER(current_tick, switch_tick) && + (info.battlevel > -1)) { switch_tick = current_tick+HZ; battery_state =! battery_state; } @@ -175,7 +176,7 @@ void status_draw(bool force_redraw) } #ifdef HAVE_LCD_BITMAP - if (battery_state && (info.battlevel > -1)) + if (battery_state) statusbar_icon_battery(info.battlevel, plug_state); statusbar_icon_volume(info.volume);