0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-29 14:51:26 +03:00

renames to reduce confusion

This commit is contained in:
OneOfEleven 2023-10-23 14:02:54 +01:00
parent 74f52f9d14
commit 3b4178d59d
22 changed files with 177 additions and 129 deletions

View File

@ -12,7 +12,7 @@ ENABLE_OVERLAY := 0
ENABLE_LTO := 1 ENABLE_LTO := 1
# UART Programming 2.9 kB # UART Programming 2.9 kB
ENABLE_UART := 1 ENABLE_UART := 1
ENABLE_UART_DEBUG := 0 ENABLE_UART_DEBUG := 1
# AirCopy 2.5 kB # AirCopy 2.5 kB
ENABLE_AIRCOPY := 1 ENABLE_AIRCOPY := 1
ENABLE_AIRCOPY_REMEMBER_FREQ := 1 ENABLE_AIRCOPY_REMEMBER_FREQ := 1

View File

@ -80,10 +80,10 @@ ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit mor
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 open the squelch when holding down UP or DN buttons when in frequency mode 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 increase the channel scan speed, but also make the squelch more twitchy ENABLE_FASTER_CHANNEL_SCAN := 1 increase the channel scan speed, but also make the squelch more twitchy
ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1 long press M, copy channel to VFO, or VFO to channel ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1 long press M, copy channel to VFO, or VFO to channel
ENABLE_RX_SIGNAL_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols ENABLE_RX_SIGNAL_BAR := 1 enable a menu option for showing an RSSI bar graph
ENABLE_TX_TIMEOUT_BAR := 0 show the remainng TX time ENABLE_TX_TIMEOUT_BAR := 0 show the remainng TX time
ENABLE_TX_AUDIO_BAR := 1 enable TX audio level bar, includes remaining TX time (in seconds) ENABLE_TX_AUDIO_BAR := 1 enable a menu option for showing a TX audio level bar
ENABLE_SIDE_BUTT_MENU := 1 change programmable side buttons in menu 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 auto lock after 30 sec or long press F to lock
#ENABLE_BAND_SCOPE := 0 not yet implemented - spectrum/pan-adapter #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_SINGLE_VFO_CHAN := 0 not yet implemented - single VFO on display when possible

View File

@ -327,7 +327,7 @@
case FUNCTION_FOREGROUND: case FUNCTION_FOREGROUND:
case FUNCTION_RECEIVE: case FUNCTION_RECEIVE:
case FUNCTION_MONITOR: case FUNCTION_MONITOR:
case FUNCTION_INCOMING: case FUNCTION_NEW_RECEIVE:
break; break;
} }

115
app/app.c
View File

