diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 2cef11ae13..86b4a46a52 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -25,6 +25,7 @@ #include "system.h" #include "lcd.h" +#include "led.h" #include "mpeg.h" #include "mp3_playback.h" #include "mas.h" @@ -179,6 +180,8 @@ bool recording_screen(void) int hours, minutes; char path_buffer[MAX_PATH]; bool been_in_usb_mode = false; + bool led_state; + int led_delay; cursor = 0; mpeg_init_recording(); @@ -210,9 +213,34 @@ bool recording_screen(void) if(rec_create_directory() > 0) have_recorded = true; + + led_state = false; + led_delay = 0; while(!done) { + /* + * Flash the LED while waiting to record. Turn it on while + * recording. + */ + if(mpeg_status() != MPEG_STATUS_RECORD) + { + if(led_delay++ >= 4) + { + led_state = !led_state; + invert_led(led_state); + led_delay = 0; + } + } + else + { + if(!led_state) + { + led_state = true; + invert_led(true); + } + } + button = button_get_w_tmo(HZ / peak_meter_fps); switch(button) { @@ -565,7 +593,6 @@ bool recording_screen(void) done = true; } } - if(mpeg_status() & MPEG_STATUS_ERROR) { status_set_playmode(STATUS_STOP); @@ -582,6 +609,8 @@ bool recording_screen(void) } } + invert_led(false); + mpeg_init_playback(); mpeg_sound_channel_config(global_settings.channel_config); diff --git a/docs/CREDITS b/docs/CREDITS index 30c4ed2900..0bd693381d 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -85,3 +85,4 @@ Francois Boucher Matthias Wientapper Brent Coutts Jens Arnold +Gerald Vanbaren diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index adeb2714e0..f3b0693c6d 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c @@ -22,9 +22,13 @@ #include "led.h" #include "system.h" +static bool xor; +static bool current; + void led(bool on) { - if ( on ) + current = on; + if ( on ^ xor ) { or_b(0x40, &PBDRL); } @@ -33,3 +37,17 @@ void led(bool on) and_b(~0x40, &PBDRL); } } + +void invert_led(bool on) +{ + if ( on ) + { + xor = 1; + } + else + { + xor = 0; + } + led(current); +} + diff --git a/firmware/export/led.h b/firmware/export/led.h index 9b2552f738..cc035b9345 100644 --- a/firmware/export/led.h +++ b/firmware/export/led.h @@ -23,5 +23,6 @@ #include extern void led( bool on ); +extern void invert_led( bool on ); #endif