diff options
Diffstat (limited to 'apps/recorder/radio.c')
-rw-r--r-- | apps/recorder/radio.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index e6e51d976c..0523f1ecac 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -127,8 +127,7 @@ static int curr_freq; /* current frequency in Hz */ | |||
127 | static int radio_mode = RADIO_SCAN_MODE; | 127 | static int radio_mode = RADIO_SCAN_MODE; |
128 | static int search_dir = 0; | 128 | static int search_dir = 0; |
129 | 129 | ||
130 | /* make sure that radio_stop() does a full run after rockbox boots */ | 130 | static int radio_status = FMRADIO_OFF; |
131 | static int radio_status = FMRADIO_PLAYING; | ||
132 | static bool in_screen = false; | 131 | static bool in_screen = false; |
133 | 132 | ||
134 | #define MAX_PRESETS 64 | 133 | #define MAX_PRESETS 64 |
@@ -148,6 +147,7 @@ static int load_preset_list(void); | |||
148 | static int clear_preset_list(void); | 147 | static int clear_preset_list(void); |
149 | 148 | ||
150 | static int scan_presets(void *viewports); | 149 | static int scan_presets(void *viewports); |
150 | static void radio_off(void); | ||
151 | 151 | ||
152 | /* Function to manipulate all yesno dialogues. | 152 | /* Function to manipulate all yesno dialogues. |
153 | This function needs the output text as an argument. */ | 153 | This function needs the output text as an argument. */ |
@@ -165,7 +165,7 @@ static bool yesno_pop(const char* text) | |||
165 | void radio_init(void) | 165 | void radio_init(void) |
166 | { | 166 | { |
167 | tuner_init(); | 167 | tuner_init(); |
168 | radio_stop(); | 168 | radio_off(); |
169 | } | 169 | } |
170 | 170 | ||
171 | int get_radio_status(void) | 171 | int get_radio_status(void) |
@@ -256,15 +256,20 @@ void radio_pause(void) | |||
256 | radio_status = FMRADIO_PAUSED; | 256 | radio_status = FMRADIO_PAUSED; |
257 | } /* radio_pause */ | 257 | } /* radio_pause */ |
258 | 258 | ||
259 | void radio_stop(void) | 259 | static void radio_off(void) |
260 | { | 260 | { |
261 | if(radio_status == FMRADIO_OFF) | ||
262 | return; | ||
263 | |||
264 | tuner_set(RADIO_MUTE, 1); | 261 | tuner_set(RADIO_MUTE, 1); |
265 | tuner_set(RADIO_SLEEP, 1); /* low power mode, if available */ | 262 | tuner_set(RADIO_SLEEP, 1); /* low power mode, if available */ |
266 | radio_status = FMRADIO_OFF; | 263 | radio_status = FMRADIO_OFF; |
267 | tuner_power(false); /* status update, power off if avail. */ | 264 | tuner_power(false); /* status update, power off if avail. */ |
265 | } | ||
266 | |||
267 | void radio_stop(void) | ||
268 | { | ||
269 | if(radio_status == FMRADIO_OFF) | ||
270 | return; | ||
271 | |||
272 | radio_off(); | ||
268 | } /* radio_stop */ | 273 | } /* radio_stop */ |
269 | 274 | ||
270 | bool radio_hardware_present(void) | 275 | bool radio_hardware_present(void) |