@ -90,9 +90,9 @@ static void APP_update_rssi(const int vfo)
UI_update_rssi(rssi, vfo); UI_update_rssi(rssi, vfo);
} }
static void APP_check_for_incoming_rx(void) static void APP_check_for_new_receive(void)
{ {
if (!g_squelch_lost) if (!g_squelch_open)
return; return;
// squelch is open // squelch is open
@ -139,23 +139,22 @@ static void APP_check_for_incoming_rx(void)
} }
g_rx_reception_mode = RX_MODE_DETECTED; g_rx_reception_mode = RX_MODE_DETECTED;
g_scan_pause_mode = true; // 1of11
done: done:
if (g_current_function != FUNCTION_INCOMING) if (g_current_function != FUNCTION_NEW_RECEIVE)
{ {
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_NEW_RECEIVE);
APP_update_rssi(g_eeprom.rx_vfo); APP_update_rssi(g_eeprom.rx_vfo);
g_update_rssi = true; g_update_rssi = true;
} }
} }
static void APP_process_incoming_rx(void) static void APP_process_new_receive(void)
{ {
bool flag; bool flag;
if (!g_squelch_lost) if (!g_squelch_open)
{ // squelch is closed { // squelch is closed
if (g_dtmf_rx_index > 0) if (g_dtmf_rx_index > 0)
@ -166,6 +165,7 @@ static void APP_process_incoming_rx(void)
FUNCTION_Select(FUNCTION_FOREGROUND); FUNCTION_Select(FUNCTION_FOREGROUND);
g_update_display = true; g_update_display = true;
} }
return; return;
} }
@ -243,7 +243,7 @@ static void APP_process_rx(void)
if (g_scan_state_dir != SCAN_STATE_DIR_OFF && IS_FREQ_CHANNEL(g_scan_next_channel)) if (g_scan_state_dir != SCAN_STATE_DIR_OFF && IS_FREQ_CHANNEL(g_scan_next_channel))
{ {
if (g_squelch_lost) if (g_squelch_open)
return; return;
Mode = END_OF_RX_MODE_END; Mode = END_OF_RX_MODE_END;
@ -261,7 +261,7 @@ static void APP_process_rx(void)
{ {
g_found_ctcss = false; g_found_ctcss = false;
g_found_cdcss = false; g_found_cdcss = false;
Mode = END_OF_RX_MODE_END; Mode = END_OF_RX_MODE_END;
goto Skip; goto Skip;
} }
break; break;
@ -272,13 +272,13 @@ static void APP_process_rx(void)
{ {
g_found_ctcss = false; g_found_ctcss = false;
g_found_cdcss = false; g_found_cdcss = false;
Mode = END_OF_RX_MODE_END; Mode = END_OF_RX_MODE_END;
goto Skip; goto Skip;
} }
break; break;
} }
if (g_squelch_lost) if (g_squelch_open)
{ {
if (!g_end_of_rx_detected_maybe && IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save)) if (!g_end_of_rx_detected_maybe && IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
{ {
@ -340,7 +340,9 @@ static void APP_process_rx(void)
} }
} }
else else
{
Mode = END_OF_RX_MODE_END; Mode = END_OF_RX_MODE_END;
}
if (!g_end_of_rx_detected_maybe && if (!g_end_of_rx_detected_maybe &&
Mode == END_OF_RX_MODE_SKIP && Mode == END_OF_RX_MODE_SKIP &&
@ -376,14 +378,14 @@ Skip:
{ {
switch (g_eeprom.scan_resume_mode) switch (g_eeprom.scan_resume_mode)
{ {
case SCAN_RESUME_TO: case SCAN_RESUME_TIME:
break; break;
case SCAN_RESUME_CO: case SCAN_RESUME_CARRIER:
g_scan_pause_10ms = g_eeprom.scan_hold_time_500ms * 50; g_scan_pause_10ms = g_eeprom.scan_hold_time_500ms * 50;
break; break;
case SCAN_RESUME_SE: case SCAN_RESUME_SEARCH:
APP_stop_scan(); APP_stop_scan();
break; break;
} }
@ -399,7 +401,7 @@ Skip:
g_tail_tone_elimination_count_down_10ms = 20; g_tail_tone_elimination_count_down_10ms = 20;
g_flag_tail_tone_elimination_complete = false; g_flag_tail_tone_elimination_complete = false;
g_end_of_rx_detected_maybe = true; g_end_of_rx_detected_maybe = true;
g_enable_speaker = false; g_speaker_enabled = false;
} }
break; break;
} }
@ -413,7 +415,7 @@ static void APP_process_function(void)
switch (g_current_function) switch (g_current_function)
{ {
case FUNCTION_FOREGROUND: case FUNCTION_FOREGROUND:
APP_check_for_incoming_rx(); APP_check_for_new_receive();
break; break;
case FUNCTION_TRANSMIT: case FUNCTION_TRANSMIT:
@ -421,8 +423,8 @@ static void APP_process_function(void)
backlight_turn_on(backlight_tx_rx_time_500ms); backlight_turn_on(backlight_tx_rx_time_500ms);
break; break;
case FUNCTION_INCOMING: case FUNCTION_NEW_RECEIVE:
APP_process_incoming_rx(); APP_process_new_receive();
case FUNCTION_MONITOR: case FUNCTION_MONITOR:
break; break;
@ -433,7 +435,7 @@ static void APP_process_function(void)
case FUNCTION_POWER_SAVE: case FUNCTION_POWER_SAVE:
if (!g_rx_idle_mode) if (!g_rx_idle_mode)
APP_check_for_incoming_rx(); APP_check_for_new_receive();
break; break;
case FUNCTION_PANADAPTER: case FUNCTION_PANADAPTER:
@ -465,13 +467,17 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
g_vfo_rssi_bar_level[(chan + 1) & 1u] = 0; g_vfo_rssi_bar_level[(chan + 1) & 1u] = 0;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
if (g_scan_state_dir != SCAN_STATE_DIR_OFF) if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
{ // we're RF scanning { // we're RF scanning
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (g_eeprom.scan_resume_mode) switch (g_eeprom.scan_resume_mode)
{ {
case SCAN_RESUME_TO: case SCAN_RESUME_TIME:
if (!g_scan_pause_mode) if (!g_scan_pause_mode)
{ {
g_scan_pause_10ms = g_eeprom.scan_hold_time_500ms * 50; g_scan_pause_10ms = g_eeprom.scan_hold_time_500ms * 50;
@ -479,11 +485,14 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
} }
break; break;
case SCAN_RESUME_CO: case SCAN_RESUME_CARRIER:
case SCAN_RESUME_SE:
case SCAN_RESUME_SEARCH:
g_scan_pause_10ms = 0; g_scan_pause_10ms = 0;
break; break;
} }
#pragma GCC diagnostic pop
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
@ -610,7 +619,7 @@ void APP_stop_scan(void)
g_scan_pause_10ms > (200 / 10) || g_scan_pause_10ms > (200 / 10) ||
g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_RECEIVE ||
g_current_function == FUNCTION_MONITOR || g_current_function == FUNCTION_MONITOR ||
g_current_function == FUNCTION_INCOMING) g_current_function == FUNCTION_NEW_RECEIVE)
{ // stay where we are { // stay where we are
g_scan_pause_mode = false; g_scan_pause_mode = false;
g_scan_restore_channel = 0xff; g_scan_restore_channel = 0xff;
@ -953,16 +962,24 @@ void APP_process_radio_interrupts(void)
} }
#endif #endif
if (interrupt_bits & BK4819_REG_02_SQUELCH_LOST) if (interrupt_bits & BK4819_REG_02_SQUELCH_CLOSED)
{ {
g_squelch_lost = true; BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on g_squelch_open = false;
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("squelch found (closed)\r\n");
#endif
} }
if (interrupt_bits & BK4819_REG_02_SQUELCH_FOUND) if (interrupt_bits & BK4819_REG_02_SQUELCH_OPENED)
{ {
g_squelch_lost = false; // BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off g_squelch_open = true;
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("squelch lost (opened)\r\n");
#endif
} }
} }
} }
@ -1114,31 +1131,43 @@ void APP_process(void)
if (g_voice_write_index == 0) if (g_voice_write_index == 0)
#endif #endif
{ {
if ((g_current_function == FUNCTION_FOREGROUND || if ((g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_NEW_RECEIVE) && // TODO: check me
g_current_function == FUNCTION_INCOMING) && // TODO: check me
g_screen_to_display != DISPLAY_SEARCH && g_screen_to_display != DISPLAY_SEARCH &&
g_scan_state_dir != SCAN_STATE_DIR_OFF && g_scan_state_dir != SCAN_STATE_DIR_OFF &&
g_scan_pause_10ms == 0 && g_scan_pause_10ms == 0 &&
!g_ptt_is_pressed) !g_ptt_is_pressed)
{ // RF scanning { // RF scanning
// TODO: check to see if signal stays present for minimum time before pausing
if (IS_FREQ_CHANNEL(g_scan_next_channel)) if (IS_FREQ_CHANNEL(g_scan_next_channel))
{ {
if (g_current_function == FUNCTION_INCOMING) if (g_current_function == FUNCTION_NEW_RECEIVE)
{
APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
}
else else
APP_next_freq(); // switch to next frequency { // switch to next frequency
g_scan_pause_mode = false;
g_rx_reception_mode = RX_MODE_NONE;
APP_next_freq();
}
} }
else else
{ {
if (g_current_code_type == CODE_TYPE_NONE && g_current_function == FUNCTION_INCOMING) if (g_current_code_type == CODE_TYPE_NONE && g_current_function == FUNCTION_NEW_RECEIVE)
{
APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
}
else else
APP_next_channel(); // switch to next channel { // switch to next channel
g_scan_pause_mode = false;
g_rx_reception_mode = RX_MODE_NONE;
APP_next_channel();
}
} }
g_scan_pause_mode = false;
g_rx_reception_mode = RX_MODE_NONE;
} }
} }
@ -1711,7 +1740,7 @@ void APP_time_slice_10ms(void)
SYSTEM_DelayMs(2); SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
g_alarm_tone_counter_10ms = 0; g_alarm_tone_counter_10ms = 0;
} }
} }
@ -2339,7 +2368,7 @@ void APP_time_slice_500ms(void)
static void APP_alarm_off(void) static void APP_alarm_off(void)
{ {
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = false; g_speaker_enabled = false;
if (g_eeprom.alarm_mode == ALARM_MODE_TONE) if (g_eeprom.alarm_mode == ALARM_MODE_TONE)
{ {
@ -2619,7 +2648,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
{ {
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = false; g_speaker_enabled = false;
BK4819_ExitDTMF_TX(false); BK4819_ExitDTMF_TX(false);
@ -2634,7 +2663,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
if (g_eeprom.dtmf_side_tone) if (g_eeprom.dtmf_side_tone)
{ // user will here the DTMF tones in speaker { // user will here the DTMF tones in speaker
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
} }
BK4819_DisableScramble(); BK4819_DisableScramble();

View File

@ -442,7 +442,7 @@ bool DTMF_Reply(void)
if (g_eeprom.dtmf_side_tone) if (g_eeprom.dtmf_side_tone)
{ // the user will also hear the transmitted tones { // the user will also hear the transmitted tones
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
} }
SYSTEM_DelayMs(Delay); SYSTEM_DelayMs(Delay);
@ -459,7 +459,7 @@ bool DTMF_Reply(void)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = false; g_speaker_enabled = false;
BK4819_ExitDTMF_TX(false); BK4819_ExitDTMF_TX(false);

View File

@ -101,7 +101,7 @@ void FM_TurnOff(void)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = false; g_speaker_enabled = false;
BK1080_Init(0, false); BK1080_Init(0, false);
@ -124,7 +124,7 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool flag)
{ {
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = false; g_speaker_enabled = false;
g_fm_play_count_down_10ms = (g_fm_scan_state == FM_SCAN_OFF) ? fm_play_countdown_noscan_10ms : fm_play_countdown_scan_10ms; g_fm_play_count_down_10ms = (g_fm_scan_state == FM_SCAN_OFF) ? fm_play_countdown_noscan_10ms : fm_play_countdown_scan_10ms;
@ -171,7 +171,7 @@ void FM_PlayAndUpdate(void)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
} }
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit) int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
@ -660,7 +660,7 @@ void FM_Play(void)
g_eeprom.fm_selected_frequency = g_eeprom.fm_frequency_playing; g_eeprom.fm_selected_frequency = g_eeprom.fm_frequency_playing;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
GUI_SelectNextDisplay(DISPLAY_FM); GUI_SelectNextDisplay(DISPLAY_FM);
return; return;
@ -695,6 +695,6 @@ void FM_Start(void)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
g_update_status = true; g_update_status = true;
} }

View File

@ -40,6 +40,19 @@
#include "ui/ui.h" #include "ui/ui.h"
#include "ui/menu.h" #include "ui/menu.h"
bool scanning_paused(void)
{
if ((g_scan_state_dir != SCAN_STATE_DIR_OFF || g_eeprom.dual_watch != DUAL_WATCH_OFF) &&
g_scan_pause_10ms > 0 &&
g_scan_pause_10ms <= (200 / 10) &&
!g_scan_pause_mode)
{ // scanning isn't paused
return false;
}
return true;
}
void toggle_chan_scanlist(void) void toggle_chan_scanlist(void)
{ // toggle the selected channels scanlist setting { // toggle the selected channels scanlist setting
@ -58,10 +71,7 @@ void toggle_chan_scanlist(void)
return; return;
} }
if (g_scan_state_dir != SCAN_STATE_DIR_OFF && if (!scanning_paused())
g_scan_pause_10ms > 0 &&
g_scan_pause_10ms <= (200 / 10) &&
!g_scan_pause_mode)
{ // scanning isn't paused { // scanning isn't paused
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return; return;
@ -94,11 +104,14 @@ void toggle_chan_scanlist(void)
//const unsigned int vfo = get_RX_VFO(); //const unsigned int vfo = get_RX_VFO();
const unsigned int vfo = g_eeprom.tx_vfo; const unsigned int vfo = g_eeprom.tx_vfo;
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || if (g_css_scan_mode != CSS_SCAN_MODE_OFF || !g_eeprom.vfo_open)
g_css_scan_mode != CSS_SCAN_MODE_OFF || { // scanning or VFO disabled
g_eeprom.dual_watch != DUAL_WATCH_OFF || g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
!g_eeprom.vfo_open) return;
{ // scanning }
if (!scanning_paused())
{ // RF scanning
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return; return;
} }

View File

@ -447,7 +447,7 @@ void SEARCH_Start(void)
g_cdcss_code_type = 0; g_cdcss_code_type = 0;
g_ctcss_lost = false; g_ctcss_lost = false;
g_squelch_lost = false; g_squelch_open = false;
g_search_delay_10ms = scan_freq_css_delay_10ms; g_search_delay_10ms = scan_freq_css_delay_10ms;
g_search_css_result_type = CODE_TYPE_NONE; g_search_css_result_type = CODE_TYPE_NONE;
g_search_css_result_code = 0xff; g_search_css_result_code = 0xff;

View File

@ -220,7 +220,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
// restore the register // restore the register
BK4819_WriteRegister(BK4819_REG_71, ToneConfig); BK4819_WriteRegister(BK4819_REG_71, ToneConfig);
if (g_enable_speaker) if (g_speaker_enabled)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108) #if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
@ -322,7 +322,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
BK1080_Mute(false); BK1080_Mute(false);
#endif #endif
if (!g_enable_speaker) if (!g_speaker_enabled)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_voice_write_index = 0; g_voice_write_index = 0;
@ -470,7 +470,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
BK1080_Mute(false); BK1080_Mute(false);
#endif #endif
if (!g_enable_speaker) if (!g_speaker_enabled)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
// ********************** // **********************

View File

@ -376,19 +376,19 @@ const uint8_t BITMAP_VFO_NOT_DEFAULT[8] =
const uint8_t BITMAP_SCANLIST1[6] = const uint8_t BITMAP_SCANLIST1[6] =
{ // 'I' symbol { // 'I' symbol
__extension__ 0b00000000, __extension__ 0b00000000,
__extension__ 0b00010001,
__extension__ 0b00011111,
__extension__ 0b00010001,
__extension__ 0b00000000, __extension__ 0b00000000,
__extension__ 0b01000010,
__extension__ 0b01111110,
__extension__ 0b01000010,
__extension__ 0b00000000 __extension__ 0b00000000
}; };
const uint8_t BITMAP_SCANLIST2[6] = const uint8_t BITMAP_SCANLIST2[6] =
{ // 'II' symbol { // 'II' symbol
__extension__ 0b00000000, __extension__ 0b00000000,
__extension__ 0b01000010, __extension__ 0b00010001,
__extension__ 0b01111110, __extension__ 0b00011111,
__extension__ 0b01000010, __extension__ 0b00010001,
__extension__ 0b01111110, __extension__ 0b00011111,
__extension__ 0b01000010 __extension__ 0b00010001
}; };

View File

@ -599,7 +599,7 @@ void BOARD_EEPROM_load(void)
g_eeprom.key1_long_press_action = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT; g_eeprom.key1_long_press_action = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT;
g_eeprom.key2_short_press_action = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN; g_eeprom.key2_short_press_action = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN;
g_eeprom.key2_long_press_action = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE; g_eeprom.key2_long_press_action = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE;
g_eeprom.scan_resume_mode = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO; g_eeprom.scan_resume_mode = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CARRIER;
g_eeprom.auto_keypad_lock = (Data[6] < 2) ? Data[6] : false; g_eeprom.auto_keypad_lock = (Data[6] < 2) ? Data[6] : false;
g_eeprom.pwr_on_display_mode = (Data[7] < 4) ? Data[7] : PWR_ON_DISPLAY_MODE_VOLTAGE; g_eeprom.pwr_on_display_mode = (Data[7] < 4) ? Data[7] : PWR_ON_DISPLAY_MODE_VOLTAGE;

