diff --git a/Makefile b/Makefile index 7cb958d..6ca2234 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ ENABLE_MUTE_RADIO_FOR_VOICE := 0 # Tx on Voice 1.0 kB ENABLE_VOX := 0 ENABLE_REDUCE_LOW_MID_TX_POWER := 1 -# Tx Alarm 0.6 kB +# Tx Alarm 600 B ENABLE_ALARM := 0 ENABLE_TX1750 := 1 # MDC1200 2.8 kB @@ -42,12 +42,12 @@ ENABLE_BIG_FREQ := 0 ENABLE_SMALL_BOLD := 1 # smallest font 2 kB ENABLE_SMALLEST_FONT := 0 -# trim trailing 0.044 kB +# trim trailing 44 B ENABLE_TRIM_TRAILING_ZEROS := 1 ENABLE_KEEP_MEM_NAME := 1 ENABLE_WIDE_RX := 1 ENABLE_TX_WHEN_AM := 0 -# Freq calibration 0.188 kB +# Freq calibration 188 B ENABLE_F_CAL_MENU := 0 ENABLE_TX_UNLOCK := 0 ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 @@ -59,25 +59,25 @@ ENABLE_SHOW_CHARGE_LEVEL := 0 ENABLE_REVERSE_BAT_SYMBOL := 1 ENABLE_FREQ_SEARCH_TIMEOUT := 0 ENABLE_CODE_SEARCH_TIMEOUT := 0 -# Kill and Revive 0.4 kB +# Kill and Revive 400 B ENABLE_KILL_REVIVE := 0 -# AM Fix 0.8 kB +# AM Fix 800 B ENABLE_AM_FIX := 1 ENABLE_AM_FIX_SHOW_DATA := 0 -# Squelch 0.012 kB .. can't be right ? +# Squelch 12 B .. can't be right ? ENABLE_SQUELCH_MORE_SENSITIVE := 1 ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 ENABLE_FASTER_CHANNEL_SCAN := 1 ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1 -# Rx Signal Bar 0.4 kB -ENABLE_RX_SIGNAL_BAR := 0 -# Tx Timeout Bar 0.2 kB +# Rx Signal Bar 400 B +ENABLE_RX_SIGNAL_BAR := 1 +# Tx Timeout Bar 200 B ENABLE_TX_TIMEOUT_BAR := 0 -# Tx Audio Bar 0.3 kB +# Tx Audio Bar 300 B ENABLE_TX_AUDIO_BAR := 1 -# Side Button Menu 0.3 kB +# Side Button Menu 300 B ENABLE_SIDE_BUTT_MENU := 1 -# Key Lock 0.4 kB +# Key Lock 400 B ENABLE_KEYLOCK := 0 #ENABLE_PANADAPTER := 0 #ENABLE_SINGLE_VFO_CHAN := 0 diff --git a/app/action.c b/app/action.c index 207d4c9..8cf229b 100644 --- a/app/action.c +++ b/app/action.c @@ -99,10 +99,11 @@ void ACTION_Monitor(void) if (!g_monitor_enabled) // (g_current_function != FUNCTION_MONITOR) { // enable monitor mode - g_beep_to_play = BEEP_NONE; - g_monitor_enabled = true; -// g_squelch_open = true; + g_beep_to_play = BEEP_NONE; + + if (!g_squelch_open && GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER)) + BK4819_StopTones(g_current_function == FUNCTION_TRANSMIT); #ifdef ENABLE_NOAA // if (g_rx_vfo->channel_save >= NOAA_CHANNEL_FIRST && g_is_noaa_mode) diff --git a/app/app.c b/app/app.c index b7654f4..07d8a3c 100644 --- a/app/app.c +++ b/app/app.c @@ -95,7 +95,8 @@ static void APP_update_rssi(const int vfo) g_current_rssi[vfo] = rssi; - UI_update_rssi(rssi, vfo); + if (g_squelch_open) + UI_update_rssi(rssi, vfo); } static void APP_check_for_new_receive(void) @@ -166,6 +167,7 @@ done: #endif APP_update_rssi(g_eeprom.rx_vfo); + g_update_rssi = true; } } @@ -404,7 +406,7 @@ Skip: case END_OF_RX_MODE_END: if (!g_monitor_enabled) g_speaker_enabled = false; - + RADIO_setup_registers(true); #ifdef ENABLE_NOAA @@ -487,16 +489,18 @@ bool APP_start_listening(void) case SCAN_RESUME_TIME: if (!g_scan_pause_time_mode) { - g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50; + g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50; g_scan_pause_time_mode = true; } break; + case SCAN_RESUME_CARRIER: - g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50; + g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50; g_scan_pause_time_mode = false; break; + case SCAN_RESUME_STOP: - g_scan_pause_tick_10ms = 0; + g_scan_pause_tick_10ms = 0; g_scan_pause_time_mode = false; break; } @@ -509,7 +513,7 @@ bool APP_start_listening(void) g_rx_vfo->p_rx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel]; g_rx_vfo->p_tx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel]; g_eeprom.screen_channel[chan] = g_rx_vfo->channel_save; - g_noaa_tick_10ms = 5000 / 10; // 5 sec + g_noaa_tick_10ms = 5000 / 10; // 5 sec g_schedule_noaa = false; } #endif @@ -523,17 +527,16 @@ bool APP_start_listening(void) { // dual watch is active g_dual_watch_tick_10ms = g_eeprom.scan_hold_time_500ms * 50; - g_rx_vfo_is_active = true; - - g_update_status = true; + g_rx_vfo_is_active = true; + g_update_status = true; } // AF gain - original QS values - if (g_rx_vfo->am_mode) - { - BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000 - } - else +// if (g_rx_vfo->am_mode) +// { +// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000 +// } +// else { BK4819_WriteRegister(0x48, (11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference @@ -562,7 +565,7 @@ bool APP_start_listening(void) if (g_current_display_screen != DISPLAY_MENU) GUI_SelectNextDisplay(DISPLAY_MAIN); - g_update_status = true; + g_update_status = true; g_update_display = true; return true; @@ -927,7 +930,7 @@ void APP_process_radio_interrupts(void) if (interrupt_bits & BK4819_REG_02_CDCSS_LOST) { - g_cdcss_lost = true; + g_cdcss_lost = true; g_cdcss_code_type = BK4819_get_CDCSS_code_type(); } @@ -947,29 +950,29 @@ void APP_process_radio_interrupts(void) #ifdef ENABLE_VOX if (interrupt_bits & BK4819_REG_02_VOX_LOST) { - g_vox_lost = true; + g_vox_lost = true; g_vox_pause_tick_10ms = 10; if (g_eeprom.vox_switch) { if (g_current_function == FUNCTION_POWER_SAVE && !g_rx_idle_mode) { - g_power_save_tick_10ms = power_save2_10ms; - g_power_save_expired = false; + g_power_save_tick_10ms = power_save2_10ms; + g_power_save_expired = false; } if (g_eeprom.dual_watch != DUAL_WATCH_OFF && (g_dual_watch_tick_10ms == 0 || g_dual_watch_tick_10ms < dual_watch_delay_after_vox_10ms)) { g_dual_watch_tick_10ms = dual_watch_delay_after_vox_10ms; - g_update_status = true; + g_update_status = true; } } } if (interrupt_bits & BK4819_REG_02_VOX_FOUND) { - g_vox_lost = false; + g_vox_lost = false; g_vox_pause_tick_10ms = 0; } #endif @@ -977,13 +980,14 @@ void APP_process_radio_interrupts(void) if (interrupt_bits & BK4819_REG_02_SQUELCH_CLOSED) { g_squelch_open = false; -// g_squelch_open = g_monitor_enabled; BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) UART_SendText("sq close\r\n"); #endif + + g_update_display = true; } if (interrupt_bits & BK4819_REG_02_SQUELCH_OPENED) @@ -993,6 +997,11 @@ void APP_process_radio_interrupts(void) #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) UART_SendText("sq open\r\n"); #endif + + if (g_monitor_enabled) + BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on + + g_update_display = true; } } } @@ -1003,28 +1012,28 @@ void APP_end_tx(void) RADIO_tx_eot(); if (g_current_vfo->p_tx->code_type != CODE_TYPE_NONE) - { // CTCSS/DCS is enabled + { // CTCSS/CDCSS is enabled //if (g_eeprom.tail_note_elimination && g_eeprom.repeater_tail_tone_elimination > 0) if (g_eeprom.tail_note_elimination) { // send the CTCSS/DCS tail tone - allows the receivers to mute the usual FM squelch tail/crash RADIO_EnableCxCSS(); } - #if 0 + #if 1 else - { // TX a short blank carrier - // this gives the receivers time to mute RX audio before we drop carrier + { // TX a short blank carrier after disabling the CTCSS/CDCSS + // this gives the receivers time to mute their RX audio before we drop carrier BK4819_ExitSubAu(); SYSTEM_DelayMs(200); } #endif } + g_speaker_enabled = false; + RADIO_setup_registers(false); - if (!g_speaker_enabled && !g_monitor_enabled) - GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); - else + if (g_monitor_enabled) APP_start_listening(); } @@ -1381,7 +1390,7 @@ void APP_cancel_user_input_modes(void) GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); else GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); - + if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu g_request_display_screen = DISPLAY_MAIN; } @@ -1458,7 +1467,7 @@ void APP_process_flash_light_10ms(void) GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); #ifdef ENABLE_FLASH_LIGHT_SOS_TONE if (!g_squelch_open && !g_monitor_enabled && !GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER)) - BK4819_StartTone1(880, 127, true); + BK4819_StartTone1(880, 50, true); #endif } } @@ -1468,7 +1477,7 @@ void APP_process_flash_light_10ms(void) { // LED off GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); // OFF #ifdef ENABLE_FLASH_LIGHT_SOS_TONE - if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER)) + if (!g_squelch_open && !g_monitor_enabled && GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER)) BK4819_StopTones(g_current_function == FUNCTION_TRANSMIT); #endif } @@ -1885,7 +1894,7 @@ void APP_process_functions(void) case FUNCTION_NEW_RECEIVE: APP_process_new_receive(); break; - + case FUNCTION_RECEIVE: APP_process_rx(); break; @@ -1897,7 +1906,7 @@ void APP_process_functions(void) case FUNCTION_PANADAPTER: break; - + default: break; } @@ -1906,7 +1915,7 @@ void APP_process_functions(void) void APP_process_power_save(void) { bool power_save = true; - + if (g_monitor_enabled || #ifdef ENABLE_FMRADIO g_fm_radio_mode || @@ -1924,7 +1933,7 @@ void APP_process_power_save(void) { power_save = false; } - + #ifdef ENABLE_NOAA if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[0]) || IS_NOAA_CHANNEL(g_eeprom.screen_channel[1]) || @@ -1948,7 +1957,7 @@ void APP_process_power_save(void) { // enter power save FUNCTION_Select(FUNCTION_POWER_SAVE); } - + g_schedule_power_save = false; #ifdef ENABLE_VOICE @@ -2295,7 +2304,7 @@ void APP_time_slice_500ms(void) if (--g_fm_resume_tick_500ms == 0) { RADIO_Setg_vfo_state(VFO_STATE_NORMAL); - + if (g_current_function != FUNCTION_RECEIVE && !g_monitor_enabled && g_fm_radio_mode) @@ -2306,7 +2315,7 @@ void APP_time_slice_500ms(void) } } } - + if (g_fm_radio_mode && g_fm_radio_tick_500ms == 0) return; #endif @@ -2465,7 +2474,7 @@ void APP_time_slice_10ms(void) if (g_monitor_enabled) APP_start_listening(); - + GUI_SelectNextDisplay(DISPLAY_MAIN); } @@ -2530,9 +2539,7 @@ void APP_time_slice_10ms(void) if (g_vox_pause_tick_10ms > 0) g_vox_pause_tick_10ms--; - #endif - #ifdef ENABLE_VOX if (g_eeprom.vox_switch) APP_process_vox(); #endif @@ -3011,7 +3018,7 @@ Skip: if (g_speaker_enabled || g_monitor_enabled) APP_start_listening(); - + g_flag_reconfigure_vfos = false; } diff --git a/firmware.bin b/firmware.bin index d2ea298..8ded911 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 83819e1..bc97d80 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/radio.c b/radio.c index d4d8820..906ea9b 100644 --- a/radio.c +++ b/radio.c @@ -695,12 +695,11 @@ void RADIO_setup_registers(bool switch_to_function_foreground) BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, true); // AF RX Gain and DAC -// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 00 111010 1000 - if (g_rx_vfo->am_mode) - { - BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000 - } - else +// if (g_rx_vfo->am_mode) +// { +// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000 +// } +// else { BK4819_WriteRegister(0x48, (11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference diff --git a/ui/main.c b/ui/main.c index f5adfbd..a0a2dbf 100644 --- a/ui/main.c +++ b/ui/main.c @@ -587,8 +587,7 @@ void UI_DisplayMain(void) else { // receiving .. show the RX symbol mode = 2; - if ((g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_NEW_RECEIVE) && - g_eeprom.rx_vfo == vfo_num) + if ((g_current_function == FUNCTION_RECEIVE && g_squelch_open) && g_eeprom.rx_vfo == vfo_num) { #ifdef ENABLE_SMALL_BOLD UI_PrintStringSmallBold("RX", 14, 0, line); @@ -829,11 +828,8 @@ void UI_DisplayMain(void) else if (mode == 2) { // RX signal level - //#ifndef ENABLE_RX_SIGNAL_BAR - // antenna bar graph - if (g_vfo_rssi_bar_level[vfo_num] > 0) - Level = g_vfo_rssi_bar_level[vfo_num]; - //#endif + if (g_vfo_rssi_bar_level[vfo_num] > 0) + Level = g_vfo_rssi_bar_level[vfo_num]; } UI_drawBars(p_line1 + LCD_WIDTH, Level); @@ -917,7 +913,7 @@ void UI_DisplayMain(void) g_dtmf_call_state == DTMF_CALL_STATE_NONE) { // we're free to use the middle line - const bool rx = (g_current_function == FUNCTION_RECEIVE); + const bool rx = (g_current_function == FUNCTION_RECEIVE && g_squelch_open) ? true : false; #ifdef ENABLE_TX_TIMEOUT_BAR // show the TX timeout count down