Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: [PATCH] battery display stack overflow
From: Hardeep Sidhu (hardeeps_at_pobox.com)
Date: 2002-07-17


The battery display causes a stack overflow if the battery level is >=
100. Patch attached.

-Hardeep

--- orig/apps/wps.c Tue Jul 16 04:21:59 2002
+++ apps/wps.c Tue Jul 16 22:31:00 2002
@@ -122,7 +122,7 @@
     static bool playing = true;
     struct mp3entry* id3 = mpeg_current_track();
     unsigned int lastlength=0, lastsize=0, lastrate=0;
- int lastartist=0, lastalbum=0, lasttitle=0;
+ int lastartist=0, lastalbum=0, lasttitle=0, batterylevel=0;
     bool lastvbr = false;
 
     lcd_clear_display();
@@ -179,8 +179,12 @@
 
 #ifdef HAVE_LCD_BITMAP
         /* draw battery indicator line */
+ batterylevel = battery_level();
+ if (batterylevel > 100)
+ batterylevel = 100;
+
         lcd_clearline(0,LCD_HEIGHT-1,LCD_WIDTH-1, LCD_HEIGHT-1);
- lcd_drawline(0,LCD_HEIGHT-1,battery_level() * LCD_WIDTH / 100, LCD_HEIGHT-1);
+ lcd_drawline(0,LCD_HEIGHT-1, (batterylevel * LCD_WIDTH / 100)-1, LCD_HEIGHT-1);
 #endif
 
         for ( i=0;i<5;i++ ) {



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa