diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index dc286fb222..4f6fca4fa3 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -69,7 +69,8 @@ bool radio_screen(void) lcd_clear_display(); lcd_setmargins(0, 8); status_draw(false); - + fmradio_set_status(FMRADIO_PLAYING); + /* Enable the Left and right A/D Converter */ mas_codec_writereg(0x0, 0xccc7); @@ -182,6 +183,8 @@ bool radio_screen(void) break; } } + + fmradio_set_status(0); return false; } #endif diff --git a/firmware/drivers/fmradio.c b/firmware/drivers/fmradio.c index 0d947f4480..14abb8e2b0 100644 --- a/firmware/drivers/fmradio.c +++ b/firmware/drivers/fmradio.c @@ -50,17 +50,7 @@ /* delay loop */ #define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0) -static struct mutex fmradio_mtx; - -void fmradio_begin(void) -{ - mutex_lock(&fmradio_mtx); -} - -void fmradio_end(void) -{ - mutex_unlock(&fmradio_mtx); -} +static int fmstatus = 0; int fmradio_read(int addr) { @@ -130,4 +120,14 @@ void fmradio_set(int addr, int data) CE_LO; } +void fmradio_set_status(int status) +{ + fmstatus = status; +} + +int fmradio_get_status(void) +{ + return fmstatus; +} + #endif diff --git a/firmware/export/fmradio.h b/firmware/export/fmradio.h index 2877501361..b5b239bde1 100644 --- a/firmware/export/fmradio.h +++ b/firmware/export/fmradio.h @@ -21,5 +21,9 @@ extern int fmradio_read(int addr); extern void fmradio_set(int addr, int data); +extern void fmradio_set_status(int status); +extern int fmradio_get_status(void); + +#define FMRADIO_PLAYING 1 #endif diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index e04e520ad1..00492bbcc6 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -34,6 +34,9 @@ #include "usb.h" #include "powermgmt.h" #include "backlight.h" +#ifdef HAVE_FMRADIO +#include "fmradio.h" +#endif #ifdef SIMULATOR @@ -299,6 +302,9 @@ static void handle_auto_poweroff(void) charger_was_inserted = charger_is_inserted; if(timeout && +#ifdef HAVE_FMRADIO + !fmradio_get_status() && +#endif !usb_inserted() && (mpeg_stat == 0 || mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)))