summaryrefslogtreecommitdiff
path: root/apps/recorder/radio.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/radio.c')
-rw-r--r--apps/recorder/radio.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 7b533e9184..3a218266d3 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -304,6 +304,8 @@ bool radio_screen(void)
304#endif 304#endif
305 bool keep_playing = false; 305 bool keep_playing = false;
306 bool statusbar = global_settings.statusbar; 306 bool statusbar = global_settings.statusbar;
307 int mute_timeout = current_tick;
308 int button_timeout = current_tick + (2*HZ);
307#ifdef HAS_BUTTONBAR 309#ifdef HAS_BUTTONBAR
308 struct gui_buttonbar buttonbar; 310 struct gui_buttonbar buttonbar;
309 gui_buttonbar_init(&buttonbar); 311 gui_buttonbar_init(&buttonbar);
@@ -378,6 +380,14 @@ bool radio_screen(void)
378 radio_set(RADIO_IF_MEASUREMENT, 0); 380 radio_set(RADIO_IF_MEASUREMENT, 0);
379 radio_set(RADIO_SENSITIVITY, 0); 381 radio_set(RADIO_SENSITIVITY, 0);
380 radio_set(RADIO_FORCE_MONO, global_settings.fm_force_mono); 382 radio_set(RADIO_FORCE_MONO, global_settings.fm_force_mono);
383 mute_timeout = current_tick + (1*HZ);
384 while( !radio_get(RADIO_STEREO)
385 &&!radio_get(RADIO_TUNED) )
386 {
387 if(TIME_AFTER(current_tick, mute_timeout))
388 break;
389 yield();
390 }
381 radio_set(RADIO_MUTE, 0); 391 radio_set(RADIO_MUTE, 0);
382 radio_status = FMRADIO_PLAYING; 392 radio_status = FMRADIO_PLAYING;
383 } 393 }
@@ -429,6 +439,11 @@ bool radio_screen(void)
429 button = button_get(false); 439 button = button_get(false);
430 else 440 else
431 button = button_get_w_tmo(HZ / PEAK_METER_FPS); 441 button = button_get_w_tmo(HZ / PEAK_METER_FPS);
442 if (button != BUTTON_NONE)
443 {
444 cpu_idle_mode(false);
445 button_timeout = current_tick + (2*HZ);
446 }
432 switch(button) 447 switch(button)
433 { 448 {
434#ifdef FM_RC_STOP 449#ifdef FM_RC_STOP
@@ -603,6 +618,14 @@ bool radio_screen(void)
603 { 618 {
604 radio_set(RADIO_SLEEP, 0); 619 radio_set(RADIO_SLEEP, 0);
605 radio_set(RADIO_FREQUENCY, curr_freq); 620 radio_set(RADIO_FREQUENCY, curr_freq);
621 mute_timeout = current_tick + (2*HZ);
622 while( !radio_get(RADIO_STEREO)
623 &&!radio_get(RADIO_TUNED) )
624 {
625 if(TIME_AFTER(current_tick, mute_timeout))
626 break;
627 yield();
628 }
606 radio_set(RADIO_MUTE, 0); 629 radio_set(RADIO_MUTE, 0);
607 radio_status = FMRADIO_PLAYING; 630 radio_status = FMRADIO_PLAYING;
608 } 631 }
@@ -731,7 +754,7 @@ bool radio_screen(void)
731 default: 754 default:
732 default_event_handler(button); 755 default_event_handler(button);
733 break; 756 break;
734 } 757 } /*switch(button)*/
735 758
736 if (button != BUTTON_NONE) 759 if (button != BUTTON_NONE)
737 lastbutton = button; 760 lastbutton = button;
@@ -842,7 +865,11 @@ bool radio_screen(void)
842 { 865 {
843 done = true; 866 done = true;
844 } 867 }
845 } 868 if (TIME_AFTER(current_tick, button_timeout))
869 {
870 cpu_idle_mode(true);
871 }
872 } /*while(!done)*/
846 873
847#ifndef SIMULATOR 874#ifndef SIMULATOR
848 if(audio_status() & AUDIO_STATUS_ERROR) 875 if(audio_status() & AUDIO_STATUS_ERROR)