View File

@ -149,8 +149,8 @@ typedef enum bk4819_gpio_pin_e bk4819_gpio_pin_t;
#define BK4819_REG_02_CTCSS_LOST (1U << BK4819_REG_02_SHIFT_CTCSS_LOST) #define BK4819_REG_02_CTCSS_LOST (1U << BK4819_REG_02_SHIFT_CTCSS_LOST)
#define BK4819_REG_02_VOX_FOUND (1U << BK4819_REG_02_SHIFT_VOX_FOUND) #define BK4819_REG_02_VOX_FOUND (1U << BK4819_REG_02_SHIFT_VOX_FOUND)
#define BK4819_REG_02_VOX_LOST (1U << BK4819_REG_02_SHIFT_VOX_LOST) #define BK4819_REG_02_VOX_LOST (1U << BK4819_REG_02_SHIFT_VOX_LOST)
#define BK4819_REG_02_SQUELCH_FOUND (1U << BK4819_REG_02_SHIFT_SQUELCH_FOUND) #define BK4819_REG_02_SQUELCH_CLOSED (1U << BK4819_REG_02_SHIFT_SQUELCH_FOUND)
#define BK4819_REG_02_SQUELCH_LOST (1U << BK4819_REG_02_SHIFT_SQUELCH_LOST) #define BK4819_REG_02_SQUELCH_OPENED (1U << BK4819_REG_02_SHIFT_SQUELCH_LOST)
#define BK4819_REG_02_FSK_RX_SYNC (1U << BK4819_REG_02_SHIFT_FSK_RX_SYNC) #define BK4819_REG_02_FSK_RX_SYNC (1U << BK4819_REG_02_SHIFT_FSK_RX_SYNC)
// REG 07 // REG 07

