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



Rockbox mail archive

Subject: [PATCH] battery display stack overflow

[PATCH] battery display stack overflow

From: Hardeep Sidhu <hardeeps_at_pobox.com>
Date: Tue, 16 Jul 2002 23:01:35 -0700

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
_at__at_ -122,7 +122,7 _at__at_
     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();
_at__at_ -179,8 +179,12 _at__at_
 
 #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++ ) {
Received on 2002-07-17

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy