diff --git a/Makefile b/Makefile index ba420a1..d84cda8 100644 --- a/Makefile +++ b/Makefile @@ -3,49 +3,50 @@ # 0 = disable # 1 = enable -ENABLE_CLANG := 0 -ENABLE_SWD := 0 -ENABLE_OVERLAY := 0 -ENABLE_LTO := 1 -ENABLE_UART := 1 -ENABLE_UART_DEBUG := 1 -ENABLE_AIRCOPY := 1 -ENABLE_AIRCOPY_FREQ := 1 -ENABLE_AIRCOPY_RX_REBOOT := 0 -ENABLE_FMRADIO := 1 -ENABLE_NOAA := 0 -ENABLE_VOICE := 0 -ENABLE_MUTE_RADIO_FOR_VOICE := 1 -ENABLE_VOX := 0 -ENABLE_LOWER_LOW_MID_TX := 1 -ENABLE_ALARM := 1 -ENABLE_TX1750 := 1 -ENABLE_PWRON_PASSWORD := 0 -ENABLE_RESET_AES_KEY := 1 -ENABLE_BIG_FREQ := 0 -ENABLE_SMALL_BOLD := 1 -ENABLE_KEEP_MEM_NAME := 1 -ENABLE_WIDE_RX := 1 -ENABLE_1250HZ_STEP := 1 -ENABLE_TX_WHEN_AM := 0 -ENABLE_F_CAL_MENU := 0 -ENABLE_TX_UNLOCK := 0 -ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 -ENABLE_BOOT_BEEPS := 0 -ENABLE_SHOW_CHARGE_LEVEL := 0 -ENABLE_REVERSE_BAT_SYMBOL := 1 -ENABLE_FREQ_SEARCH_TIMEOUT := 0 -ENABLE_CODE_SEARCH_TIMEOUT := 1 -ENABLE_AM_FIX := 1 -ENABLE_AM_FIX_SHOW_DATA := 1 -ENABLE_SQUELCH_MORE_SENSITIVE := 1 -ENABLE_FASTER_CHANNEL_SCAN := 1 -ENABLE_RSSI_BAR := 1 -ENABLE_SHOW_TX_TIMEOUT := 0 -ENABLE_AUDIO_BAR := 1 -ENABLE_COPY_CHAN_TO_VFO := 1 -#ENABLE_PANADAPTER := 0 -#ENABLE_SINGLE_VFO_CHAN := 0 +ENABLE_CLANG := 0 +ENABLE_SWD := 0 +ENABLE_OVERLAY := 0 +ENABLE_LTO := 1 +ENABLE_UART := 1 +ENABLE_UART_DEBUG := 1 +ENABLE_AIRCOPY := 1 +ENABLE_AIRCOPY_FREQ := 1 +ENABLE_AIRCOPY_RX_REBOOT := 0 +ENABLE_FMRADIO := 1 +ENABLE_NOAA := 0 +ENABLE_VOICE := 0 +ENABLE_MUTE_RADIO_FOR_VOICE := 1 +ENABLE_VOX := 0 +ENABLE_LOWER_LOW_MID_TX := 1 +ENABLE_ALARM := 1 +ENABLE_TX1750 := 1 +ENABLE_PWRON_PASSWORD := 0 +ENABLE_RESET_AES_KEY := 1 +ENABLE_BIG_FREQ := 0 +ENABLE_SMALL_BOLD := 1 +ENABLE_KEEP_MEM_NAME := 1 +ENABLE_WIDE_RX := 1 +ENABLE_1250HZ_STEP := 1 +ENABLE_TX_WHEN_AM := 0 +ENABLE_F_CAL_MENU := 0 +ENABLE_TX_UNLOCK := 0 +ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 +ENABLE_BOOT_BEEPS := 0 +ENABLE_SHOW_CHARGE_LEVEL := 0 +ENABLE_REVERSE_BAT_SYMBOL := 1 +ENABLE_FREQ_SEARCH_TIMEOUT := 0 +ENABLE_CODE_SEARCH_TIMEOUT := 1 +ENABLE_AM_FIX := 1 +ENABLE_AM_FIX_SHOW_DATA := 1 +ENABLE_SQUELCH_MORE_SENSITIVE := 1 +ENABLE_SQ_OPEN_WHITH_UP_DN_BUTTS := 1 +ENABLE_FASTER_CHANNEL_SCAN := 1 +ENABLE_RSSI_BAR := 1 +ENABLE_SHOW_TX_TIMEOUT := 0 +ENABLE_AUDIO_BAR := 1 +ENABLE_COPY_CHAN_TO_VFO := 1 +#ENABLE_PANADAPTER := 0 +#ENABLE_SINGLE_VFO_CHAN := 0 ############################################################# @@ -342,6 +343,9 @@ endif ifeq ($(ENABLE_SQUELCH_MORE_SENSITIVE),1) CFLAGS += -DENABLE_SQUELCH_MORE_SENSITIVE endif +ifeq ($(ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS),1) + CFLAGS += -DENABLE_SQ_OPEN_WITH_UP_DN_BUTTS +endif ifeq ($(ENABLE_FASTER_CHANNEL_SCAN),1) CFLAGS += -DENABLE_FASTER_CHANNEL_SCAN endif diff --git a/README.md b/README.md index 4afc6ed..52b9ece 100644 --- a/README.md +++ b/README.md @@ -34,49 +34,50 @@ us to remove certain firmware features in order to make room in the flash for ot You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) .. ``` -ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this) -ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming) -ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed -ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this) -ENABLE_UART := 1 without this you can't configure radio via PC -ENABLE_UART_DEBUG := 0 just for code debugging, it sends debug info along the USB serial connection (programming lead) -ENABLE_AIRCOPY := 1 clone radio-to-radio via RF -ENABLE_AIRCOPY_FREQ := 1 remember what you use for the aircopy frequency -ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion -ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver -ENABLE_NOAA := 1 everything NOAA (only of any use in the USA) -ENABLE_VOICE := 0 want to hear voices ? -ENABLE_MUTE_RADIO_FOR_VOICE := 1 mute the radios audio when a voice is playing -ENABLE_VOX := 1 voice operated transmission -ENABLE_LOWER_LOW_MID_TX := 1 reduce the low and mid TX power levels (high remains unchanged) -ENABLE_ALARM := 1 TX alarms -ENABLE_1750HZ := 1 side key 1750Hz TX tone (older style repeater access) -ENABLE_PWRON_PASSWORD := 0 '1' = allow power-on password -ENABLE_RESET_AES_KEY := 1 '1' = reset/clear the AES key stored in the eeprom (only if it's set) -ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware) -ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode) -ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel -ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range) -ENABLE_1250HZ_STEP := 1 enable smaller 1.25kHz frequency steps -ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM -ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu -ENABLE_TX_UNLOCK := 0 '1' = allow TX everywhere EXCEPT airband (108~136) .. TX harmonic content will cause interference to other services, do so entirely at your own risk ! -ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method -ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up -ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge -ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right) -ENABLE_FREQ_SEARCH_TIMEOUT := 1 timeout if FREQ not found when using F+4 search function -ENABLE_CODE_SEARCH_TIMEOUT := 0 timeout if CTCSS/CDCSS not found when using F+* search function -ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now) -ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it) -ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves -ENABLE_FASTER_CHANNEL_SCAN := 1 increases the channel scan speed, but the squelch is also made more twitchy -ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols -ENABLE_SHOW_TX_TIMEOUT := 0 show the remainng TX time -ENABLE_AUDIO_BAR := 1 experimental, display an audo bar level when TX'ing, includes remaining TX time (in seconds) -ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M') -#ENABLE_BAND_SCOPE := 0 not yet implemented - spectrum/pan-adapter -#ENABLE_SINGLE_VFO_CHAN := 0 not yet implemented - single VFO on display when possible +ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this) +ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming) +ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed +ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this) +ENABLE_UART := 1 without this you can't configure radio via PC +ENABLE_UART_DEBUG := 0 just for code debugging, it sends debug info along the USB serial connection (programming lead) +ENABLE_AIRCOPY := 1 clone radio-to-radio via RF +ENABLE_AIRCOPY_FREQ := 1 remember what you use for the aircopy frequency +ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion +ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver +ENABLE_NOAA := 1 everything NOAA (only of any use in the USA) +ENABLE_VOICE := 0 want to hear voices ? +ENABLE_MUTE_RADIO_FOR_VOICE := 1 mute the radios audio when a voice is playing +ENABLE_VOX := 1 voice operated transmission +ENABLE_LOWER_LOW_MID_TX := 1 reduce the low and mid TX power levels (high remains unchanged) +ENABLE_ALARM := 1 TX alarms +ENABLE_1750HZ := 1 side key 1750Hz TX tone (older style repeater access) +ENABLE_PWRON_PASSWORD := 0 '1' = allow power-on password +ENABLE_RESET_AES_KEY := 1 '1' = reset/clear the AES key stored in the eeprom (only if it's set) +ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware) +ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode) +ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel +ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range) +ENABLE_1250HZ_STEP := 1 enable smaller 1.25kHz frequency steps +ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM +ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu +ENABLE_TX_UNLOCK := 0 '1' = allow TX everywhere EXCEPT airband (108~136) .. TX harmonic content will cause interference to other services, do so entirely at your own risk ! +ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method +ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up +ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge +ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right) +ENABLE_FREQ_SEARCH_TIMEOUT := 1 timeout if FREQ not found when using F+4 search function +ENABLE_CODE_SEARCH_TIMEOUT := 0 timeout if CTCSS/CDCSS not found when using F+* search function +ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now) +ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it) +ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves +ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 open the squelch when holding down UP or DN buttons when in frequency mode +ENABLE_FASTER_CHANNEL_SCAN := 1 increases the channel scan speed, but the squelch is also made more twitchy +ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols +ENABLE_SHOW_TX_TIMEOUT := 0 show the remainng TX time +ENABLE_AUDIO_BAR := 1 experimental, display an audo bar level when TX'ing, includes remaining TX time (in seconds) +ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M') +#ENABLE_BAND_SCOPE := 0 not yet implemented - spectrum/pan-adapter +#ENABLE_SINGLE_VFO_CHAN := 0 not yet implemented - single VFO on display when possible ``` # New/modified function keys diff --git a/app/app.c b/app/app.c index 8f8a368..cdf27a0 100644 --- a/app/app.c +++ b/app/app.c @@ -674,17 +674,38 @@ void APP_stop_scan(void) static void APP_next_freq(void) { - g_rx_vfo->freq_config_rx.frequency = APP_set_frequency_by_step(g_rx_vfo, g_scan_state_dir); + frequency_band_t new_band; + const frequency_band_t old_band = FREQUENCY_GetBand(g_rx_vfo->freq_config_rx.frequency); + const uint32_t frequency = APP_set_frequency_by_step(g_rx_vfo, g_scan_state_dir); - RADIO_ApplyOffset(g_rx_vfo); - RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo); - RADIO_setup_registers(true); + new_band = FREQUENCY_GetBand(frequency); - #ifdef ENABLE_FASTER_CHANNEL_SCAN - g_scan_pause_delay_in_10ms = 9; // 90ms - #else - g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms; - #endif + g_rx_vfo->freq_config_rx.frequency = frequency; + + if (new_band != old_band) + { // original slow method + + RADIO_ApplyOffset(g_rx_vfo); + RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo); + RADIO_setup_registers(true); + + #ifdef ENABLE_FASTER_CHANNEL_SCAN + g_scan_pause_delay_in_10ms = 9; // 90ms + #else + g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms; + #endif + } + else + { // don't need to go through all the other stuff .. lets speed things up !! + + BK4819_set_rf_frequency(frequency, true); + + #ifdef ENABLE_FASTER_CHANNEL_SCAN + g_scan_pause_delay_in_10ms = 8; // 80ms + #else + g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms; + #endif + } g_scan_keep_frequency = false; g_update_display = true; @@ -1557,7 +1578,7 @@ void APP_time_slice_10ms(void) if (g_flag_save_channel) { - SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, g_flag_save_channel); + SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, g_flag_save_channel ? 1 : 0); g_flag_save_channel = false; RADIO_ConfigureChannel(g_eeprom.tx_vfo, VFO_CONFIGURE); diff --git a/app/main.c b/app/main.c index c53fb6f..ec0999e 100644 --- a/app/main.c +++ b/app/main.c @@ -718,20 +718,25 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held) static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Direction) { - static bool monitor_was_enabled = false; - + #ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS + static bool monitor_was_enabled = false; + #endif + uint8_t Channel = g_eeprom.screen_channel[g_eeprom.tx_vfo]; - // only update eeprom when the key is released (saves wear and tear) if (!key_pressed && g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(Channel) && IS_FREQ_CHANNEL(Channel)) { - if (key_held && !key_pressed && !monitor_was_enabled && g_current_function == FUNCTION_MONITOR) - { // re-enable the squelch - APP_start_listening(FUNCTION_RECEIVE, false); - g_monitor_enabled = false; - } - - SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1); + #ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS + if (key_held && !key_pressed && !monitor_was_enabled && g_current_function == FUNCTION_MONITOR) + { // re-enable the squelch + APP_start_listening(FUNCTION_RECEIVE, false); + g_monitor_enabled = false; + } + #endif + + // only update eeprom when the key is released - saves a LOT of wear and tear on the little eeprom + g_flag_save_channel = 1; + //SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1); #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) // UART_printf("save chan\r\n"); @@ -781,9 +786,8 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D if (IS_FREQ_CHANNEL(Channel)) { // step/down in frequency - const frequency_band_t old_band = FREQUENCY_GetBand(g_tx_vfo->freq_config_rx.frequency); frequency_band_t new_band; - + const frequency_band_t old_band = FREQUENCY_GetBand(g_tx_vfo->freq_config_rx.frequency); const uint32_t frequency = APP_set_frequency_by_step(g_tx_vfo, Direction); if (RX_freq_check(frequency) < 0) @@ -797,21 +801,23 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D g_tx_vfo->freq_config_rx.frequency = frequency; if (new_band != old_band) - { + { // original slow method g_request_save_channel = 1; } else - { // don't need to go through all the other stuff + { // don't need to go through all the other stuff .. lets speed things up !! + + #ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS + if (!key_held && key_pressed) + monitor_was_enabled = g_monitor_enabled; + + if (key_held && key_pressed && !monitor_was_enabled) + { // open the squelch if the user holds the key down + APP_start_listening(FUNCTION_MONITOR, false); + g_monitor_enabled = true; + } + #endif - if (!key_held && key_pressed) - monitor_was_enabled = g_monitor_enabled; - - if (key_held && key_pressed && !monitor_was_enabled) - { // open the squelch if the user holds the key down - APP_start_listening(FUNCTION_MONITOR, false); - g_monitor_enabled = true; - } - BK4819_set_rf_frequency(frequency, true); //BK4819_PickRXFilterPathBasedOnFrequency(frequency); } diff --git a/firmware.bin b/firmware.bin index 7aae5d2..41b0148 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 91e471d..deb4121 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