forked from len0rd/rockbox
Using TIME_AFTER() macro to prevent wrap problem
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1595 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
709382c801
commit
b1cb534856
1 changed files with 3 additions and 6 deletions
|
@ -34,15 +34,12 @@ static enum playmode current_mode = STATUS_STOP;
|
|||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
bool statusbar_enabled = true;
|
||||
long last_tick;
|
||||
long switch_tick;
|
||||
bool plug_state;
|
||||
#endif
|
||||
|
||||
void status_init(void)
|
||||
{
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
last_tick = current_tick;
|
||||
#endif
|
||||
status_set_playmode(STATUS_STOP);
|
||||
}
|
||||
|
||||
|
@ -138,9 +135,9 @@ void status_draw(void)
|
|||
if(charger_inserted()) {
|
||||
if(!charger_enabled)
|
||||
plug_state=true;
|
||||
else if(current_tick-last_tick>HZ) {
|
||||
else if(TIME_AFTER(current_tick, switch_tick)) {
|
||||
plug_state=!plug_state;
|
||||
last_tick=current_tick;
|
||||
switch_tick=current_tick+HZ;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue