From 3de0db0c3b0c2010ffb5c5884e8ec5ec260091d6 Mon Sep 17 00:00:00 2001 From: Hristo Kovachev Date: Tue, 7 Mar 2006 11:49:06 +0000 Subject: Patch FS#4745 by Manuel Dejonghe 1) Get CPU out of idle mode on key press (on targets, supporting changing of the CPU freq), thus making the radio screen more responsive; 2) Mute the radio on startup or after pause, until the chip is tuned or a timeout expires (1, resp 2 sec) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8944 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/radio.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'apps/recorder/radio.c') 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) #endif bool keep_playing = false; bool statusbar = global_settings.statusbar; + int mute_timeout = current_tick; + int button_timeout = current_tick + (2*HZ); #ifdef HAS_BUTTONBAR struct gui_buttonbar buttonbar; gui_buttonbar_init(&buttonbar); @@ -378,6 +380,14 @@ bool radio_screen(void) radio_set(RADIO_IF_MEASUREMENT, 0); radio_set(RADIO_SENSITIVITY, 0); radio_set(RADIO_FORCE_MONO, global_settings.fm_force_mono); + mute_timeout = current_tick + (1*HZ); + while( !radio_get(RADIO_STEREO) + &&!radio_get(RADIO_TUNED) ) + { + if(TIME_AFTER(current_tick, mute_timeout)) + break; + yield(); + } radio_set(RADIO_MUTE, 0); radio_status = FMRADIO_PLAYING; } @@ -429,6 +439,11 @@ bool radio_screen(void) button = button_get(false); else button = button_get_w_tmo(HZ / PEAK_METER_FPS); + if (button != BUTTON_NONE) + { + cpu_idle_mode(false); + button_timeout = current_tick + (2*HZ); + } switch(button) { #ifdef FM_RC_STOP @@ -603,6 +618,14 @@ bool radio_screen(void) { radio_set(RADIO_SLEEP, 0); radio_set(RADIO_FREQUENCY, curr_freq); + mute_timeout = current_tick + (2*HZ); + while( !radio_get(RADIO_STEREO) + &&!radio_get(RADIO_TUNED) ) + { + if(TIME_AFTER(current_tick, mute_timeout)) + break; + yield(); + } radio_set(RADIO_MUTE, 0); radio_status = FMRADIO_PLAYING; } @@ -731,7 +754,7 @@ bool radio_screen(void) default: default_event_handler(button); break; - } + } /*switch(button)*/ if (button != BUTTON_NONE) lastbutton = button; @@ -842,7 +865,11 @@ bool radio_screen(void) { done = true; } - } + if (TIME_AFTER(current_tick, button_timeout)) + { + cpu_idle_mode(true); + } + } /*while(!done)*/ #ifndef SIMULATOR if(audio_status() & AUDIO_STATUS_ERROR) -- cgit v1.2.3