View File

@ -1057,7 +1057,7 @@ void BK4819_StartTone1(const uint16_t frequency, const unsigned int level, const
void BK4819_StopTones(void) void BK4819_StopTones(void)
{ {
// if (!g_enable_speaker) // if (!g_speaker_enabled)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
BK4819_EnterTxMute(); BK4819_EnterTxMute();

View File

@ -62,7 +62,7 @@ void FUNCTION_Init(void)
g_vox_lost = false; g_vox_lost = false;
#endif #endif
g_squelch_lost = false; g_squelch_open = false;
g_flag_tail_tone_elimination_complete = false; g_flag_tail_tone_elimination_complete = false;
g_tail_tone_elimination_count_down_10ms = 0; g_tail_tone_elimination_count_down_10ms = 0;
@ -138,16 +138,18 @@ void FUNCTION_Select(function_type_t Function)
g_monitor_enabled = true; g_monitor_enabled = true;
break; break;
case FUNCTION_INCOMING: case FUNCTION_NEW_RECEIVE:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("func incoming\r\n"); UART_SendText("func new receive\r\n");
#endif #endif
break; break;
case FUNCTION_RECEIVE: case FUNCTION_RECEIVE:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("func receive\r\n"); UART_SendText("func receive\r\n");
#endif #endif
break; break;
case FUNCTION_POWER_SAVE: case FUNCTION_POWER_SAVE:
@ -224,7 +226,7 @@ void FUNCTION_Select(function_type_t Function)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
SYSTEM_DelayMs(60); SYSTEM_DelayMs(60);
BK4819_ExitTxMute(); BK4819_ExitTxMute();
@ -259,7 +261,7 @@ void FUNCTION_Select(function_type_t Function)
g_alarm_tone_counter_10ms = 0; g_alarm_tone_counter_10ms = 0;
#endif #endif
g_enable_speaker = true; g_speaker_enabled = true;
break; break;
} }
else else
@ -275,6 +277,11 @@ void FUNCTION_Select(function_type_t Function)
break; break;
case FUNCTION_PANADAPTER: case FUNCTION_PANADAPTER:
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_SendText("func panadpter\r\n");
#endif
break; break;
} }

View File

@ -24,8 +24,8 @@ enum function_type_e
FUNCTION_FOREGROUND = 0, // idle, scanning FUNCTION_FOREGROUND = 0, // idle, scanning
FUNCTION_TRANSMIT, // transmitting FUNCTION_TRANSMIT, // transmitting
FUNCTION_MONITOR, // receiving with squelch forced open FUNCTION_MONITOR, // receiving with squelch forced open
FUNCTION_INCOMING, // signal just received FUNCTION_NEW_RECEIVE, // signal just received
FUNCTION_RECEIVE, // RX mode, squelch closed FUNCTION_RECEIVE, // receive mode
FUNCTION_POWER_SAVE, // sleeping FUNCTION_POWER_SAVE, // sleeping
FUNCTION_PANADAPTER // bandscope mode (panadpter/spectrum) .. not yet implemented FUNCTION_PANADAPTER // bandscope mode (panadpter/spectrum) .. not yet implemented
}; };

8
misc.c
View File

@ -43,9 +43,9 @@ const uint8_t dtmf_txstop_countdown_500ms = 3000 / 500; // 6 sec
const uint8_t serial_config_count_down_500ms = 3000 / 500; // 3 seconds const uint8_t serial_config_count_down_500ms = 3000 / 500; // 3 seconds
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
#ifdef ENABLE_KEYLOCK #ifdef ENABLE_KEYLOCK
const uint8_t key_lock_timeout_500ms = 30000 / 500; // 30 seconds const uint8_t key_lock_timeout_500ms = 30000 / 500; // 30 seconds
#endif #endif
const uint8_t key_debounce_10ms = 30 / 10; // 30ms const uint8_t key_debounce_10ms = 30 / 10; // 30ms
@ -160,7 +160,7 @@ volatile uint16_t g_tail_tone_elimination_count_down_10ms;
volatile uint16_t g_noaa_count_down_10ms; volatile uint16_t g_noaa_count_down_10ms;
#endif #endif
bool g_enable_speaker; bool g_speaker_enabled;
uint8_t g_key_input_count_down; uint8_t g_key_input_count_down;
#ifdef ENABLE_KEYLOCK #ifdef ENABLE_KEYLOCK
uint8_t g_key_lock_count_down_500ms; uint8_t g_key_lock_count_down_500ms;
@ -213,7 +213,7 @@ bool g_cxcss_tail_found;
uint16_t g_vox_resume_count_down; uint16_t g_vox_resume_count_down;
uint16_t g_vox_pause_count_down; uint16_t g_vox_pause_count_down;
#endif #endif
bool g_squelch_lost; bool g_squelch_open;
uint8_t g_flash_light_state; uint8_t g_flash_light_state;
volatile uint16_t g_flash_light_blink_counter; volatile uint16_t g_flash_light_blink_counter;

