diff options
author | Anton Oleynikov <len0x@rockbox.org> | 2005-11-16 23:36:35 +0000 |
---|---|---|
committer | Anton Oleynikov <len0x@rockbox.org> | 2005-11-16 23:36:35 +0000 |
commit | d79f3a1e845bcad2d64cbaf467c0f0dae596f537 (patch) | |
tree | 8ebfb49906fd0526582f29625b1d93f0d2cbf36f /apps | |
parent | df0e5effc550db484ca0d377b9f3547fed27cd66 (diff) | |
download | rockbox-d79f3a1e845bcad2d64cbaf467c0f0dae596f537.tar.gz rockbox-d79f3a1e845bcad2d64cbaf467c0f0dae596f537.zip |
added "Auto scan presets" option to radio menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7917 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 39 | ||||
-rw-r--r-- | apps/recorder/radio.c | 85 |
2 files changed, 119 insertions, 5 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 1a4b88c96a..4e712a22af 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1714,9 +1714,9 @@ voice: "" | |||
1714 | new: | 1714 | new: |
1715 | 1715 | ||
1716 | id: LANG_FM_NO_PRESETS | 1716 | id: LANG_FM_NO_PRESETS |
1717 | desc: DEPRECATED | 1717 | desc: error when preset list is empty |
1718 | eng: "" | 1718 | eng: "No presets" |
1719 | voice: "" | 1719 | voice: "No presets" |
1720 | new: | 1720 | new: |
1721 | 1721 | ||
1722 | id: LANG_FM_NO_FREE_PRESETS | 1722 | id: LANG_FM_NO_FREE_PRESETS |
@@ -3384,7 +3384,7 @@ voice: "" | |||
3384 | new: | 3384 | new: |
3385 | 3385 | ||
3386 | id: LANG_FM_FREEZE | 3386 | id: LANG_FM_FREEZE |
3387 | desc: error message when preset list is empty | 3387 | desc: splash screen during freeze in radio mode |
3388 | eng: "Screen frozen!" | 3388 | eng: "Screen frozen!" |
3389 | voice: "" | 3389 | voice: "" |
3390 | new: | 3390 | new: |
@@ -3400,3 +3400,34 @@ desc: in the sound settings menu | |||
3400 | eng: "Crossfeed" | 3400 | eng: "Crossfeed" |
3401 | voice: | 3401 | voice: |
3402 | new: | 3402 | new: |
3403 | |||
3404 | id: LANG_FM_SCAN_PRESETS | ||
3405 | desc: in radio menu | ||
3406 | eng: "Auto scan presets" | ||
3407 | voice: "Auto scan presets" | ||
3408 | new: | ||
3409 | |||
3410 | id: LANG_FM_SCANNING | ||
3411 | desc: during auto scan | ||
3412 | eng: "Scanning %d.%dMHz" | ||
3413 | voice: "" | ||
3414 | new: | ||
3415 | |||
3416 | id: LANG_FM_DEFAULT_PRESET_NAME | ||
3417 | desc: default preset name for auto scan mode | ||
3418 | eng: "%d.%dMHz" | ||
3419 | voice: | ||
3420 | new: | ||
3421 | |||
3422 | id: LANG_FM_ADD_PRESET | ||
3423 | desc: in radio menu | ||
3424 | eng: "Add preset" | ||
3425 | voice: "Add preset" | ||
3426 | new: | ||
3427 | |||
3428 | id: LANG_FM_CLEAR_PRESETS | ||
3429 | desc: confirmation if presets can be cleared | ||
3430 | eng: "Clear current presets?" | ||
3431 | voice: "Clear current presets?" | ||
3432 | new: | ||
3433 | |||
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 1c54602e73..60a14eff3d 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -625,6 +625,11 @@ bool radio_screen(void) | |||
625 | ) | 625 | ) |
626 | break; | 626 | break; |
627 | #endif | 627 | #endif |
628 | if(num_presets < 1){ | ||
629 | gui_syncsplash(HZ, true, str(LANG_FM_NO_PRESETS)); | ||
630 | update_screen = true; | ||
631 | break; | ||
632 | } | ||
628 | handle_radio_presets(); | 633 | handle_radio_presets(); |
629 | curr_preset = find_preset(curr_freq); | 634 | curr_preset = find_preset(curr_freq); |
630 | FOR_NB_SCREENS(i){ | 635 | FOR_NB_SCREENS(i){ |
@@ -1178,6 +1183,83 @@ static bool toggle_mono_mode(void) | |||
1178 | } | 1183 | } |
1179 | 1184 | ||
1180 | 1185 | ||
1186 | static bool scan_presets(void) | ||
1187 | { | ||
1188 | bool exit = false; | ||
1189 | bool tuned = false; | ||
1190 | char buf[32]; | ||
1191 | int freq, i; | ||
1192 | |||
1193 | FOR_NB_SCREENS(i){ | ||
1194 | gui_textarea_clear(&screens[i]); | ||
1195 | screens[i].puts_scroll(0,0,str(LANG_FM_CLEAR_PRESETS)); | ||
1196 | screens[i].puts_scroll(0,2,str(LANG_CONFIRM_WITH_PLAY_RECORDER)); | ||
1197 | screens[i].puts_scroll(0,3,str(LANG_CANCEL_WITH_ANY_RECORDER)); | ||
1198 | gui_textarea_update(&screens[i]); | ||
1199 | } | ||
1200 | |||
1201 | while (!exit) { | ||
1202 | int btn = button_get(true); | ||
1203 | switch (btn) { | ||
1204 | case SETTINGS_OK: | ||
1205 | FOR_NB_SCREENS(i) | ||
1206 | gui_textarea_clear(&screens[i]); | ||
1207 | curr_freq = MIN_FREQ; | ||
1208 | num_presets = 0; | ||
1209 | while(curr_freq <= MAX_FREQ){ | ||
1210 | if (num_presets >= MAX_PRESETS) | ||
1211 | break; | ||
1212 | |||
1213 | freq = curr_freq /100000; | ||
1214 | snprintf(buf, 32, str(LANG_FM_SCANNING), freq/10, freq % 10); | ||
1215 | gui_syncsplash(0, true, buf); | ||
1216 | |||
1217 | /* Tune in and delay */ | ||
1218 | radio_set(RADIO_FREQUENCY, curr_freq); | ||
1219 | sleep(1); | ||
1220 | |||
1221 | /* Start IF measurement */ | ||
1222 | radio_set(RADIO_IF_MEASUREMENT, 1); | ||
1223 | sleep(1); | ||
1224 | |||
1225 | /* Now check how close to the IF frequency we are */ | ||
1226 | tuned = radio_get(RADIO_TUNED); | ||
1227 | |||
1228 | /* add preset */ | ||
1229 | if(tuned){ | ||
1230 | snprintf(buf, 32, str(LANG_FM_DEFAULT_PRESET_NAME),freq/10, freq % 10); | ||
1231 | strcpy(presets[num_presets].name, buf); | ||
1232 | presets[num_presets].frequency = curr_freq; | ||
1233 | menu_insert(preset_menu, -1, | ||
1234 | presets[num_presets].name, 0); | ||
1235 | num_presets++; | ||
1236 | } | ||
1237 | |||
1238 | curr_freq += FREQ_STEP; | ||
1239 | |||
1240 | } | ||
1241 | |||
1242 | rebuild_preset_menu(); | ||
1243 | radio_save_presets(); | ||
1244 | |||
1245 | if(num_presets > 0 ){ | ||
1246 | curr_freq = presets[0].frequency; | ||
1247 | radio_set(RADIO_FREQUENCY, curr_freq); | ||
1248 | remember_frequency(); | ||
1249 | } | ||
1250 | exit = true; | ||
1251 | break; | ||
1252 | |||
1253 | default: | ||
1254 | /* ignore button releases */ | ||
1255 | if (!(btn & BUTTON_REL)) | ||
1256 | exit = true; | ||
1257 | break; | ||
1258 | } | ||
1259 | } | ||
1260 | return true; | ||
1261 | } | ||
1262 | |||
1181 | /* button preprocessor for the main menu */ | 1263 | /* button preprocessor for the main menu */ |
1182 | int radio_menu_cb(int key, int m) | 1264 | int radio_menu_cb(int key, int m) |
1183 | { | 1265 | { |
@@ -1218,13 +1300,14 @@ bool radio_menu(void) | |||
1218 | { ID2P(LANG_FM_BUTTONBAR_PRESETS), handle_radio_presets }, | 1300 | { ID2P(LANG_FM_BUTTONBAR_PRESETS), handle_radio_presets }, |
1219 | #endif | 1301 | #endif |
1220 | #ifndef FM_PRESET_ADD | 1302 | #ifndef FM_PRESET_ADD |
1221 | { ID2P(LANG_FM_BUTTONBAR_ADD) , radio_add_preset }, | 1303 | { ID2P(LANG_FM_ADD_PRESET) , radio_add_preset }, |
1222 | #endif | 1304 | #endif |
1223 | { monomode_menu_string , toggle_mono_mode }, | 1305 | { monomode_menu_string , toggle_mono_mode }, |
1224 | { ID2P(LANG_SOUND_SETTINGS) , sound_menu }, | 1306 | { ID2P(LANG_SOUND_SETTINGS) , sound_menu }, |
1225 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | 1307 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
1226 | { ID2P(LANG_RECORDING_SETTINGS) , fm_recording_settings}, | 1308 | { ID2P(LANG_RECORDING_SETTINGS) , fm_recording_settings}, |
1227 | #endif | 1309 | #endif |
1310 | { ID2P(LANG_FM_SCAN_PRESETS) , scan_presets}, | ||
1228 | }; | 1311 | }; |
1229 | 1312 | ||
1230 | create_monomode_menu(); | 1313 | create_monomode_menu(); |