Index: apps/recorder/radio.c =================================================================== --- apps/recorder/radio.c (Revision 16718) +++ apps/recorder/radio.c (Arbeitskopie) @@ -196,6 +196,8 @@ tuner_set(RADIO_REGION, global_settings.fm_region); #endif tuner_set(RADIO_FORCE_MONO, global_settings.fm_force_mono); + toggle_auto_mute(global_settings.fm_auto_mute); + touch_auto_mute_threshold(global_settings.fm_auto_mute_threshold); } tuner_set(RADIO_FREQUENCY, curr_freq); @@ -457,6 +459,11 @@ gui_buttonbar_init(&buttonbar); gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); #endif +#ifdef HAVE_RADIO_FIELD_METER + int field_strength=0; + int field_strength_last=0; + char mute_icon='?'; +#endif /* change status to "in screen" */ in_screen = true; @@ -873,7 +880,32 @@ update_screen = true; last_stereo = stereo; } + } +#ifdef HAVE_RADIO_FIELD_METER + field_strength = tuner_get(RADIO_FIELD_STRENGTH); + if(field_strength != field_strength_last) + { + update_screen = true; + field_strength_last = field_strength; + } + /* auto mute weak stations */ + if( (field_strength <= global_settings.fm_auto_mute_threshold) && ( global_settings.fm_auto_mute == true ) ) + { + tuner_set(RADIO_MUTE, 1); + mute_icon='-'; + } + else + { + if (radio_status!=FMRADIO_PAUSED) + { + tuner_set(RADIO_MUTE, 0); + } + mute_icon='O'; + } + + +#endif } #if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) @@ -896,8 +928,8 @@ FOR_NB_SCREENS(i) screens[i].puts_scroll(0, top_of_screen, buf); - freq = curr_freq / 10000; - snprintf(buf, 128, str(LANG_FM_STATION), freq / 100, freq % 100); + freq = curr_freq / 1000; + snprintf(buf, 128, str(LANG_FM_STATION), freq / 1000, freq % 1000); FOR_NB_SCREENS(i) screens[i].puts_scroll(0, top_of_screen + 1, buf); @@ -911,6 +943,17 @@ str(LANG_RADIO_SCAN_MODE)); FOR_NB_SCREENS(i) screens[i].puts_scroll(0, top_of_screen + 3, buf); +#ifdef HAVE_RADIO_FIELD_METER + snprintf(buf, 128, "Sig: [%c%c] %ddBuV",mute_icon , global_settings.fm_auto_mute == true ? 'M' : '-' , field_strength); + FOR_NB_SCREENS(i) + screens[i].puts_scroll(0, top_of_screen + 4, buf); + if ( global_settings.fm_auto_mute==true ) + { + snprintf(buf, 128, "%s %ddBuV",str(LANG_FM_AUTO_MUTE_BELOW), global_settings.fm_auto_mute_threshold); + FOR_NB_SCREENS(i) + screens[i].puts_scroll(0, top_of_screen + 5, buf); + } +#endif #if CONFIG_CODEC != SWCODEC if(audio_status() == AUDIO_STATUS_RECORD) @@ -1380,6 +1423,16 @@ tuner_set(RADIO_FORCE_MONO, mono); } +void toggle_auto_mute(bool auto_mute) +{ + auto_mute=auto_mute; +} + +void touch_auto_mute_threshold(int threshold) +{ + threshold=threshold; +} + void set_radio_region(int region) { #ifdef HAVE_RADIO_REGION @@ -1392,6 +1445,8 @@ MENUITEM_SETTING(set_region, &global_settings.fm_region, NULL); MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL); +MENUITEM_SETTING(auto_mute, &global_settings.fm_auto_mute, NULL); +MENUITEM_SETTING(auto_mute_threshold, &global_settings.fm_auto_mute_threshold, NULL); #ifndef FM_MODE char* get_mode_text(int selected_item, void * data, char *buffer) @@ -1569,6 +1624,8 @@ #endif &presetload_item, &presetsave_item, &presetclear_item, &force_mono, + &auto_mute, + &auto_mute_threshold, #ifndef FM_MODE &radio_mode_item, #endif Index: apps/recorder/radio.h =================================================================== --- apps/recorder/radio.h (Revision 16718) +++ apps/recorder/radio.h (Arbeitskopie) @@ -35,6 +35,12 @@ /* callbacks for the radio settings */ void set_radio_region(int region); void toggle_mono_mode(bool mono); +void toggle_auto_mute(bool auto_mute); +void touch_auto_mute_threshold(int threshold); +/* +bool ind_auto_mute; +int ind_auto_mute_threshold; +*/ #define MAX_FMPRESET_LEN 27 Index: apps/lang/deutsch.lang =================================================================== --- apps/lang/deutsch.lang (Revision 16718) +++ apps/lang/deutsch.lang (Arbeitskopie) @@ -11532,3 +11532,45 @@ swcodec: "Tastentöne Wiederholung" + + id: LANG_FM_AUTO_MUTE + desc: FM auto mute in tuner menu + user: + + *: "Automute weak stations" + + + *: "Schwache Signale ausblenden" + + + *: "Schwache Signale ausblenden" + + + + id: LANG_FM_AUTO_MUTE_THRESHOLD + desc: FM auto mute threshold in tuner menu + user: + + *: "Automute below..." + + + *: "Ausblenden bis..." + + + *: "Ausblenden bis..." + + + + id: LANG_FM_AUTO_MUTE_BELOW + desc: FM auto mute threshold in radio screen + user: + + *: "Automute below " + + + *: "Ausblenden bis " + + + *: "Ausblenden bis " + + Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (Revision 16718) +++ apps/lang/english.lang (Arbeitskopie) @@ -11576,3 +11576,45 @@ swcodec: "Keyclick Repeats" + + id: LANG_FM_AUTO_MUTE + desc: FM auto mute in tuner menu + user: + + *: "Automute weak stations" + + + *: "Automute weak stations" + + + *: "Automute weak stations" + + + + id: LANG_FM_AUTO_MUTE_THRESHOLD + desc: FM auto mute threshold in tuner menu + user: + + *: "Automute below..." + + + *: "Automute below..." + + + *: "Automute below..." + + + + id: LANG_FM_AUTO_MUTE_BELOW + desc: FM auto mute threshold in radio screen + user: + + *: "Automute below " + + + *: "Automute below " + + + *: "Automute below " + + Index: apps/settings.h =================================================================== --- apps/settings.h (Revision 16718) +++ apps/settings.h (Arbeitskopie) @@ -500,7 +500,9 @@ #if CONFIG_TUNER int fm_freq_step; /* Frequency step for manual tuning, in kHz */ + int fm_auto_mute_threshold; /* Forces Mono mode if true */ bool fm_force_mono; /* Forces Mono mode if true */ + bool fm_auto_mute; /* Forces Mono mode if true */ bool fm_full_range; /* Enables full 10MHz-160MHz range if true, else only 88MHz-108MHz */ #endif Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (Revision 16718) +++ apps/settings_list.c (Arbeitskopie) @@ -240,6 +240,19 @@ #endif /* HAVE_RECORDING */ +#ifdef CONFIG_TUNER + +static void automute_formatter(char *buffer, size_t buffer_size, + int val, const char *unit) +{ + snprintf(buffer, buffer_size, "%d dBuV%s", val, unit); +} +static int32_t automute_getlang(int value, int unit) +{ + return TALK_ID(value, unit); +} +#endif + static void formatter_unit_0_is_off(char *buffer, size_t buffer_size, int val, const char *unit) { @@ -506,6 +519,11 @@ #if CONFIG_TUNER OFFON_SETTING(0,fm_force_mono, LANG_FM_MONO_MODE, false, "force fm mono", toggle_mono_mode), + OFFON_SETTING(0,fm_auto_mute, LANG_FM_AUTO_MUTE, + false, "mute weak stations", toggle_auto_mute), + TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, fm_auto_mute_threshold, LANG_FM_AUTO_MUTE_THRESHOLD, -235, "mute weak stations threshold", NULL, + UNIT_INT, automute_formatter, automute_getlang, touch_auto_mute_threshold, 7, -1195,-555,-235,-75,5,45,75), + SYSTEM_SETTING(NVRAM(4),last_frequency,0), #endif Index: firmware/export/tuner.h =================================================================== --- firmware/export/tuner.h (Revision 16718) +++ firmware/export/tuner.h (Arbeitskopie) @@ -31,7 +31,6 @@ RADIO_MUTE, RADIO_FORCE_MONO, RADIO_SCAN_FREQUENCY, - /* Put new general-purpose settings above this line */ __RADIO_SET_STANDARD_LAST }; @@ -42,7 +41,7 @@ RADIO_PRESENT = 0, RADIO_TUNED, RADIO_STEREO, - + RADIO_FIELD_STRENGTH, /* Put new general-purpose readback values above this line */ __RADIO_GET_STANDARD_LAST }; Index: firmware/export/lv24020lp.h =================================================================== --- firmware/export/lv24020lp.h (Revision 16718) +++ firmware/export/lv24020lp.h (Arbeitskopie) @@ -23,6 +23,7 @@ /* Define additional tuner messages here */ #define HAVE_RADIO_REGION +#define HAVE_RADIO_FIELD_METER #define LV24020LP_CTRL_STAT (RADIO_GET_CHIP_FIRST+0) #define LV24020LP_REG_STAT (RADIO_GET_CHIP_FIRST+1) Index: firmware/export/tea5767.h =================================================================== --- firmware/export/tea5767.h (Revision 16718) +++ firmware/export/tea5767.h (Arbeitskopie) @@ -23,6 +23,7 @@ #define HAVE_RADIO_REGION #define HAVE_RADIO_MUTE_TIMEOUT +#define HAVE_RADIO_FIELD_METER struct tea5767_region_data { Index: firmware/drivers/tuner/tea5767.c =================================================================== --- firmware/drivers/tuner/tea5767.c (Revision 16718) +++ firmware/drivers/tuner/tea5767.c (Arbeitskopie) @@ -123,6 +123,10 @@ case RADIO_STEREO: val = read_bytes[2] >> 7; break; + + case RADIO_FIELD_STRENGTH: + val = 9 + 3*(read_bytes[3] >> 4); + break; } return val; Index: firmware/drivers/tuner/lv24020lp.c =================================================================== --- firmware/drivers/tuner/lv24020lp.c (Revision 16718) +++ firmware/drivers/tuner/lv24020lp.c (Arbeitskopie) @@ -927,6 +927,10 @@ tuner_power(false); break; } + + case RADIO_FIELD_STRENGTH: + val = 75 - 10*(RSS_FS(lv24020lp_read(RADIO_STAT))); + break; default: val = lv24020lp_debug_info(setting);