diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/recorder/radio.c | 14 | ||||
-rw-r--r-- | apps/settings.c | 3 | ||||
-rw-r--r-- | apps/settings.h | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index ce4bc8b4d6..00223a070e 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -68,7 +68,7 @@ static int fm_in1 = DEFAULT_IN1; | |||
68 | static int fm_in2 = DEFAULT_IN2; | 68 | static int fm_in2 = DEFAULT_IN2; |
69 | 69 | ||
70 | static int curr_preset = -1; | 70 | static int curr_preset = -1; |
71 | static int curr_freq = 99400000; | 71 | static int curr_freq; |
72 | static int pll_cnt; | 72 | static int pll_cnt; |
73 | 73 | ||
74 | #define MAX_PRESETS 32 | 74 | #define MAX_PRESETS 32 |
@@ -159,6 +159,12 @@ static int find_preset(int freq) | |||
159 | return -1; | 159 | return -1; |
160 | } | 160 | } |
161 | 161 | ||
162 | static void remember_frequency(void) | ||
163 | { | ||
164 | global_settings.last_frequency = (curr_freq - MIN_FREQ) / FREQ_STEP; | ||
165 | settings_save(); | ||
166 | } | ||
167 | |||
162 | bool radio_screen(void) | 168 | bool radio_screen(void) |
163 | { | 169 | { |
164 | char buf[MAX_PATH]; | 170 | char buf[MAX_PATH]; |
@@ -224,6 +230,8 @@ bool radio_screen(void) | |||
224 | mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), | 230 | mpeg_set_recording_gain(mpeg_sound_default(SOUND_LEFT_GAIN), |
225 | mpeg_sound_default(SOUND_RIGHT_GAIN), false); | 231 | mpeg_sound_default(SOUND_RIGHT_GAIN), false); |
226 | #endif | 232 | #endif |
233 | |||
234 | curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ; | ||
227 | 235 | ||
228 | fmradio_set(1, DEFAULT_IN1); | 236 | fmradio_set(1, DEFAULT_IN1); |
229 | fmradio_set(2, DEFAULT_IN2); | 237 | fmradio_set(2, DEFAULT_IN2); |
@@ -266,6 +274,7 @@ bool radio_screen(void) | |||
266 | { | 274 | { |
267 | search_dir = 0; | 275 | search_dir = 0; |
268 | curr_preset = find_preset(curr_freq); | 276 | curr_preset = find_preset(curr_freq); |
277 | remember_frequency(); | ||
269 | } | 278 | } |
270 | 279 | ||
271 | update_screen = true; | 280 | update_screen = true; |
@@ -322,6 +331,7 @@ bool radio_screen(void) | |||
322 | 331 | ||
323 | radio_set(RADIO_FREQUENCY, curr_freq); | 332 | radio_set(RADIO_FREQUENCY, curr_freq); |
324 | curr_preset = find_preset(curr_freq); | 333 | curr_preset = find_preset(curr_freq); |
334 | remember_frequency(); | ||
325 | search_dir = 0; | 335 | search_dir = 0; |
326 | update_screen = true; | 336 | update_screen = true; |
327 | break; | 337 | break; |
@@ -333,6 +343,7 @@ bool radio_screen(void) | |||
333 | 343 | ||
334 | radio_set(RADIO_FREQUENCY, curr_freq); | 344 | radio_set(RADIO_FREQUENCY, curr_freq); |
335 | curr_preset = find_preset(curr_freq); | 345 | curr_preset = find_preset(curr_freq); |
346 | remember_frequency(); | ||
336 | search_dir = 0; | 347 | search_dir = 0; |
337 | update_screen = true; | 348 | update_screen = true; |
338 | break; | 349 | break; |
@@ -765,6 +776,7 @@ bool handle_radio_presets(void) | |||
765 | i = menu_cursor(preset_menu); | 776 | i = menu_cursor(preset_menu); |
766 | curr_freq = presets[i].frequency; | 777 | curr_freq = presets[i].frequency; |
767 | radio_set(RADIO_FREQUENCY, curr_freq); | 778 | radio_set(RADIO_FREQUENCY, curr_freq); |
779 | remember_frequency(); | ||
768 | } | 780 | } |
769 | } | 781 | } |
770 | 782 | ||
diff --git a/apps/settings.c b/apps/settings.c index 8434d3e211..925da81526 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -222,9 +222,10 @@ static struct bit_entry rtc_bits[] = | |||
222 | /* If values are just added to the end, no need to bump the version. */ | 222 | /* If values are just added to the end, no need to bump the version. */ |
223 | #ifdef HAVE_FMRADIO | 223 | #ifdef HAVE_FMRADIO |
224 | {1, S_O(fm_force_mono), false, "force fm mono", off_on }, | 224 | {1, S_O(fm_force_mono), false, "force fm mono", off_on }, |
225 | {8, S_O(last_frequency), 994, NULL, NULL }, | ||
225 | #endif | 226 | #endif |
226 | 227 | ||
227 | /* Current sum of bits: 271 (worst case) */ | 228 | /* Current sum of bits: 286 (worst case) */ |
228 | /* Sum of all bit sizes must not grow beyond 288! */ | 229 | /* Sum of all bit sizes must not grow beyond 288! */ |
229 | }; | 230 | }; |
230 | 231 | ||
diff --git a/apps/settings.h b/apps/settings.h index b7b0864b4c..0ca0e7d7f2 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -195,6 +195,8 @@ struct user_settings | |||
195 | bool fm_force_mono; /* Forces Mono mode if true */ | 195 | bool fm_force_mono; /* Forces Mono mode if true */ |
196 | bool fm_full_range; /* Enables full 10MHz-160MHz range if true, else | 196 | bool fm_full_range; /* Enables full 10MHz-160MHz range if true, else |
197 | only 88MHz-108MHz */ | 197 | only 88MHz-108MHz */ |
198 | int last_frequency; /* Last frequency for resuming, in FREQ_STEP units, | ||
199 | relative to MIN_FREQ */ | ||
198 | #endif | 200 | #endif |
199 | 201 | ||
200 | int max_files_in_dir; /* Max entries in directory (file browser) */ | 202 | int max_files_in_dir; /* Max entries in directory (file browser) */ |