6
misc.h
View File

@ -131,7 +131,7 @@ extern const uint8_t serial_config_count_down_500ms;
extern const uint8_t key_input_timeout_500ms; extern const uint8_t key_input_timeout_500ms;
#ifdef ENABLE_KEYLOCK #ifdef ENABLE_KEYLOCK
extern const uint8_t key_lock_timeout_500ms; extern const uint8_t key_lock_timeout_500ms;
#endif #endif
extern const uint8_t key_debounce_10ms; extern const uint8_t key_debounce_10ms;
@ -246,7 +246,7 @@ extern volatile uint16_t g_tail_tone_elimination_count_down_10ms;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
extern volatile uint16_t g_noaa_count_down_10ms; extern volatile uint16_t g_noaa_count_down_10ms;
#endif #endif
extern bool g_enable_speaker; extern bool g_speaker_enabled;
extern uint8_t g_key_input_count_down; extern uint8_t g_key_input_count_down;
#ifdef ENABLE_KEYLOCK #ifdef ENABLE_KEYLOCK
@ -299,7 +299,7 @@ extern bool g_cxcss_tail_found;
extern uint16_t g_vox_resume_count_down; extern uint16_t g_vox_resume_count_down;
extern uint16_t g_vox_pause_count_down; extern uint16_t g_vox_pause_count_down;
#endif #endif
extern bool g_squelch_lost; extern bool g_squelch_open;
extern uint8_t g_flash_light_state; extern uint8_t g_flash_light_state;
extern volatile uint16_t g_flash_light_blink_counter; extern volatile uint16_t g_flash_light_blink_counter;
extern bool g_flag_end_tx; extern bool g_flag_end_tx;

View File

@ -594,7 +594,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
uint32_t Frequency; uint32_t Frequency;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = false; g_speaker_enabled = false;
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false);
@ -845,7 +845,7 @@ void RADIO_enableTX(const bool fsk_tx)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = false; g_speaker_enabled = false;
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false); // ??? BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_RX_ENABLE, false); // ???
@ -1101,7 +1101,7 @@ void RADIO_tx_eot(void)
if (g_eeprom.dtmf_side_tone) if (g_eeprom.dtmf_side_tone)
{ {
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = true; g_speaker_enabled = true;
SYSTEM_DelayMs(60); SYSTEM_DelayMs(60);
} }
BK4819_EnterDTMF_TX(g_eeprom.dtmf_side_tone); BK4819_EnterDTMF_TX(g_eeprom.dtmf_side_tone);
@ -1114,7 +1114,7 @@ void RADIO_tx_eot(void)
g_eeprom.dtmf_code_interval_time); g_eeprom.dtmf_code_interval_time);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_enable_speaker = false; g_speaker_enabled = false;
} }
else else
if (g_eeprom.roger_mode == ROGER_MODE_ROGER) if (g_eeprom.roger_mode == ROGER_MODE_ROGER)

View File

