1
0
Fork 0
forked from len0rd/rockbox

a bit nicer: delay of the disk activity indicator is supplied by app layer

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6019 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jörg Hohensohn 2005-02-19 14:44:31 +00:00
parent 9828f08d9b
commit 2e429ff762
3 changed files with 12 additions and 11 deletions

View file

@ -160,7 +160,7 @@ void status_draw(bool force_redraw)
info.repeat = global_settings.repeat_mode; info.repeat = global_settings.repeat_mode;
info.playmode = current_playmode(); info.playmode = current_playmode();
#ifndef HAVE_LED #ifndef HAVE_LED
info.led = led_read(); info.led = led_read(HZ/2); /* delay should match polling interval */
#endif #endif
/* only redraw if forced to, or info has changed */ /* only redraw if forced to, or info has changed */

View file

@ -63,13 +63,13 @@ void invert_led(bool on)
#else /* no LED, just status update */ #else /* no LED, just status update */
static long delay; static long last_on; /* timestamp of switching off */
void led(bool on) void led(bool on)
{ {
if (current && !on) /* switching off */ if (current && !on) /* switching off */
{ {
delay = current_tick + HZ/2; /* delay the "off" status a bit */ last_on = current_tick; /* remember for off delay */
} }
current = on; current = on;
} }
@ -79,9 +79,10 @@ void invert_led(bool on)
(void)on; /* no invert feature */ (void)on; /* no invert feature */
} }
bool led_read(void) /* read by status bar update */ bool led_read(int delayticks) /* read by status bar update */
{ {
return (current || TIME_BEFORE(current_tick, delay)); /* reading "off" is delayed by user-supplied monoflop value */
return (current || TIME_BEFORE(current_tick, last_on+delayticks));
} }
#endif // #ifdef HAVE_LED #endif // #ifdef HAVE_LED

View file

@ -25,7 +25,7 @@
extern void led( bool on ); extern void led( bool on );
extern void invert_led( bool on ); extern void invert_led( bool on );
#ifndef HAVE_LED #ifndef HAVE_LED
extern bool led_read(void); /* read for status bar */ extern bool led_read(int delayticks); /* read for status bar */
#endif #endif
#endif #endif