summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-12-03 23:21:13 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-12-03 23:21:13 +0000
commit34a4111adeb00c5bd806c54622c14a2b80d05226 (patch)
treedb37de03632de32dbd6a16b4796a1c3a56a04039
parent66d165819a1c8ef44aad4f07cbebf000be11ceab (diff)
downloadrockbox-34a4111adeb00c5bd806c54622c14a2b80d05226.zip
rockbox-34a4111adeb00c5bd806c54622c14a2b80d05226.tar.gz
rockbox-34a4111adeb00c5bd806c54622c14a2b80d05226.tar.bz2
rockbox-34a4111adeb00c5bd806c54622c14a2b80d05226.tar.xz
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
-rw-r--r--apps/recorder/icons.c17
-rw-r--r--apps/status.c7
2 files changed, 17 insertions, 7 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 2b37be5..3467d2b 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 7e9233a..68d6ac7 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);