@ -46,9 +46,9 @@ enum {
}; };
enum { enum {
SCAN_RESUME_TO = 0, SCAN_RESUME_TIME = 0,
SCAN_RESUME_CO, SCAN_RESUME_CARRIER,
SCAN_RESUME_SE SCAN_RESUME_SEARCH
}; };
enum { enum {

View File

@ -361,7 +361,7 @@ void UI_update_rssi(const int16_t rssi, const int vfo)
else else
if (rssi >= level0 || if (rssi >= level0 ||
g_current_function == FUNCTION_MONITOR || g_current_function == FUNCTION_MONITOR ||
g_current_function == FUNCTION_INCOMING) g_current_function == FUNCTION_NEW_RECEIVE)
{ {
rssi_level = 1; rssi_level = 1;
} }
@ -569,7 +569,7 @@ void UI_DisplayMain(void)
mode = 2; mode = 2;
if ((g_current_function == FUNCTION_RECEIVE || if ((g_current_function == FUNCTION_RECEIVE ||
g_current_function == FUNCTION_MONITOR || g_current_function == FUNCTION_MONITOR ||
g_current_function == FUNCTION_INCOMING) && g_current_function == FUNCTION_NEW_RECEIVE) &&
g_eeprom.rx_vfo == vfo_num) g_eeprom.rx_vfo == vfo_num)
{ {
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
@ -690,7 +690,6 @@ void UI_DisplayMain(void)
case MDF_NAME_FREQ: // channel name and frequency case MDF_NAME_FREQ: // channel name and frequency
BOARD_fetchChannelName(String, g_eeprom.screen_channel[vfo_num]); BOARD_fetchChannelName(String, g_eeprom.screen_channel[vfo_num]);
if (String[0] == 0) if (String[0] == 0)
{ // no channel name available, channel number instead { // no channel name available, channel number instead
sprintf(String, "CH-%03u", 1 + g_eeprom.screen_channel[vfo_num]); sprintf(String, "CH-%03u", 1 + g_eeprom.screen_channel[vfo_num]);
@ -698,16 +697,16 @@ void UI_DisplayMain(void)
if (g_eeprom.channel_display_mode == MDF_NAME) if (g_eeprom.channel_display_mode == MDF_NAME)
{ // just the name { // just the name
UI_PrintString(String, x, 0, line, 8); UI_PrintString(String, x + 4, 0, line, 8);
} }
else else
{ // name & frequency { // name & frequency
// name // name
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold(String, x, 0, line); UI_PrintStringSmallBold(String, x + 4, 0, line);
#else #else
UI_PrintStringSmall(String, x, 0, line); UI_PrintStringSmall(String, x + 4, 0, line);
#endif #endif
// frequency // frequency
@ -715,7 +714,7 @@ void UI_DisplayMain(void)
#ifdef ENABLE_TRIM_TRAILING_ZEROS #ifdef ENABLE_TRIM_TRAILING_ZEROS
NUMBER_trim_trailing_zeros(String); NUMBER_trim_trailing_zeros(String);
#endif #endif
UI_PrintStringSmall(String, x, 0, line + 1); UI_PrintStringSmall(String, x + 4, 0, line + 1);
} }
break; break;
@ -890,7 +889,7 @@ void UI_DisplayMain(void)
const bool rx = (g_current_function == FUNCTION_RECEIVE || const bool rx = (g_current_function == FUNCTION_RECEIVE ||
g_current_function == FUNCTION_MONITOR || g_current_function == FUNCTION_MONITOR ||
g_current_function == FUNCTION_INCOMING); g_current_function == FUNCTION_NEW_RECEIVE);
#ifdef ENABLE_TX_TIMEOUT_BAR #ifdef ENABLE_TX_TIMEOUT_BAR
// show the TX timeout count down // show the TX timeout count down

View File

@ -54,6 +54,7 @@ enum
MENU_TX_TO, MENU_TX_TO,
MENU_CROSS_VFO, MENU_CROSS_VFO,
MENU_DUAL_WATCH, MENU_DUAL_WATCH,
MENU_SCAN_CAR_RESUME,
MENU_SCAN_HOLD, MENU_SCAN_HOLD,
MENU_SCRAMBLER, MENU_SCRAMBLER,
MENU_BUSY_CHAN_LOCK, MENU_BUSY_CHAN_LOCK,
@ -70,7 +71,6 @@ enum
#ifdef ENABLE_CONTRAST #ifdef ENABLE_CONTRAST
MENU_CONTRAST, MENU_CONTRAST,
#endif #endif
MENU_SCAN_CAR_RESUME,
MENU_S_ADD1, MENU_S_ADD1,
MENU_S_ADD2, MENU_S_ADD2,
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA

View File

@ -55,7 +55,7 @@ void UI_DisplayStatus(const bool test_display)
else else
if (g_current_function == FUNCTION_RECEIVE || if (g_current_function == FUNCTION_RECEIVE ||
g_current_function == FUNCTION_MONITOR || g_current_function == FUNCTION_MONITOR ||
g_current_function == FUNCTION_INCOMING) g_current_function == FUNCTION_NEW_RECEIVE)
{ {
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX)); memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
x1 = x + sizeof(BITMAP_RX); x1 = x + sizeof(BITMAP_RX);