diff --git a/Makefile b/Makefile index c4b1e9b..b0b211b 100644 --- a/Makefile +++ b/Makefile @@ -12,13 +12,13 @@ ENABLE_OVERLAY := 0 ENABLE_LTO := 1 # UART Programming 2.9 kB ENABLE_UART := 1 -ENABLE_UART_DEBUG := 1 +ENABLE_UART_DEBUG := 0 # AirCopy 2.5 kB ENABLE_AIRCOPY := 1 ENABLE_AIRCOPY_REMEMBER_FREQ := 1 ENABLE_AIRCOPY_RX_REBOOT := 0 # FM Radio 4.2 kB -#ENABLE_FMRADIO_76_90 := 0 +ENABLE_FMRADIO_76_90 := 0 ENABLE_FMRADIO_68_108 := 0 ENABLE_FMRADIO_76_108 := 0 ENABLE_FMRADIO_875_108 := 1 @@ -66,7 +66,7 @@ ENABLE_RX_SIGNAL_BAR := 1 # Tx Timeout Bar 0.2 kB ENABLE_TX_TIMEOUT_BAR := 0 # Tx Audio Bar 0.3 kB -ENABLE_TX_AUDIO_BAR := 1 +ENABLE_TX_AUDIO_BAR := 0 # Side Button Menu 0.3 kB ENABLE_SIDE_BUTT_MENU := 1 # Key Lock 0.4 kB @@ -101,6 +101,12 @@ ifeq ($(ENABLE_LTO),1) ENABLE_OVERLAY := 0 endif +ifeq ($(filter $(ENABLE_FMRADIO_76_90) $(ENABLE_FMRADIO_76_108) $(ENABLE_FMRADIO_875_108) $(ENABLE_FMRADIO_875_108), 1), 1) + ENABLE_FMRADIO := 1 +else + ENABLE_FMRADIO := 0 +endif + ifeq ($(ENABLE_TX_TIMEOUT_BAR),1) # can't have ENABLE_TX_TIMEOUT_BAR and ENABLE_TX_AUDIO_BAR enabled at same time ENABLE_TX_AUDIO_BAR := 0 @@ -130,7 +136,7 @@ ifeq ($(ENABLE_UART),1) OBJS += driver/aes.o endif OBJS += driver/backlight.o -ifeq ($(filter $(ENABLE_FMRADIO_76_90) $(ENABLE_FMRADIO_76_108) $(ENABLE_FMRADIO_875_108) $(ENABLE_FMRADIO_875_108), 1), 1) +ifeq ($(ENABLE_FMRADIO), 1) OBJS += driver/bk1080.o endif OBJS += driver/bk4819.o @@ -159,7 +165,7 @@ ifeq ($(ENABLE_AIRCOPY),1) endif OBJS += app/app.o OBJS += app/dtmf.o -ifeq ($(filter $(ENABLE_FMRADIO_76_90) $(ENABLE_FMRADIO_76_108) $(ENABLE_FMRADIO_875_108) $(ENABLE_FMRADIO_875_108), 1), 1) +ifeq ($(ENABLE_FMRADIO), 1) OBJS += app/fm.o endif OBJS += app/generic.o @@ -195,7 +201,7 @@ ifeq ($(ENABLE_AIRCOPY),1) OBJS += ui/aircopy.o endif OBJS += ui/battery.o -ifeq ($(filter $(ENABLE_FMRADIO_76_90) $(ENABLE_FMRADIO_76_108) $(ENABLE_FMRADIO_875_108) $(ENABLE_FMRADIO_875_108), 1), 1) +ifeq ($(ENABLE_FMRADIO), 1) OBJS += ui/fmradio.o endif OBJS += ui/helper.o @@ -297,6 +303,9 @@ endif ifeq ($(ENABLE_FMRADIO_875_108),1) CFLAGS += -DENABLE_FMRADIO_875_108 endif +ifeq ($(ENABLE_FMRADIO),1) + CFLAGS += -DENABLE_FMRADIO +endif ifeq ($(ENABLE_UART),1) CFLAGS += -DENABLE_UART endif diff --git a/README.md b/README.md index 0efd69d..d541c39 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,9 @@ ENABLE_UART_DEBUG := 0 just for code debugging, it sends de ENABLE_AIRCOPY := 1 clone radio-to-radio via RF ENABLE_AIRCOPY_REMEMBER_FREQ := 1 remember the aircopy frequency ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion -#ENABLE_FMRADIO_76_90 := 0 not yet implemented -ENABLE_FMRADIO_68_108 := 0 enable FM radio 68MHz ~ 108MHz -ENABLE_FMRADIO_76_108 := 0 enable FM radio 76MHz ~ 108MHz +ENABLE_FMRADIO_76_90 := 0 enable FM radio 76MHz ~ 90MHz +ENABLE_FMRADIO_68_108 := 0 enable FM radio 68MHz ~ 108MHz +ENABLE_FMRADIO_76_108 := 0 enable FM radio 76MHz ~ 108MHz ENABLE_FMRADIO_875_108 := 1 enable FM radio 87.5MHz ~ 108MHz ENABLE_NOAA := 0 everything NOAA (only of any use in the USA) ENABLE_VOICE := 0 want to hear voices ? @@ -85,7 +85,7 @@ ENABLE_RX_SIGNAL_BAR := 1 enable a menu option for showing an ENABLE_TX_TIMEOUT_BAR := 0 show the remainng TX time ENABLE_TX_AUDIO_BAR := 1 enable a menu option for showing a TX audio level bar ENABLE_SIDE_BUTT_MENU := 1 enable menu option for configuring the programmable side buttons -ENABLE_KEYLOCK := 1 auto lock after 30 sec or long press F to lock +ENABLE_KEYLOCK := 1 enable keylock menu option + keylock code #ENABLE_BAND_SCOPE := 0 not yet implemented - spectrum/pan-adapter #ENABLE_SINGLE_VFO_CHAN := 0 not yet implemented - single VFO on display when possible ``` diff --git a/app/action.c b/app/action.c index f0662f8..ae40b2e 100644 --- a/app/action.c +++ b/app/action.c @@ -19,13 +19,13 @@ #include "app/action.h" #include "app/app.h" #include "app/dtmf.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "app/search.h" #include "audio.h" #include "bsp/dp32g030/gpio.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -102,7 +102,7 @@ void ACTION_Monitor(void) RADIO_setup_registers(true); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) { FM_Start(); @@ -115,7 +115,7 @@ void ACTION_Monitor(void) void ACTION_Scan(bool bRestart) { - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) { if (g_current_function != FUNCTION_RECEIVE && @@ -306,7 +306,7 @@ void ACTION_Scan(bool bRestart) #endif -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO void ACTION_FM(void) { if (g_current_function != FUNCTION_TRANSMIT && g_current_function != FUNCTION_MONITOR) @@ -400,7 +400,7 @@ void ACTION_process(const key_code_t Key, const bool key_pressed, const bool key ACTION_AlarmOr1750(false); #endif break; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO case ACTION_OPT_FM: ACTION_FM(); break; diff --git a/app/action.h b/app/action.h index 25bd2a4..fd8c909 100644 --- a/app/action.h +++ b/app/action.h @@ -29,7 +29,7 @@ void ACTION_Scan(bool bFlag); #ifdef ENABLE_ALARM //static void ACTION_AlarmOr1750(bool b1750) #endif -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO void ACTION_FM(void); #endif diff --git a/app/app.c b/app/app.c index 3f823e6..c5dc0cc 100644 --- a/app/app.c +++ b/app/app.c @@ -23,7 +23,7 @@ #endif #include "app/app.h" #include "app/dtmf.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "app/generic.h" @@ -36,7 +36,7 @@ #include "board.h" #include "bsp/dp32g030/gpio.h" #include "driver/backlight.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -466,7 +466,7 @@ bool APP_start_listening(function_type_t Function, const bool reset_am_fix) if (g_setting_backlight_on_tx_rx >= 2) backlight_turn_on(backlight_tx_rx_time_500ms); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) BK1080_Init(0, false); #endif @@ -573,7 +573,7 @@ bool APP_start_listening(function_type_t Function, const bool reset_am_fix) FUNCTION_Select(Function); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (Function == FUNCTION_MONITOR || g_fm_radio_mode) #else if (Function == FUNCTION_MONITOR) @@ -700,6 +700,10 @@ static void APP_next_freq(void) g_rx_vfo->freq_config_rx.frequency = frequency; + #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) +// UART_printf("APP_next_freq %u %u\r\n", frequency, new_band); + #endif + if (new_band != old_band) { // original slow method @@ -811,6 +815,10 @@ static void APP_next_channel(void) if (g_scan_next_channel != prev_chan) { + #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) +// UART_printf("APP_next_channel %u\r\n", g_scan_next_channel); + #endif + g_eeprom.user_channel[g_eeprom.rx_vfo] = g_scan_next_channel; g_eeprom.screen_channel[g_eeprom.rx_vfo] = g_scan_next_channel; @@ -1046,7 +1054,7 @@ void APP_end_tx(void) g_vox_pause_count_down = 0; } - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) return; #endif @@ -1139,7 +1147,7 @@ void APP_process(void) APP_process_function(); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0) return; #endif @@ -1159,8 +1167,38 @@ void APP_process(void) // TODO: check to see if signal stays present for minimum time before pausing (debounce) + + if (g_current_code_type == CODE_TYPE_NONE && g_current_function == FUNCTION_NEW_RECEIVE && !g_scan_pause_time_mode) + { + APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); + } + else + { // switch to next channel + g_scan_pause_time_mode = false; + g_rx_reception_mode = RX_MODE_NONE; -/* + if (g_scan_next_channel <= USER_CHANNEL_LAST) + APP_next_channel(); + else + if (IS_FREQ_CHANNEL(g_scan_next_channel)) + APP_next_freq(); + } +/* + if (g_scan_next_channel <= USER_CHANNEL_LAST) + { // channel mode + + if (g_current_code_type == CODE_TYPE_NONE && g_current_function == FUNCTION_NEW_RECEIVE && !g_scan_pause_time_mode) + { + APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); + } + else + { // switch to next channel + g_scan_pause_time_mode = false; + g_rx_reception_mode = RX_MODE_NONE; + APP_next_channel(); + } + } + else if (IS_FREQ_CHANNEL(g_scan_next_channel)) { // frequency mode @@ -1175,20 +1213,8 @@ void APP_process(void) APP_next_freq(); } } - else -*/ { // channel mode - - if (g_current_code_type == CODE_TYPE_NONE && g_current_function == FUNCTION_NEW_RECEIVE && !g_scan_pause_time_mode) - { - APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); - } - else - { // switch to next channel - g_scan_pause_time_mode = false; - g_rx_reception_mode = RX_MODE_NONE; - APP_next_channel(); - } - } +*/ + } } @@ -1223,7 +1249,7 @@ void APP_process(void) #ifdef ENABLE_VOICE g_voice_write_index == 0 && #endif - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO !g_fm_radio_mode && #endif g_dtmf_call_state == DTMF_CALL_STATE_NONE && @@ -1242,7 +1268,7 @@ void APP_process(void) g_rx_reception_mode = RX_MODE_NONE; } -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO if (g_schedule_fm && g_fm_scan_state != FM_SCAN_OFF && g_current_function != FUNCTION_MONITOR && @@ -1263,7 +1289,7 @@ void APP_process(void) { #ifdef ENABLE_NOAA if ( - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO g_fm_radio_mode || #endif g_ptt_is_pressed || @@ -1289,7 +1315,7 @@ void APP_process(void) } #else if ( - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO g_fm_radio_mode || #endif g_ptt_is_pressed || @@ -1611,7 +1637,7 @@ void APP_time_slice_10ms(void) g_flag_save_settings = false; } - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_flag_save_fm) { SETTINGS_save_fm(); @@ -1697,7 +1723,7 @@ void APP_time_slice_10ms(void) // Skipping authentic device checks - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0) return; #endif @@ -1779,7 +1805,7 @@ void APP_time_slice_10ms(void) } } - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode && g_fm_restore_count_down_10ms > 0) { if (--g_fm_restore_count_down_10ms == 0) @@ -2021,7 +2047,7 @@ void APP_cancel_user_input_modes(void) if (g_dtmf_input_mode || g_dtmf_input_box_index > 0) { DTMF_clear_input_box(); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) g_request_display_screen = DISPLAY_FM; else @@ -2100,7 +2126,7 @@ void APP_time_slice_500ms(void) // Skipped authentic device check - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_count_down_500ms > 0) { g_fm_radio_count_down_500ms--; @@ -2159,7 +2185,7 @@ void APP_time_slice_500ms(void) #endif } -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO if (g_fm_scan_state == FM_SCAN_OFF || g_ask_to_save) #endif { @@ -2227,7 +2253,7 @@ void APP_time_slice_500ms(void) { gui_display_type_t disp = DISPLAY_INVALID; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode && g_current_function != FUNCTION_RECEIVE && g_current_function != FUNCTION_MONITOR && @@ -2256,7 +2282,7 @@ void APP_time_slice_500ms(void) if (g_current_function != FUNCTION_POWER_SAVE && g_current_function != FUNCTION_TRANSMIT) APP_update_rssi(g_eeprom.rx_vfo); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (!g_ptt_is_pressed && g_fm_resume_count_down_500ms > 0) { if (--g_fm_resume_count_down_500ms == 0) @@ -2411,7 +2437,7 @@ void APP_time_slice_500ms(void) } #endif -void APP_channel_next(const bool flag, const scan_state_dir_t scan_direction) +void APP_channel_next(const bool remember_current, const scan_state_dir_t scan_direction) { RADIO_select_vfos(); @@ -2419,24 +2445,33 @@ void APP_channel_next(const bool flag, const scan_state_dir_t scan_direction) g_scan_current_scan_list = SCAN_NEXT_CHAN_SCANLIST1; g_scan_state_dir = scan_direction; + if (remember_current) + { + g_scan_restore_channel = 0xff; + g_scan_restore_frequency = 0xffffffff; + } + + #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) + UART_printf("APP_channel_next %u\r\n", g_scan_next_channel); + #endif + if (g_scan_next_channel <= USER_CHANNEL_LAST) { // channel mode - if (flag) - { - g_scan_restore_frequency = 0xffffffff; - g_scan_restore_channel = g_scan_next_channel; - } + if (remember_current) + g_scan_restore_channel = g_scan_next_channel; APP_next_channel(); } else + if (IS_FREQ_CHANNEL(g_scan_next_channel)) { // frequency mode - if (flag) - { - g_scan_restore_channel = 0xff; + if (remember_current) g_scan_restore_frequency = g_rx_vfo->freq_config_rx.frequency; - } APP_next_freq(); } + else + { + return; + } g_scan_pause_10ms = scan_pause_css_10ms; g_scan_pause_time_mode = false; @@ -2528,7 +2563,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const g_keypad_locked = 4; // 2 second pop-up g_update_display = true; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (!g_fm_radio_mode) // don't beep when the FM radio is on, it cause bad gaps and loud clicks #endif g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; @@ -2721,7 +2756,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const MAIN_process_key(Key, key_pressed, key_held); break; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO case DISPLAY_FM: FM_process_key(Key, key_pressed, key_held); break; @@ -2757,7 +2792,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const } else { - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (!g_fm_radio_mode) #endif if (!key_held && key_pressed) @@ -2799,7 +2834,7 @@ Skip: g_update_status = true; } - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_request_save_fm) { if (!key_held) diff --git a/app/app.h b/app/app.h index b407828..98bde26 100644 --- a/app/app.h +++ b/app/app.h @@ -30,7 +30,7 @@ extern const uint8_t orig_pga; void APP_end_tx(void); void APP_stop_scan(void); -void APP_channel_next(const bool flag, const scan_state_dir_t scan_direction); +void APP_channel_next(const bool remember_current, const scan_state_dir_t scan_direction); bool APP_start_listening(function_type_t Function, const bool reset_am_fix); uint32_t APP_set_frequency_by_step(vfo_info_t *pInfo, int8_t Step); void APP_process(void); diff --git a/app/dtmf.c b/app/dtmf.c index 675a41f..f10ea53 100644 --- a/app/dtmf.c +++ b/app/dtmf.c @@ -17,7 +17,7 @@ #include #include // NULL -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "app/search.h" @@ -248,7 +248,7 @@ void DTMF_HandleRequest(void) g_dtmf_reply_state = DTMF_REPLY_AB; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) { FM_TurnOff(); diff --git a/app/fm.c b/app/fm.c index 9fadb28..b068014 100644 --- a/app/fm.c +++ b/app/fm.c @@ -25,6 +25,7 @@ #include "driver/eeprom.h" #include "driver/gpio.h" #include "driver/uart.h" +#include "frequencies.h" #include "functions.h" #include "misc.h" #include "settings.h" diff --git a/app/generic.c b/app/generic.c index 8e2952f..9fe6082 100644 --- a/app/generic.c +++ b/app/generic.c @@ -17,7 +17,7 @@ #include #include "app/app.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "app/generic.h" @@ -40,7 +40,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held) if (g_input_box_index > 0) { - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (!g_fm_radio_mode) #endif if (!key_held && key_pressed) @@ -74,7 +74,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held) if (key_pressed) { - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (!g_fm_radio_mode) #endif g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL; @@ -171,7 +171,7 @@ void GENERIC_Key_PTT(bool key_pressed) goto cancel_tx; } - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_scan_state != FM_SCAN_OFF) { // FM radio is scanning .. stop FM_PlayAndUpdate(); diff --git a/app/main.c b/app/main.c index 314b65d..7bbc2af 100644 --- a/app/main.c +++ b/app/main.c @@ -18,7 +18,7 @@ #include "app/action.h" #include "app/app.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "app/generic.h" @@ -197,7 +197,7 @@ void processFKeyFunction(const key_code_t Key) if (g_scan_state_dir != SCAN_STATE_DIR_OFF) APP_stop_scan(); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO ACTION_FM(); #else @@ -636,7 +636,7 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held) return; } - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (!g_fm_radio_mode) #endif { @@ -666,7 +666,7 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held) return; } - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO ACTION_FM(); #endif @@ -1006,7 +1006,7 @@ void MAIN_process_key(key_code_t key, bool key_pressed, bool key_held) // UART_printf(" main 1 key %2u %u %u %u\r\n", key, key_pressed, key_held); #endif - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode && key != KEY_PTT && key != KEY_EXIT) { if (!key_held && key_pressed) diff --git a/app/uart.c b/app/uart.c index 2d9f499..02352b4 100644 --- a/app/uart.c +++ b/app/uart.c @@ -21,7 +21,7 @@ #if !defined(ENABLE_OVERLAY) #include "ARMCM0.h" #endif -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "app/uart.h" diff --git a/audio.c b/audio.c index 8db9008..9d29f81 100644 --- a/audio.c +++ b/audio.c @@ -17,12 +17,12 @@ #ifdef ENABLE_AIRCOPY #include "app/aircopy.h" #endif -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "audio.h" #include "bsp/dp32g030/gpio.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -104,7 +104,7 @@ void AUDIO_PlayBeep(beep_type_t Beep) if (g_current_function == FUNCTION_POWER_SAVE && g_rx_idle_mode) BK4819_RX_TurnOn(); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO #ifdef MUTE_AUDIO_FOR_VOICE if (g_fm_radio_mode) BK1080_Mute(true); @@ -223,7 +223,7 @@ void AUDIO_PlayBeep(beep_type_t Beep) if (g_speaker_enabled) GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) BK1080_Mute(false); #endif @@ -290,7 +290,7 @@ void AUDIO_PlayBeep(beep_type_t Beep) BK4819_SetAF(BK4819_AF_MUTE); #endif - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO #ifdef MUTE_AUDIO_FOR_VOICE if (g_fm_radio_mode) BK1080_Mute(true); @@ -317,7 +317,7 @@ void AUDIO_PlayBeep(beep_type_t Beep) if (g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_MONITOR) BK4819_SetAF(g_rx_vfo->am_mode ? BK4819_AF_AM : BK4819_AF_FM); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) BK1080_Mute(false); #endif @@ -465,7 +465,7 @@ void AUDIO_PlayBeep(beep_type_t Beep) if (g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_MONITOR) BK4819_SetAF(g_rx_vfo->am_mode ? BK4819_AF_AM : BK4819_AF_FM); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) BK1080_Mute(false); #endif diff --git a/bitmaps.c b/bitmaps.c index 3237be2..3002fcb 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -249,7 +249,7 @@ const uint8_t BITMAP_MONITOR[6] = __extension__ 0b01111111 }; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO const uint8_t BITMAP_FM[12] = { // "FM" __extension__ 0b00000000, diff --git a/bitmaps.h b/bitmaps.h index b53472c..2fb03e2 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -37,7 +37,7 @@ extern const uint8_t BITMAP_TDR_HOLDING[12]; extern const uint8_t BITMAP_MONITOR[6]; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO extern const uint8_t BITMAP_FM[12]; #endif diff --git a/board.c b/board.c index f6f057d..5f36479 100644 --- a/board.c +++ b/board.c @@ -17,7 +17,7 @@ #include #include "app/dtmf.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "board.h" @@ -27,7 +27,7 @@ #include "bsp/dp32g030/syscon.h" #include "driver/adc.h" //#include "driver/backlight.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -121,7 +121,7 @@ void BOARD_GPIO_Init(void) | GPIO_DIR_5_MASK // INPUT ); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BK1080); #endif } @@ -512,7 +512,7 @@ void BOARD_Init(void) BOARD_ADC_Init(); ST7565_Init(true); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO BK1080_Init(0, false); #endif } @@ -567,7 +567,7 @@ void BOARD_EEPROM_load(void) g_eeprom.noaa_channel[1] = IS_NOAA_CHANNEL(Data[7]) ? Data[7] : NOAA_CHANNEL_FIRST; #endif -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO { // 0E88..0E8F struct { diff --git a/frequencies.c b/frequencies.c index 3a914ab..6583324 100644 --- a/frequencies.c +++ b/frequencies.c @@ -25,7 +25,9 @@ uint32_t g_aircopy_freq = 41002500; const freq_band_table_t AIR_BAND = {10800000, 13700000}; // FM broadcast band lower/upper limit -#if defined(ENABLE_FMRADIO_68_108) +#if defined(ENABLE_FMRADIO_76_90) + const freq_band_table_t FM_RADIO_BAND = {760, 900}; +#elif defined(ENABLE_FMRADIO_68_108) const freq_band_table_t FM_RADIO_BAND = {680, 1080}; #elif defined(ENABLE_FMRADIO_76_108) const freq_band_table_t FM_RADIO_BAND = {760, 1080}; diff --git a/frequencies.h b/frequencies.h index a77f3dd..95e8e75 100644 --- a/frequencies.h +++ b/frequencies.h @@ -43,7 +43,7 @@ extern uint32_t g_aircopy_freq; extern const freq_band_table_t AIR_BAND; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO extern const freq_band_table_t FM_RADIO_BAND; #endif diff --git a/functions.c b/functions.c index 1ed67e4..c3da084 100644 --- a/functions.c +++ b/functions.c @@ -17,13 +17,13 @@ #include #include "app/dtmf.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "bsp/dp32g030/gpio.h" #include "dcs.h" #include "driver/backlight.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "driver/bk1080.h" #endif #include "driver/bk4819.h" @@ -116,7 +116,7 @@ void FUNCTION_Select(function_type_t Function) if (prev_func != FUNCTION_RECEIVE) break; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_radio_mode) g_fm_restore_count_down_10ms = fm_restore_countdown_10ms; #endif @@ -200,7 +200,7 @@ void FUNCTION_Select(function_type_t Function) g_dtmf_rx_live_timeout = 0; memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live)); - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO // disable the FM radio if (g_fm_radio_mode) BK1080_Init(0, false); @@ -288,7 +288,7 @@ void FUNCTION_Select(function_type_t Function) g_battery_save_count_down_10ms = battery_save_count_10ms; g_schedule_power_save = false; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO g_fm_restore_count_down_10ms = 0; #endif diff --git a/mdc1200.c b/mdc1200.c index 8065873..700572d 100644 --- a/mdc1200.c +++ b/mdc1200.c @@ -134,58 +134,40 @@ uint16_t reverse_bits(const uint16_t bits_in, const unsigned int num_bits) void error_correction(uint8_t *data) { - int i; - uint8_t csr[FEC_K]; - uint8_t syn = 0; -// uint8_t shift_reg = 0; + int i; + uint8_t shift_reg; + uint8_t syn; - syn = 0; - - for (i = 0; i < FEC_K; i++) - csr[i] = 0; - - for (i = 0; i < FEC_K; i++) + for (i = 0, shift_reg = 0, syn = 0; i < FEC_K; i++) { const uint8_t bi = data[i]; int bit_num; for (bit_num = 0; bit_num < 8; bit_num++) { uint8_t b; - int k; - unsigned int ec = 0; + unsigned int k = 0; - #if 0 - shift_reg = (shift_reg << 1) | ((bi >> bit_num) & 1u); - b = ((shift_reg >> 6) ^ (shift_reg >> 5) ^ (shift_reg >> 2) ^ (shift_reg >> 0)) & 1u; - #else - for (k = FEC_K - 1; k > 0; k--) - csr[k] = csr[k - 1]; - csr[0] = (bi >> bit_num) & 1u; - b = (csr[0] + csr[2] + csr[5] + csr[6]) & 1u; - #endif - syn = (syn << 1) | (((b ^ (data[i + FEC_K] >> bit_num)) & 1u) ? 1u : 0u); + shift_reg = (shift_reg << 1) | ((bi >> bit_num) & 1u); + b = ((shift_reg >> 6) ^ (shift_reg >> 5) ^ (shift_reg >> 2) ^ (shift_reg >> 0)) & 1u; + syn = (syn << 1) | (((b ^ (data[i + FEC_K] >> bit_num)) & 1u) ? 1u : 0u); - if (syn & 0x80) ec++; - if (syn & 0x20) ec++; - if (syn & 0x04) ec++; - if (syn & 0x02) ec++; + if (syn & 0x80) k++; + if (syn & 0x20) k++; + if (syn & 0x04) k++; + if (syn & 0x02) k++; - if (ec >= 3) - { // correct error - - int fix_i = i; - int fix_j = bit_num - 7; - - syn ^= 0xA6; - - if (fix_j < 0) + if (k >= 3) + { // correct bit error + int ii = i; + int bn = bit_num - 7; + if (bn < 0) { - --fix_i; - fix_j += 8; + bn += 8; + ii--; } - - if (fix_i >= 0) - data[fix_i] ^= 1u << fix_j; + if (ii >= 0) + data[ii] ^= 1u << bn; + syn ^= 0xA6; // 10100110 } } } @@ -202,12 +184,12 @@ uint8_t * decode_data(uint8_t *data) unsigned int i; unsigned int k; + unsigned int m; uint8_t deinterleaved[(FEC_K * 2) * 8]; // de-interleave the received bits for (i = 0, k = 0; i < 16; i++) { - unsigned int m; for (m = 0; m < FEC_K; m++) { const unsigned int n = (m * 16) + i; @@ -216,12 +198,12 @@ uint8_t * decode_data(uint8_t *data) } // copy the de-interleaved bits to the data buffer - for (i = 0; i < (FEC_K * 2); i++) + for (i = 0, m = 0; i < (FEC_K * 2); i++) { unsigned int k; uint8_t b = 0; for (k = 0; k < 8; k++) - if (deinterleaved[(i * 8) + k]) + if (deinterleaved[m++]) b |= 1u << k; data[i] = b; } @@ -234,11 +216,11 @@ uint8_t * decode_data(uint8_t *data) if (crc1 != crc2) return NULL; - + // appears to be a valid packet - + // TODO: more stuff diff --git a/misc.c b/misc.c index 3691f75..106929f 100644 --- a/misc.c +++ b/misc.c @@ -189,7 +189,7 @@ bool g_flag_reset_vfos; bool g_request_save_vfo; uint8_t g_request_save_channel; bool g_request_save_settings; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO bool g_request_save_fm; #endif bool g_flag_prepare_tx; @@ -200,7 +200,7 @@ bool g_flag_refresh_menu; bool g_flag_save_vfo; bool g_flag_save_settings; bool g_flag_save_channel; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO bool g_flag_save_fm; #endif bool g_cdcss_lost; @@ -260,7 +260,7 @@ volatile bool g_next_time_slice_40ms; volatile bool g_schedule_noaa = true; #endif volatile bool g_flag_tail_tone_elimination_complete; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO volatile bool g_schedule_fm; #endif diff --git a/misc.h b/misc.h index 711c0b4..46a99fb 100644 --- a/misc.h +++ b/misc.h @@ -240,7 +240,7 @@ extern volatile bool g_tx_timeout_reached; extern volatile uint16_t g_tail_tone_elimination_count_down_10ms; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO extern volatile uint16_t g_fm_play_count_down_10ms; #endif #ifdef ENABLE_NOAA @@ -275,7 +275,7 @@ extern bool g_flag_reset_vfos; extern bool g_request_save_vfo; extern uint8_t g_request_save_channel; extern bool g_request_save_settings; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO extern bool g_request_save_fm; #endif extern bool g_flag_prepare_tx; @@ -286,7 +286,7 @@ extern bool g_flag_refresh_menu; // refresh menu display extern bool g_flag_save_vfo; extern bool g_flag_save_settings; extern bool g_flag_save_channel; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO extern bool g_flag_save_fm; #endif extern bool g_cdcss_lost; @@ -327,7 +327,7 @@ extern uint8_t g_backup_cross_vfo_rx_tx; extern volatile bool g_next_time_slice; extern bool g_update_display; extern bool g_unhide_hidden; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO extern uint8_t g_fm_channel_position; #endif extern volatile uint8_t g_found_cdcss_count_down_10ms; @@ -341,7 +341,7 @@ extern volatile bool g_next_time_slice_40ms; extern volatile bool g_schedule_noaa; #endif extern volatile bool g_flag_tail_tone_elimination_complete; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO extern volatile bool g_schedule_fm; #endif extern int16_t g_current_rssi[2]; // now one per VFO diff --git a/radio.c b/radio.c index b7a19f5..0ac08b9 100644 --- a/radio.c +++ b/radio.c @@ -18,7 +18,7 @@ #include "app/app.h" #include "app/dtmf.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "audio.h" @@ -736,7 +736,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground) #ifdef ENABLE_VOX if ( - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO !g_fm_radio_mode && #endif g_eeprom.vox_switch && @@ -919,7 +919,7 @@ void RADIO_Setg_vfo_state(vfo_state_t State) g_vfo_state[0] = VFO_STATE_NORMAL; g_vfo_state[1] = VFO_STATE_NORMAL; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO g_fm_resume_count_down_500ms = 0; #endif } @@ -936,7 +936,7 @@ void RADIO_Setg_vfo_state(vfo_state_t State) g_vfo_state[vfo] = State; } - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO g_fm_resume_count_down_500ms = fm_resume_countdown_500ms; #endif } diff --git a/scheduler.c b/scheduler.c index bffee1c..349f0ae 100644 --- a/scheduler.c +++ b/scheduler.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "app/search.h" @@ -100,7 +100,7 @@ void SystickHandler(void) DECREMENT_AND_TRIGGER(g_count_down_to_play_next_voice_10ms, g_flag_play_queued_voice); #endif - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO if (g_fm_scan_state != FM_SCAN_OFF && g_current_function != FUNCTION_MONITOR) if (g_current_function != FUNCTION_TRANSMIT && g_current_function != FUNCTION_RECEIVE) DECREMENT_AND_TRIGGER(g_fm_play_count_down_10ms, g_schedule_fm); diff --git a/settings.c b/settings.c index 53b2d3c..a5ab8b9 100644 --- a/settings.c +++ b/settings.c @@ -16,7 +16,7 @@ #include -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "driver/eeprom.h" @@ -26,7 +26,7 @@ eeprom_config_t g_eeprom; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO void SETTINGS_save_fm(void) { unsigned int i; diff --git a/settings.h b/settings.h index fe9f471..5399a22 100644 --- a/settings.h +++ b/settings.h @@ -469,7 +469,7 @@ typedef struct { uint8_t field7_0xa; uint8_t field8_0xb; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO uint16_t fm_selected_frequency; uint8_t fm_selected_channel; bool fm_is_channel_mode; @@ -565,7 +565,7 @@ typedef struct { extern eeprom_config_t g_eeprom; -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO void SETTINGS_save_fm(void); #endif void SETTINGS_save_vfo_indices(void); diff --git a/ui/fmradio.h b/ui/fmradio.h index 08e5e43..9aee109 100644 --- a/ui/fmradio.h +++ b/ui/fmradio.h @@ -17,7 +17,7 @@ #ifndef UI_FM_H #define UI_FM_H -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO void UI_DisplayFM(void); #endif diff --git a/ui/status.c b/ui/status.c index ec8a025..3c6b6ea 100644 --- a/ui/status.c +++ b/ui/status.c @@ -17,7 +17,7 @@ #include #include "app/search.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "bitmaps.h" @@ -89,7 +89,7 @@ void UI_DisplayStatus(const bool test_display) else #endif { - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO // FM indicator if (g_fm_radio_mode || test_display) { diff --git a/ui/ui.c b/ui/ui.c index c9836c0..cf08385 100644 --- a/ui/ui.c +++ b/ui/ui.c @@ -17,7 +17,7 @@ #include #include "app/dtmf.h" -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "app/fm.h" #endif #include "app/search.h" @@ -26,7 +26,7 @@ #ifdef ENABLE_AIRCOPY #include "ui/aircopy.h" #endif -#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) +#ifdef ENABLE_FMRADIO #include "ui/fmradio.h" #endif #include "ui/inputbox.h" @@ -51,7 +51,7 @@ void GUI_DisplayScreen(void) UI_DisplayMain(); break; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO case DISPLAY_FM: UI_DisplayFM(); break; @@ -89,7 +89,7 @@ void GUI_SelectNextDisplay(gui_display_type_t Display) g_in_sub_menu = false; g_css_scan_mode = CSS_SCAN_MODE_OFF; g_scan_state_dir = SCAN_STATE_DIR_OFF; - #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) + #ifdef ENABLE_FMRADIO g_fm_scan_state = FM_SCAN_OFF; #endif g_ask_for_confirmation = 0;