0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

Try up/down butts with squelch off/monitor enabled

This commit is contained in:
OneOfEleven 2023-10-16 06:43:42 +01:00
parent 798f0f97f3
commit 244c4f1091
35 changed files with 623 additions and 587 deletions

View File

@ -76,13 +76,13 @@ void ACTION_Monitor(void)
{ {
if (g_current_function != FUNCTION_MONITOR) if (g_current_function != FUNCTION_MONITOR)
{ // enable the monitor { // enable the monitor
RADIO_SelectVfos(); RADIO_select_vfos();
#ifdef g_power_save_expired #ifdef ENABLE_NOAA
if (g_rx_vfo->channel_save >= NOAA_CHANNEL_FIRST && g_is_noaa_mode) if (g_rx_vfo->channel_save >= NOAA_CHANNEL_FIRST && g_is_noaa_mode)
g_noaa_channel = g_rx_vfo->channel_save - NOAA_CHANNEL_FIRST; g_noaa_channel = g_rx_vfo->channel_save - NOAA_CHANNEL_FIRST;
#endif #endif
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
APP_StartListening(FUNCTION_MONITOR, false); APP_start_listening(FUNCTION_MONITOR, false);
return; return;
} }
@ -103,7 +103,7 @@ void ACTION_Monitor(void)
} }
#endif #endif
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (g_fm_radio_mode) if (g_fm_radio_mode)
@ -139,19 +139,18 @@ void ACTION_Scan(bool bRestart)
#endif #endif
} }
else else
{ { // start scanning
uint16_t Frequency; uint16_t Frequency;
if (bRestart) if (bRestart)
{ // going to scan and auto store what we find { // scan with auto store
FM_EraseChannels(); FM_EraseChannels();
g_fm_auto_scan = true; g_fm_auto_scan = true;
g_fm_channel_position = 0; g_fm_channel_position = 0;
Frequency = FM_RADIO_BAND.lower; Frequency = FM_RADIO_BAND.lower;
} }
else else
{ { // scan without auto store
g_fm_auto_scan = false; g_fm_auto_scan = false;
g_fm_channel_position = 0; g_fm_channel_position = 0;
Frequency = g_eeprom.fm_frequency_playing; Frequency = g_eeprom.fm_frequency_playing;
@ -172,7 +171,7 @@ void ACTION_Scan(bool bRestart)
#endif #endif
if (g_screen_to_display != DISPLAY_SEARCH) if (g_screen_to_display != DISPLAY_SEARCH)
{ // not scanning { // not in freq/ctcss/cdcss search mode
g_monitor_enabled = false; g_monitor_enabled = false;
@ -181,44 +180,48 @@ void ACTION_Scan(bool bRestart)
g_dtmf_rx_live_timeout = 0; g_dtmf_rx_live_timeout = 0;
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live)); memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
RADIO_SelectVfos(); RADIO_select_vfos();
#ifdef g_power_save_expired
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save)) if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
#endif
{ {
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
if (g_scan_state_dir != SCAN_STATE_DIR_OFF) if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
{ // already scanning { // currently scanning
if (g_scan_next_channel <= USER_CHANNEL_LAST) if (g_scan_next_channel <= USER_CHANNEL_LAST)
{ // channel mode { // channel mode
// keep scanning but toggle between scan lists if (g_eeprom.scan_list_default < 2)
g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3; { // keep scanning but toggle between scan lists
//g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3;
g_eeprom.scan_list_default++;
// jump to the next channel // jump to the next channel
CHANNEL_Next(true, g_scan_state_dir); APP_channel_next(true, g_scan_state_dir);
g_scan_pause_delay_in_10ms = 1; g_scan_pause_delay_in_10ms = 1;
g_scan_schedule_scan_listen = false; g_scan_schedule_scan_listen = false;
g_update_status = true; g_update_status = true;
return;
}
} }
else
{ // stop scanning
SCAN_Stop(); // stop scanning
APP_stop_scan();
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP; g_another_voice_id = VOICE_ID_SCANNING_STOP;
#endif #endif
}
}
else
{ // start scanning
CHANNEL_Next(true, SCAN_STATE_DIR_FORWARD); return;
}
// start scanning
APP_channel_next(true, SCAN_STATE_DIR_FORWARD);
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN); AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
@ -228,20 +231,25 @@ void ACTION_Scan(bool bRestart)
// clear the other vfo's rssi level (to hide the antenna symbol) // clear the other vfo's rssi level (to hide the antenna symbol)
g_vfo_rssi_bar_level[(g_eeprom.rx_vfo + 1) & 1u] = 0; g_vfo_rssi_bar_level[(g_eeprom.rx_vfo + 1) & 1u] = 0;
// let the user see DW is not active
g_dual_watch_active = false;
g_update_status = true; g_update_status = true;
} }
return;
} }
}
else // freq/ctcss/cdcss/search mode
// TODO: fixme
// if (!bRestart) // if (!bRestart)
if (!bRestart && g_scan_next_channel <= USER_CHANNEL_LAST) if (!bRestart && g_scan_next_channel <= USER_CHANNEL_LAST)
{ // channel mode, keep scanning but toggle between scan lists { // channel mode, keep scanning but toggle between scan lists
g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3; g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3;
// jump to the next channel // jump to the next channel
CHANNEL_Next(true, g_scan_state_dir); APP_channel_next(true, g_scan_state_dir);
g_scan_pause_delay_in_10ms = 1; g_scan_pause_delay_in_10ms = 1;
g_scan_schedule_scan_listen = false; g_scan_schedule_scan_listen = false;
@ -251,7 +259,7 @@ void ACTION_Scan(bool bRestart)
{ // stop scanning { // stop scanning
g_monitor_enabled = false; g_monitor_enabled = false;
SCAN_Stop(); APP_stop_scan();
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP; g_another_voice_id = VOICE_ID_SCANNING_STOP;
@ -320,8 +328,8 @@ void ACTION_Scan(bool bRestart)
g_monitor_enabled = false; g_monitor_enabled = false;
RADIO_SelectVfos(); RADIO_select_vfos();
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
FM_Start(); FM_Start();

View File

@ -70,7 +70,7 @@ void AIRCOPY_init(void)
// turn the backlight ON // turn the backlight ON
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
BK4819_SetupAircopy(AIRCOPY_DATA_PACKET_SIZE); BK4819_SetupAircopy(AIRCOPY_DATA_PACKET_SIZE);
@ -762,7 +762,7 @@ static void AIRCOPY_Key_MENU(bool key_pressed, bool key_held)
} }
} }
void AIRCOPY_ProcessKey(key_code_t Key, bool key_pressed, bool key_held) void AIRCOPY_process_key(key_code_t Key, bool key_pressed, bool key_held)
{ {
switch (Key) switch (Key)
{ {

View File

@ -42,6 +42,6 @@ extern uint16_t g_fsk_tx_timeout_10ms;
void AIRCOPY_init(void); void AIRCOPY_init(void);
void AIRCOPY_process_fsk_tx_10ms(void); void AIRCOPY_process_fsk_tx_10ms(void);
void AIRCOPY_process_fsk_rx_10ms(void); void AIRCOPY_process_fsk_rx_10ms(void);
void AIRCOPY_ProcessKey(key_code_t key, bool key_pressed, bool key_held); void AIRCOPY_process_key(key_code_t key, bool key_pressed, bool key_held);
#endif #endif

277
app/app.c
View File

@ -70,9 +70,9 @@ const uint8_t orig_lna = 2; // -14dB
const uint8_t orig_mixer = 3; // 0dB const uint8_t orig_mixer = 3; // 0dB
const uint8_t orig_pga = 6; // -3dB const uint8_t orig_pga = 6; // -3dB
static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const bool key_held); static void APP_process_key(const key_code_t Key, const bool key_pressed, const bool key_held);
static void updateRSSI(const int vfo) static void APP_update_rssi(const int vfo)
{ {
int16_t rssi = BK4819_GetRSSI(); int16_t rssi = BK4819_GetRSSI();
@ -87,13 +87,13 @@ static void updateRSSI(const int vfo)
g_current_rssi[vfo] = rssi; g_current_rssi[vfo] = rssi;
UI_UpdateRSSI(rssi, vfo); UI_update_rssi(rssi, vfo);
} }
static void APP_CheckForIncoming(void) static void APP_check_for_incoming_rx(void)
{ {
if (!g_squelch_lost) if (!g_squelch_lost)
return; // squelch is closed return;
// squelch is open // squelch is open
@ -124,7 +124,7 @@ static void APP_CheckForIncoming(void)
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_INCOMING);
//g_update_display = true; //g_update_display = true;
updateRSSI(g_eeprom.rx_vfo); APP_update_rssi(g_eeprom.rx_vfo);
g_update_rssi = true; g_update_rssi = true;
} }
@ -140,7 +140,7 @@ static void APP_CheckForIncoming(void)
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_INCOMING);
//g_update_display = true; //g_update_display = true;
updateRSSI(g_eeprom.rx_vfo); APP_update_rssi(g_eeprom.rx_vfo);
g_update_rssi = true; g_update_rssi = true;
} }
return; return;
@ -149,8 +149,6 @@ static void APP_CheckForIncoming(void)
g_dual_watch_count_down_10ms = dual_watch_count_after_rx_10ms; g_dual_watch_count_down_10ms = dual_watch_count_after_rx_10ms;
g_schedule_dual_watch = false; g_schedule_dual_watch = false;
// let the user see DW is not active
g_dual_watch_active = false;
g_update_status = true; g_update_status = true;
} }
else else
@ -162,7 +160,7 @@ static void APP_CheckForIncoming(void)
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_INCOMING);
//g_update_display = true; //g_update_display = true;
updateRSSI(g_eeprom.rx_vfo); APP_update_rssi(g_eeprom.rx_vfo);
g_update_rssi = true; g_update_rssi = true;
} }
return; return;
@ -179,12 +177,12 @@ static void APP_CheckForIncoming(void)
FUNCTION_Select(FUNCTION_INCOMING); FUNCTION_Select(FUNCTION_INCOMING);
//g_update_display = true; //g_update_display = true;
updateRSSI(g_eeprom.rx_vfo); APP_update_rssi(g_eeprom.rx_vfo);
g_update_rssi = true; g_update_rssi = true;
} }
} }
static void APP_HandleIncoming(void) static void APP_process_incoming_rx(void)
{ {
bool flag; bool flag;
@ -228,7 +226,8 @@ static void APP_HandleIncoming(void)
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && g_css_scan_mode == CSS_SCAN_MODE_OFF) if (g_scan_state_dir == SCAN_STATE_DIR_OFF && g_css_scan_mode == CSS_SCAN_MODE_OFF)
{ // not scanning { // not scanning
if (g_rx_vfo->dtmf_decoding_enable || g_setting_killed)
if (g_rx_vfo->dtmf_decoding_enable || g_setting_radio_disabled)
{ // DTMF DCD is enabled { // DTMF DCD is enabled
DTMF_HandleRequest(); DTMF_HandleRequest();
@ -242,27 +241,28 @@ static void APP_HandleIncoming(void)
g_rx_reception_mode = RX_MODE_LISTENING; g_rx_reception_mode = RX_MODE_LISTENING;
// let the user see DW is not active
g_dual_watch_active = false;
g_update_status = true; g_update_status = true;
g_update_display = true; g_update_display = true;
return; return;
} }
} }
} }
} }
APP_StartListening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, false); APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, false);
} }
static void APP_HandleReceive(void) enum end_of_rx_mode_e {
{ END_OF_RX_MODE_SKIP = 0,
#define END_OF_RX_MODE_SKIP 0 END_OF_RX_MODE_END,
#define END_OF_RX_MODE_END 1 END_OF_RX_MODE_TTE
#define END_OF_RX_MODE_TTE 2 };
typedef enum end_of_rx_mode_e end_of_rx_mode_t;
uint8_t Mode = END_OF_RX_MODE_SKIP; static void APP_process_rx(void)
{
end_of_rx_mode_t Mode = END_OF_RX_MODE_SKIP;
if (g_flag_tail_tone_elimination_complete) if (g_flag_tail_tone_elimination_complete)
{ {
@ -309,11 +309,7 @@ static void APP_HandleReceive(void)
if (g_squelch_lost) if (g_squelch_lost)
{ {
#ifdef ENABLE_NOAA
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))
#else
if (!g_end_of_rx_detected_maybe)
#endif
{ {
switch (g_current_code_type) switch (g_current_code_type)
{ {
@ -396,11 +392,11 @@ Skip:
break; break;
case END_OF_RX_MODE_END: case END_OF_RX_MODE_END:
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save)) if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save))
g_noaa_count_down_10ms = 300; // 3 sec g_noaa_count_down_10ms = 3000 / 10; // 3 sec
#endif #endif
g_update_display = true; g_update_display = true;
@ -418,7 +414,7 @@ Skip:
break; break;
case SCAN_RESUME_SE: case SCAN_RESUME_SE:
SCAN_Stop(); APP_stop_scan();
break; break;
} }
} }
@ -439,12 +435,12 @@ Skip:
} }
} }
static void APP_HandleFunction(void) static void APP_process_function(void)
{ {
switch (g_current_function) switch (g_current_function)
{ {
case FUNCTION_FOREGROUND: case FUNCTION_FOREGROUND:
APP_CheckForIncoming(); APP_check_for_incoming_rx();
break; break;
case FUNCTION_TRANSMIT: case FUNCTION_TRANSMIT:
@ -454,16 +450,16 @@ static void APP_HandleFunction(void)
break; break;
case FUNCTION_INCOMING: case FUNCTION_INCOMING:
APP_HandleIncoming(); APP_process_incoming_rx();
break; break;
case FUNCTION_RECEIVE: case FUNCTION_RECEIVE:
APP_HandleReceive(); APP_process_rx();
break; break;
case FUNCTION_POWER_SAVE: case FUNCTION_POWER_SAVE:
if (!g_rx_idle_mode) if (!g_rx_idle_mode)
APP_CheckForIncoming(); APP_check_for_incoming_rx();
break; break;
case FUNCTION_BAND_SCOPE: case FUNCTION_BAND_SCOPE:
@ -471,12 +467,12 @@ static void APP_HandleFunction(void)
} }
} }
void APP_StartListening(function_type_t Function, const bool reset_am_fix) void APP_start_listening(function_type_t Function, const bool reset_am_fix)
{ {
const unsigned int chan = g_eeprom.rx_vfo; const unsigned int chan = g_eeprom.rx_vfo;
// const unsigned int chan = g_rx_vfo->channel_save; // const unsigned int chan = g_rx_vfo->channel_save;
if (g_setting_killed) if (g_setting_radio_disabled)
return; return;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
@ -495,7 +491,8 @@ void APP_StartListening(function_type_t Function, const bool reset_am_fix)
backlight_turn_on(); backlight_turn_on();
if (g_scan_state_dir != SCAN_STATE_DIR_OFF) if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
{ { // we're scanning
switch (g_eeprom.scan_resume_mode) switch (g_eeprom.scan_resume_mode)
{ {
case SCAN_RESUME_TO: case SCAN_RESUME_TO:
@ -524,7 +521,7 @@ void APP_StartListening(function_type_t Function, const bool reset_am_fix)
g_rx_vfo->p_rx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel]; 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_rx_vfo->p_tx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
g_eeprom.screen_channel[chan] = g_rx_vfo->channel_save; g_eeprom.screen_channel[chan] = g_rx_vfo->channel_save;
g_noaa_count_down_10ms = 500; // 5 sec g_noaa_count_down_10ms = 5000 / 10; // 5 sec
g_schedule_noaa = false; g_schedule_noaa = false;
} }
#endif #endif
@ -535,15 +532,13 @@ void APP_StartListening(function_type_t Function, const bool reset_am_fix)
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && if (g_scan_state_dir == SCAN_STATE_DIR_OFF &&
g_css_scan_mode == CSS_SCAN_MODE_OFF && g_css_scan_mode == CSS_SCAN_MODE_OFF &&
g_eeprom.dual_watch != DUAL_WATCH_OFF) g_eeprom.dual_watch != DUAL_WATCH_OFF)
{ // not scanning, dual watch is enabled { // not scanning, but dual watch is enabled
g_dual_watch_count_down_10ms = dual_watch_count_after_2_10ms; g_dual_watch_count_down_10ms = dual_watch_count_after_2_10ms;
g_schedule_dual_watch = false; g_schedule_dual_watch = false;
g_rx_vfo_is_active = true; g_rx_vfo_is_active = true;
// let the user see DW is not active
g_dual_watch_active = false;
g_update_status = true; g_update_status = true;
} }
@ -559,7 +554,7 @@ void APP_StartListening(function_type_t Function, const bool reset_am_fix)
if (g_rx_vfo->am_mode && g_setting_am_fix) if (g_rx_vfo->am_mode && g_setting_am_fix)
{ // AM RX mode { // AM RX mode
if (reset_am_fix) if (reset_am_fix)
AM_fix_reset(chan); // TODO: only reset it when moving channel/frequency AM_fix_reset(chan); // TODO: only reset it when moving channel/frequency .. or do we ???
AM_fix_10ms(chan); AM_fix_10ms(chan);
} }
else else
@ -606,7 +601,7 @@ void APP_StartListening(function_type_t Function, const bool reset_am_fix)
g_update_status = true; g_update_status = true;
} }
uint32_t APP_SetFrequencyByStep(vfo_info_t *pInfo, int8_t Step) uint32_t APP_set_frequency_by_step(vfo_info_t *pInfo, int8_t Step)
{ {
uint32_t Frequency = pInfo->freq_config_rx.frequency + (Step * pInfo->step_freq); uint32_t Frequency = pInfo->freq_config_rx.frequency + (Step * pInfo->step_freq);
@ -632,7 +627,7 @@ uint32_t APP_SetFrequencyByStep(vfo_info_t *pInfo, int8_t Step)
return Frequency; return Frequency;
} }
void SCAN_Stop(void) void APP_stop_scan(void)
{ {
const uint8_t Previous = g_scan_restore_channel; const uint8_t Previous = g_scan_restore_channel;
@ -658,7 +653,7 @@ void SCAN_Stop(void)
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo); RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
} }
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
g_update_display = true; g_update_display = true;
return; return;
@ -677,13 +672,13 @@ void SCAN_Stop(void)
g_update_status = true; g_update_status = true;
} }
static void FREQ_NextChannel(void) static void APP_next_freq(void)
{ {
g_rx_vfo->freq_config_rx.frequency = APP_SetFrequencyByStep(g_rx_vfo, g_scan_state_dir); g_rx_vfo->freq_config_rx.frequency = APP_set_frequency_by_step(g_rx_vfo, g_scan_state_dir);
RADIO_ApplyOffset(g_rx_vfo); RADIO_ApplyOffset(g_rx_vfo);
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo); RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
#ifdef ENABLE_FASTER_CHANNEL_SCAN #ifdef ENABLE_FASTER_CHANNEL_SCAN
g_scan_pause_delay_in_10ms = 9; // 90ms g_scan_pause_delay_in_10ms = 9; // 90ms
@ -695,7 +690,7 @@ static void FREQ_NextChannel(void)
g_update_display = true; g_update_display = true;
} }
static void USER_NextChannel(void) static void APP_next_channel(void)
{ {
static unsigned int prevChannel = 0; static unsigned int prevChannel = 0;
const bool enabled = (g_eeprom.scan_list_default < 2) ? g_eeprom.scan_list_enabled[g_eeprom.scan_list_default] : true; const bool enabled = (g_eeprom.scan_list_default < 2) ? g_eeprom.scan_list_enabled[g_eeprom.scan_list_default] : true;
@ -780,7 +775,7 @@ static void USER_NextChannel(void)
g_eeprom.screen_channel[g_eeprom.rx_vfo] = g_scan_next_channel; g_eeprom.screen_channel[g_eeprom.rx_vfo] = g_scan_next_channel;
RADIO_ConfigureChannel(g_eeprom.rx_vfo, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(g_eeprom.rx_vfo, VFO_CONFIGURE_RELOAD);
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
g_update_display = true; g_update_display = true;
} }
@ -799,14 +794,14 @@ static void USER_NextChannel(void)
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
static void NOAA_IncreaseChannel(void) static void APP_next_noaa(void)
{ {
if (++g_noaa_channel >= ARRAY_SIZE(NOAA_FREQUENCY_TABLE)) if (++g_noaa_channel >= ARRAY_SIZE(NOAA_FREQUENCY_TABLE))
g_noaa_channel = 0; g_noaa_channel = 0;
} }
#endif #endif
static void DUALWATCH_Alternate(void) static void APP_toggle_dual_watch_vfo(void)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (g_is_noaa_mode) if (g_is_noaa_mode)
@ -819,22 +814,17 @@ static void DUALWATCH_Alternate(void)
g_rx_vfo = &g_eeprom.vfo_info[g_eeprom.rx_vfo]; g_rx_vfo = &g_eeprom.vfo_info[g_eeprom.rx_vfo];
if (g_eeprom.vfo_info[0].channel_save >= NOAA_CHANNEL_FIRST) if (g_eeprom.vfo_info[0].channel_save >= NOAA_CHANNEL_FIRST)
NOAA_IncreaseChannel(); APP_next_noaa();
} }
else else
#endif #endif
{ // toggle between VFO's { // toggle between VFO's
g_eeprom.rx_vfo = (g_eeprom.rx_vfo + 1) & 1; g_eeprom.rx_vfo = (g_eeprom.rx_vfo + 1) & 1;
g_rx_vfo = &g_eeprom.vfo_info[g_eeprom.rx_vfo]; g_rx_vfo = &g_eeprom.vfo_info[g_eeprom.rx_vfo];
if (!g_dual_watch_active)
{ // let the user see DW is active
g_dual_watch_active = true;
g_update_status = true; g_update_status = true;
} }
}
RADIO_SetupRegisters(false); RADIO_setup_registers(false);
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
g_dual_watch_count_down_10ms = g_is_noaa_mode ? dual_watch_count_noaa_10ms : dual_watch_count_toggle_10ms; g_dual_watch_count_down_10ms = g_is_noaa_mode ? dual_watch_count_noaa_10ms : dual_watch_count_toggle_10ms;
@ -843,7 +833,7 @@ static void DUALWATCH_Alternate(void)
#endif #endif
} }
void APP_CheckRadioInterrupts(void) void APP_process_radio_interrupts(void)
{ {
if (g_screen_to_display == DISPLAY_SEARCH) if (g_screen_to_display == DISPLAY_SEARCH)
return; return;
@ -875,7 +865,7 @@ void APP_CheckRadioInterrupts(void)
g_update_display = true; g_update_display = true;
} }
if (g_rx_vfo->dtmf_decoding_enable || g_setting_killed) if (g_rx_vfo->dtmf_decoding_enable || g_setting_radio_disabled)
{ {
if (g_dtmf_rx_index >= (sizeof(g_dtmf_rx) - 1)) if (g_dtmf_rx_index >= (sizeof(g_dtmf_rx) - 1))
{ // make room { // make room
@ -931,8 +921,6 @@ void APP_CheckRadioInterrupts(void)
g_dual_watch_count_down_10ms = dual_watch_count_after_vox_10ms; g_dual_watch_count_down_10ms = dual_watch_count_after_vox_10ms;
g_schedule_dual_watch = false; g_schedule_dual_watch = false;
// let the user see DW is not active
g_dual_watch_active = false;
g_update_status = true; g_update_status = true;
} }
} }
@ -959,7 +947,7 @@ void APP_CheckRadioInterrupts(void)
} }
} }
void APP_EndTransmission(void) void APP_end_tx(void)
{ // back to RX mode { // back to RX mode
RADIO_SendEndOfTransmission(); RADIO_SendEndOfTransmission();
@ -982,13 +970,13 @@ void APP_EndTransmission(void)
#endif #endif
} }
RADIO_SetupRegisters(false); RADIO_setup_registers(false);
} }
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
static void APP_HandleVox(void) static void APP_process_vox(void)
{ {
if (g_setting_killed) if (g_setting_radio_disabled)
return; return;
if (g_vox_resume_count_down == 0) if (g_vox_resume_count_down == 0)
@ -1032,7 +1020,7 @@ void APP_EndTransmission(void)
} }
else else
{ {
APP_EndTransmission(); APP_end_tx();
if (g_eeprom.repeater_tail_tone_elimination == 0) if (g_eeprom.repeater_tail_tone_elimination == 0)
{ {
@ -1067,25 +1055,24 @@ void APP_EndTransmission(void)
} }
#endif #endif
void APP_Update(void) void APP_process(void)
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
if (g_flag_play_queued_voice) if (g_flag_play_queued_voice)
{ {
AUDIO_PlayQueuedVoice();
g_flag_play_queued_voice = false; g_flag_play_queued_voice = false;
AUDIO_PlayQueuedVoice();
} }
#endif #endif
if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timeout_reached || g_serial_config_count_down_500ms > 0)) if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timeout_reached || g_serial_config_count_down_500ms > 0))
{ // transmitter timed out or must de-key { // transmitter timed out or must de-key
g_tx_timeout_reached = false; g_tx_timeout_reached = false;
g_flag_end_tx = true; g_flag_end_tx = true;
APP_EndTransmission();
APP_end_tx();
AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP);
RADIO_Setg_vfo_state(VFO_STATE_TIMEOUT); RADIO_Setg_vfo_state(VFO_STATE_TIMEOUT);
GUI_DisplayScreen(); GUI_DisplayScreen();
@ -1095,7 +1082,7 @@ void APP_Update(void)
return; return;
if (g_current_function != FUNCTION_TRANSMIT) if (g_current_function != FUNCTION_TRANSMIT)
APP_HandleFunction(); APP_process_function();
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0) if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0)
@ -1115,16 +1102,16 @@ void APP_Update(void)
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_INCOMING)
APP_StartListening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
else else
FREQ_NextChannel(); // switch to next frequency APP_next_freq(); // switch to next frequency
} }
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_INCOMING)
APP_StartListening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true); APP_start_listening(g_monitor_enabled ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
else else
USER_NextChannel(); // switch to next channel APP_next_channel(); // switch to next channel
} }
g_scan_pause_mode = false; g_scan_pause_mode = false;
@ -1134,15 +1121,15 @@ void APP_Update(void)
} }
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
if (g_css_scan_mode == CSS_SCAN_MODE_SCANNING && g_scan_schedule_scan_listen && g_voice_write_index == 0) if (g_voice_write_index == 0)
#else
if (g_css_scan_mode == CSS_SCAN_MODE_SCANNING && g_scan_schedule_scan_listen)
#endif #endif
{
if (g_css_scan_mode == CSS_SCAN_MODE_SCANNING && g_scan_schedule_scan_listen)
{ {
MENU_SelectNextCode(); MENU_SelectNextCode();
g_scan_schedule_scan_listen = false; g_scan_schedule_scan_listen = false;
} }
}
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@ -1151,8 +1138,8 @@ void APP_Update(void)
{ {
if (g_eeprom.dual_watch == DUAL_WATCH_OFF && g_is_noaa_mode && g_schedule_noaa) if (g_eeprom.dual_watch == DUAL_WATCH_OFF && g_is_noaa_mode && g_schedule_noaa)
{ {
NOAA_IncreaseChannel(); APP_next_noaa();
RADIO_SetupRegisters(false); RADIO_setup_registers(false);
g_noaa_count_down_10ms = 7; // 70ms g_noaa_count_down_10ms = 7; // 70ms
g_schedule_noaa = false; g_schedule_noaa = false;
@ -1183,7 +1170,7 @@ void APP_Update(void)
g_dtmf_call_state == DTMF_CALL_STATE_NONE && g_dtmf_call_state == DTMF_CALL_STATE_NONE &&
g_current_function != FUNCTION_POWER_SAVE) g_current_function != FUNCTION_POWER_SAVE)
{ {
DUALWATCH_Alternate(); // toggle between the two VFO's APP_toggle_dual_watch_vfo(); // toggle between the two VFO's
if (g_rx_vfo_is_active && g_screen_to_display == DISPLAY_MAIN) if (g_rx_vfo_is_active && g_screen_to_display == DISPLAY_MAIN)
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
@ -1213,7 +1200,7 @@ void APP_Update(void)
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
if (g_eeprom.vox_switch) if (g_eeprom.vox_switch)
APP_HandleVox(); APP_process_vox();
#endif #endif
if (g_schedule_power_save) if (g_schedule_power_save)
@ -1291,7 +1278,7 @@ void APP_Update(void)
g_scan_state_dir == SCAN_STATE_DIR_OFF && g_scan_state_dir == SCAN_STATE_DIR_OFF &&
g_css_scan_mode == CSS_SCAN_MODE_OFF) g_css_scan_mode == CSS_SCAN_MODE_OFF)
{ // dual watch mode, toggle between the two VFO's { // dual watch mode, toggle between the two VFO's
DUALWATCH_Alternate(); APP_toggle_dual_watch_vfo();
g_update_rssi = false; g_update_rssi = false;
} }
@ -1308,7 +1295,7 @@ void APP_Update(void)
g_update_rssi) g_update_rssi)
{ // dual watch mode, go back to sleep { // dual watch mode, go back to sleep
updateRSSI(g_eeprom.rx_vfo); APP_update_rssi(g_eeprom.rx_vfo);
// go back to sleep // go back to sleep
@ -1325,7 +1312,7 @@ void APP_Update(void)
else else
{ {
// toggle between the two VFO's // toggle between the two VFO's
DUALWATCH_Alternate(); APP_toggle_dual_watch_vfo();
g_update_rssi = true; g_update_rssi = true;
g_power_save_10ms = power_save1_10ms; g_power_save_10ms = power_save1_10ms;
@ -1337,13 +1324,13 @@ void APP_Update(void)
} }
// called every 10ms // called every 10ms
void APP_CheckKeys(void) void APP_check_keys(void)
{ {
const bool ptt_pressed = !GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && (g_serial_config_count_down_500ms == 0) && g_setting_tx_enable; const bool ptt_pressed = !GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && (g_serial_config_count_down_500ms == 0) && g_setting_tx_enable;
key_code_t key; key_code_t key;
if (g_setting_killed) if (g_setting_radio_disabled)
return; return;
// ***************** // *****************
@ -1352,9 +1339,9 @@ void APP_CheckKeys(void)
if (ptt_pressed) if (ptt_pressed)
{ // PTT pressed { // PTT pressed
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (!g_setting_killed && !g_ptt_is_pressed && g_screen_to_display != DISPLAY_AIRCOPY) if (!g_setting_radio_disabled && !g_ptt_is_pressed && g_screen_to_display != DISPLAY_AIRCOPY)
#else #else
if (!g_setting_killed && !g_ptt_is_pressed) if (!g_setting_radio_disabled && !g_ptt_is_pressed)
#endif #endif
{ {
if (++g_ptt_debounce >= 3) // 30ms if (++g_ptt_debounce >= 3) // 30ms
@ -1365,7 +1352,7 @@ void APP_CheckKeys(void)
g_ptt_was_released = false; g_ptt_was_released = false;
g_ptt_debounce = 0; g_ptt_debounce = 0;
APP_ProcessKey(KEY_PTT, true, false); APP_process_key(KEY_PTT, true, false);
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released); // UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released);
@ -1386,7 +1373,7 @@ void APP_CheckKeys(void)
g_ptt_was_released = true; g_ptt_was_released = true;
g_ptt_debounce = 0; g_ptt_debounce = 0;
APP_ProcessKey(KEY_PTT, false, false); APP_process_key(KEY_PTT, false, false);
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released); // UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released);
@ -1430,11 +1417,11 @@ void APP_CheckKeys(void)
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY) if (g_screen_to_display != DISPLAY_AIRCOPY)
APP_ProcessKey(g_key_prev, false, g_key_held); APP_process_key(g_key_prev, false, g_key_held);
else else
AIRCOPY_ProcessKey(g_key_prev, false, g_key_held); AIRCOPY_process_key(g_key_prev, false, g_key_held);
#else #else
APP_ProcessKey(g_key_prev, false, g_key_held); APP_process_key(g_key_prev, false, g_key_held);
#endif #endif
g_key_debounce_press = 0; g_key_debounce_press = 0;
@ -1470,11 +1457,11 @@ void APP_CheckKeys(void)
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY) if (g_screen_to_display != DISPLAY_AIRCOPY)
APP_ProcessKey(g_key_prev, true, g_key_held); APP_process_key(g_key_prev, true, g_key_held);
else else
AIRCOPY_ProcessKey(g_key_prev, true, g_key_held); AIRCOPY_process_key(g_key_prev, true, g_key_held);
#else #else
APP_ProcessKey(g_key_prev, true, g_key_held); APP_process_key(g_key_prev, true, g_key_held);
#endif #endif
g_update_status = true; g_update_status = true;
@ -1495,11 +1482,11 @@ void APP_CheckKeys(void)
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY) if (g_screen_to_display != DISPLAY_AIRCOPY)
APP_ProcessKey(g_key_prev, true, g_key_held); APP_process_key(g_key_prev, true, g_key_held);
else else
AIRCOPY_ProcessKey(g_key_prev, true, g_key_held); AIRCOPY_process_key(g_key_prev, true, g_key_held);
#else #else
APP_ProcessKey(g_key_prev, true, g_key_held); APP_process_key(g_key_prev, true, g_key_held);
#endif #endif
//g_update_status = true; //g_update_status = true;
@ -1519,11 +1506,11 @@ void APP_CheckKeys(void)
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY) if (g_screen_to_display != DISPLAY_AIRCOPY)
APP_ProcessKey(g_key_prev, true, g_key_held); APP_process_key(g_key_prev, true, g_key_held);
else else
AIRCOPY_ProcessKey(g_key_prev, true, g_key_held); AIRCOPY_process_key(g_key_prev, true, g_key_held);
#else #else
APP_ProcessKey(g_key_prev, true, g_key_held); APP_process_key(g_key_prev, true, g_key_held);
#endif #endif
//g_update_status = true; //g_update_status = true;
@ -1535,7 +1522,7 @@ void APP_CheckKeys(void)
// ***************** // *****************
} }
void APP_TimeSlice10ms(void) void APP_time_slice_10ms(void)
{ {
g_flash_light_blink_counter++; g_flash_light_blink_counter++;
@ -1574,7 +1561,7 @@ void APP_TimeSlice10ms(void)
g_flag_save_channel = false; g_flag_save_channel = false;
RADIO_ConfigureChannel(g_eeprom.tx_vfo, VFO_CONFIGURE); RADIO_ConfigureChannel(g_eeprom.tx_vfo, VFO_CONFIGURE);
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
@ -1609,7 +1596,7 @@ void APP_TimeSlice10ms(void)
AIRCOPY_process_fsk_rx_10ms(); AIRCOPY_process_fsk_rx_10ms();
APP_CheckKeys(); APP_check_keys();
if (g_update_display) if (g_update_display)
GUI_DisplayScreen(); GUI_DisplayScreen();
@ -1628,7 +1615,7 @@ void APP_TimeSlice10ms(void)
#endif #endif
if (g_current_function != FUNCTION_POWER_SAVE || !g_rx_idle_mode) if (g_current_function != FUNCTION_POWER_SAVE || !g_rx_idle_mode)
APP_CheckRadioInterrupts(); APP_process_radio_interrupts();
if (g_current_function == FUNCTION_TRANSMIT) if (g_current_function == FUNCTION_TRANSMIT)
{ // transmitting { // transmitting
@ -1751,14 +1738,14 @@ void APP_TimeSlice10ms(void)
{ {
if (--g_search_delay_10ms > 0) if (--g_search_delay_10ms > 0)
{ {
APP_CheckKeys(); APP_check_keys();
return; return;
} }
} }
if (g_search_edit_state != SEARCH_EDIT_STATE_NONE) if (g_search_edit_state != SEARCH_EDIT_STATE_NONE)
{ // waiting for user input choice { // waiting for user input choice
APP_CheckKeys(); APP_check_keys();
return; return;
} }
@ -1950,10 +1937,10 @@ void APP_TimeSlice10ms(void)
} }
} }
APP_CheckKeys(); APP_check_keys();
} }
void cancelUserInputModes(void) void APP_cancel_user_input_modes(void)
{ {
if (g_ask_to_save) if (g_ask_to_save)
{ {
@ -1991,7 +1978,7 @@ void cancelUserInputModes(void)
} }
// this is called once every 500ms // this is called once every 500ms
void APP_TimeSlice500ms(void) void APP_time_slice_500ms(void)
{ {
bool exit_menu = false; bool exit_menu = false;
@ -2010,7 +1997,7 @@ void APP_TimeSlice500ms(void)
{ {
if (--g_key_input_count_down == 0) if (--g_key_input_count_down == 0)
{ {
cancelUserInputModes(); APP_cancel_user_input_modes();
if (g_beep_to_play != BEEP_NONE) if (g_beep_to_play != BEEP_NONE)
{ {
@ -2156,7 +2143,7 @@ void APP_TimeSlice500ms(void)
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
} }
*/ */
DTMF_clear_input_box(); DTMF_clear_input_box();
@ -2200,7 +2187,7 @@ void APP_TimeSlice500ms(void)
} }
if (g_current_function != FUNCTION_POWER_SAVE && g_current_function != FUNCTION_TRANSMIT) if (g_current_function != FUNCTION_POWER_SAVE && g_current_function != FUNCTION_TRANSMIT)
updateRSSI(g_eeprom.rx_vfo); APP_update_rssi(g_eeprom.rx_vfo);
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (!g_ptt_is_pressed && g_fm_resume_count_down_500ms > 0) if (!g_ptt_is_pressed && g_fm_resume_count_down_500ms > 0)
@ -2322,7 +2309,7 @@ void APP_TimeSlice500ms(void)
} }
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
static void ALARM_Off(void) static void APP_alarm_off(void)
{ {
g_alarm_state = ALARM_STATE_OFF; g_alarm_state = ALARM_STATE_OFF;
@ -2341,16 +2328,16 @@ void APP_TimeSlice500ms(void)
SYSTEM_DelayMs(5); SYSTEM_DelayMs(5);
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
if (g_screen_to_display != DISPLAY_MENU) // 1of11 .. don't close the menu if (g_screen_to_display != DISPLAY_MENU) // 1of11 .. don't close the menu
g_request_display_screen = DISPLAY_MAIN; g_request_display_screen = DISPLAY_MAIN;
} }
#endif #endif
void CHANNEL_Next(const bool flag, const scan_state_dir_t scan_direction) void APP_channel_next(const bool flag, const scan_state_dir_t scan_direction)
{ {
RADIO_SelectVfos(); RADIO_select_vfos();
g_scan_next_channel = g_rx_vfo->channel_save; g_scan_next_channel = g_rx_vfo->channel_save;
g_scan_current_scan_list = SCAN_NEXT_CHAN_SCANLIST1; g_scan_current_scan_list = SCAN_NEXT_CHAN_SCANLIST1;
@ -2360,24 +2347,24 @@ void CHANNEL_Next(const bool flag, const scan_state_dir_t scan_direction)
{ // channel mode { // channel mode
if (flag) if (flag)
g_scan_restore_channel = g_scan_next_channel; g_scan_restore_channel = g_scan_next_channel;
USER_NextChannel(); APP_next_channel();
} }
else else
{ // frequency mode { // frequency mode
if (flag) if (flag)
g_scan_restore_frequency = g_rx_vfo->freq_config_rx.frequency; g_scan_restore_frequency = g_rx_vfo->freq_config_rx.frequency;
FREQ_NextChannel(); APP_next_freq();
} }
g_scan_pause_delay_in_10ms = scan_pause_delay_in_2_10ms; g_scan_pause_delay_in_10ms = scan_pause_delay_in_2_10ms;
g_scan_schedule_scan_listen = false; g_scan_schedule_scan_listen = false;
g_scan_pause_mode = false; g_scan_pause_mode = false;
g_rx_reception_mode = RX_MODE_NONE;
g_scan_keep_frequency = false; g_scan_keep_frequency = false;
g_rx_reception_mode = RX_MODE_NONE;
} }
static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const bool key_held) static void APP_process_key(const key_code_t Key, const bool key_pressed, const bool key_held)
{ {
bool flag = false; bool flag = false;
@ -2482,7 +2469,7 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
} }
// cancel user input // cancel user input
cancelUserInputModes(); APP_cancel_user_input_modes();
} }
if (key_pressed && g_screen_to_display == DISPLAY_MENU) if (key_pressed && g_screen_to_display == DISPLAY_MENU)
@ -2622,7 +2609,7 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
else else
if ((!key_held && key_pressed) || (g_alarm_state == ALARM_STATE_TX1750 && key_held && !key_pressed)) if ((!key_held && key_pressed) || (g_alarm_state == ALARM_STATE_TX1750 && key_held && !key_pressed))
{ {
ALARM_Off(); APP_alarm_off();
if (g_eeprom.repeater_tail_tone_elimination == 0) if (g_eeprom.repeater_tail_tone_elimination == 0)
FUNCTION_Select(FUNCTION_FOREGROUND); FUNCTION_Select(FUNCTION_FOREGROUND);
@ -2643,26 +2630,26 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
switch (g_screen_to_display) switch (g_screen_to_display)
{ {
case DISPLAY_MAIN: case DISPLAY_MAIN:
MAIN_ProcessKeys(Key, key_pressed, key_held); MAIN_process_key(Key, key_pressed, key_held);
break; break;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
case DISPLAY_FM: case DISPLAY_FM:
FM_ProcessKeys(Key, key_pressed, key_held); FM_process_key(Key, key_pressed, key_held);
break; break;
#endif #endif
case DISPLAY_MENU: case DISPLAY_MENU:
MENU_ProcessKeys(Key, key_pressed, key_held); MENU_process_key(Key, key_pressed, key_held);
break; break;
case DISPLAY_SEARCH: case DISPLAY_SEARCH:
SEARCH_ProcessKeys(Key, key_pressed, key_held); SEARCH_process_key(Key, key_pressed, key_held);
break; break;
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
case DISPLAY_AIRCOPY: case DISPLAY_AIRCOPY:
AIRCOPY_ProcessKey(Key, key_pressed, key_held); AIRCOPY_process_key(Key, key_pressed, key_held);
break; break;
#endif #endif
@ -2719,6 +2706,7 @@ Skip:
SETTINGS_SaveSettings(); SETTINGS_SaveSettings();
else else
g_flag_save_settings = 1; g_flag_save_settings = 1;
g_request_save_settings = false; g_request_save_settings = false;
g_update_status = true; g_update_status = true;
} }
@ -2730,6 +2718,7 @@ Skip:
SETTINGS_SaveFM(); SETTINGS_SaveFM();
else else
g_flag_save_fm = true; g_flag_save_fm = true;
g_request_save_fm = false; g_request_save_fm = false;
} }
#endif #endif
@ -2740,6 +2729,7 @@ Skip:
SETTINGS_SaveVfoIndices(); SETTINGS_SaveVfoIndices();
else else
g_flag_save_vfo = true; g_flag_save_vfo = true;
g_request_save_vfo = false; g_request_save_vfo = false;
} }
@ -2750,7 +2740,7 @@ Skip:
SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, g_request_save_channel); SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, g_request_save_channel);
if (g_screen_to_display != DISPLAY_SEARCH) if (g_screen_to_display != DISPLAY_SEARCH)
if (g_vfo_configure_mode == VFO_CONFIGURE_NONE) // 'if' is so as we don't wipe out previously setting this variable elsewhere if (g_vfo_configure_mode == VFO_CONFIGURE_NONE) // don't wipe previous variable setting
g_vfo_configure_mode = VFO_CONFIGURE; g_vfo_configure_mode = VFO_CONFIGURE;
} }
else else
@ -2766,13 +2756,19 @@ Skip:
if (g_vfo_configure_mode != VFO_CONFIGURE_NONE) if (g_vfo_configure_mode != VFO_CONFIGURE_NONE)
{ {
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf("audio gap\r\n");
#endif
if (g_flag_reset_vfos) if (g_flag_reset_vfos)
{ {
RADIO_ConfigureChannel(0, g_vfo_configure_mode); RADIO_ConfigureChannel(0, g_vfo_configure_mode);
RADIO_ConfigureChannel(1, g_vfo_configure_mode); RADIO_ConfigureChannel(1, g_vfo_configure_mode);
} }
else else
{
RADIO_ConfigureChannel(g_eeprom.tx_vfo, g_vfo_configure_mode); RADIO_ConfigureChannel(g_eeprom.tx_vfo, g_vfo_configure_mode);
}
if (g_request_display_screen == DISPLAY_INVALID) if (g_request_display_screen == DISPLAY_INVALID)
g_request_display_screen = DISPLAY_MAIN; g_request_display_screen = DISPLAY_MAIN;
@ -2784,13 +2780,13 @@ Skip:
if (g_flag_reconfigure_vfos) if (g_flag_reconfigure_vfos)
{ {
RADIO_SelectVfos(); RADIO_select_vfos();
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
RADIO_ConfigureNOAA(); RADIO_ConfigureNOAA();
#endif #endif
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
g_dtmf_auto_reset_time_500ms = 0; g_dtmf_auto_reset_time_500ms = 0;
g_dtmf_call_state = DTMF_CALL_STATE_NONE; g_dtmf_call_state = DTMF_CALL_STATE_NONE;
@ -2817,7 +2813,6 @@ Skip:
if (g_search_flag_start_scan) if (g_search_flag_start_scan)
{ {
g_search_flag_start_scan = false; g_search_flag_start_scan = false;
g_monitor_enabled = false; g_monitor_enabled = false;
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@ -2845,7 +2840,7 @@ Skip:
#endif #endif
GUI_SelectNextDisplay(g_request_display_screen); GUI_SelectNextDisplay(g_request_display_screen);
g_request_display_screen = DISPLAY_INVALID;
g_request_display_screen = DISPLAY_INVALID;
g_update_display = true; g_update_display = true;
} }

View File

@ -28,14 +28,14 @@ extern const uint8_t orig_lna;
extern const uint8_t orig_mixer; extern const uint8_t orig_mixer;
extern const uint8_t orig_pga; extern const uint8_t orig_pga;
void APP_EndTransmission(void); void APP_end_tx(void);
void SCAN_Stop(void); void APP_stop_scan(void);
void CHANNEL_Next(const bool flag, const scan_state_dir_t scan_direction); void APP_channel_next(const bool flag, const scan_state_dir_t scan_direction);
void APP_StartListening(function_type_t Function, const bool reset_am_fix); void APP_start_listening(function_type_t Function, const bool reset_am_fix);
uint32_t APP_SetFrequencyByStep(vfo_info_t *pInfo, int8_t Step); uint32_t APP_set_frequency_by_step(vfo_info_t *pInfo, int8_t Step);
void APP_Update(void); void APP_process(void);
void APP_TimeSlice10ms(void); void APP_time_slice_10ms(void);
void APP_TimeSlice500ms(void); void APP_time_slice_500ms(void);
#endif #endif

View File

@ -215,7 +215,7 @@ void DTMF_HandleRequest(void)
return; return;
} }
if (!g_rx_vfo->dtmf_decoding_enable && !g_setting_killed) if (!g_rx_vfo->dtmf_decoding_enable && !g_setting_radio_disabled)
{ // D-DCD is disabled or we're alive { // D-DCD is disabled or we're alive
DTMF_clear_RX(); DTMF_clear_RX();
return; return;
@ -235,7 +235,7 @@ void DTMF_HandleRequest(void)
if (g_eeprom.permit_remote_kill) if (g_eeprom.permit_remote_kill)
{ {
g_setting_killed = true; // oooerr ! g_setting_radio_disabled = true; // oooerr !
DTMF_clear_RX(); DTMF_clear_RX();
@ -274,7 +274,7 @@ void DTMF_HandleRequest(void)
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true)) if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
{ // shit, we're back ! { // shit, we're back !
g_setting_killed = false; g_setting_radio_disabled = false;
DTMF_clear_RX(); DTMF_clear_RX();
@ -328,8 +328,8 @@ void DTMF_HandleRequest(void)
} }
} }
if (g_setting_killed || g_dtmf_call_state != DTMF_CALL_STATE_NONE) if (g_setting_radio_disabled || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
{ // we've been killed or expecting a reply { // we've been disabled, or expecting a reply
return; return;
} }

View File

@ -605,7 +605,7 @@ Bail:
g_request_display_screen = DISPLAY_FM; g_request_display_screen = DISPLAY_FM;
} }
void FM_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held) void FM_process_key(key_code_t Key, bool key_pressed, bool key_held)
{ {
switch (Key) switch (Key)
{ {

View File

@ -50,7 +50,7 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag);
void FM_PlayAndUpdate(void); void FM_PlayAndUpdate(void);
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit); int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit);
void FM_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld); void FM_process_key(key_code_t Key, bool bKeyPressed, bool bKeyHeld);
void FM_Play(void); void FM_Play(void);
void FM_Start(void); void FM_Start(void);

View File

@ -109,7 +109,7 @@ void GENERIC_Key_PTT(bool key_pressed)
} }
else else
{ {
APP_EndTransmission(); APP_end_tx();
if (g_eeprom.repeater_tail_tone_elimination == 0) if (g_eeprom.repeater_tail_tone_elimination == 0)
FUNCTION_Select(FUNCTION_FOREGROUND); FUNCTION_Select(FUNCTION_FOREGROUND);
@ -153,7 +153,7 @@ void GENERIC_Key_PTT(bool key_pressed)
else else
if (g_scan_state_dir != SCAN_STATE_DIR_OFF) if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
{ // frequency/channel scanning . .stop { // frequency/channel scanning . .stop
SCAN_Stop(); APP_stop_scan();
} }
else else
if (g_css_scan_mode != CSS_SCAN_MODE_OFF) if (g_css_scan_mode != CSS_SCAN_MODE_OFF)

View File

@ -148,11 +148,7 @@ static void processFKeyFunction(const key_code_t Key)
break; break;
case KEY_3: // VFO/MR case KEY_3: // VFO/MR
#ifdef ENABLE_NOAA
if (g_eeprom.vfo_open && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save)) if (g_eeprom.vfo_open && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
#else
if (g_eeprom.vfo_open)
#endif
{ {
uint8_t Channel; uint8_t Channel;
@ -518,7 +514,7 @@ static void MAIN_Key_EXIT(bool key_pressed, bool key_held)
} }
else else
{ {
SCAN_Stop(); APP_stop_scan();
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP; g_another_voice_id = VOICE_ID_SCANNING_STOP;
@ -602,10 +598,10 @@ static void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
g_eeprom.vfo_info[vfo].channel_save = channel; g_eeprom.vfo_info[vfo].channel_save = channel;
g_eeprom.tx_vfo = vfo; g_eeprom.tx_vfo = vfo;
RADIO_SelectVfos(); RADIO_select_vfos();
RADIO_ApplyOffset(g_rx_vfo); RADIO_ApplyOffset(g_rx_vfo);
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo); RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
g_request_save_vfo = true; g_request_save_vfo = true;
@ -629,7 +625,9 @@ static void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
if (!key_pressed && !g_dtmf_input_mode) if (!key_pressed && !g_dtmf_input_mode)
{ // menu key released { // menu key released
const bool flag = (g_input_box_index == 0); const bool flag = (g_input_box_index == 0);
g_input_box_index = 0; g_input_box_index = 0;
if (flag) if (flag)
@ -654,13 +652,16 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
if (g_input_box_index > 0) if (g_input_box_index > 0)
{ // entering a frequency or DTMF string { // entering a frequency or DTMF string
if (!key_held && key_pressed) if (!key_held && key_pressed)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return; return;
} }
if (key_held && !g_fkey_pressed) if (key_held && !g_fkey_pressed)
{ // long press .. toggle scanning { // long press .. toggle scanning
if (!key_pressed) if (!key_pressed)
return; // released return; // released
@ -672,27 +673,19 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
if (key_pressed) if (key_pressed)
{ // just pressed { // just pressed
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL; g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_beep_to_play = BEEP_880HZ_40MS_OPTIONAL;
return; return;
} }
// just released
if (!g_fkey_pressed) if (!g_fkey_pressed)
{ // pressed without the F-key { // pressed without the F-key
#ifdef ENABLE_NOAA
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save)) if (g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
#else
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
#endif
{ // start entering a DTMF string { // start entering a DTMF string
memmove( memmove( g_dtmf_input_box, g_dtmf_string,
g_dtmf_input_box,
g_dtmf_string,
(sizeof(g_dtmf_input_box) <= (sizeof(g_dtmf_string) - 1)) ? sizeof(g_dtmf_input_box) : sizeof(g_dtmf_string) - 1); (sizeof(g_dtmf_input_box) <= (sizeof(g_dtmf_string) - 1)) ? sizeof(g_dtmf_input_box) : sizeof(g_dtmf_string) - 1);
g_dtmf_input_box_index = 0; g_dtmf_input_box_index = 0;
g_dtmf_input_mode = true; g_dtmf_input_mode = true;
@ -705,13 +698,11 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
{ // with the F-key { // with the F-key
g_fkey_pressed = false; g_fkey_pressed = false;
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save)) if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save))
{ {
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return; return;
} }
#endif
// scan the CTCSS/DCS code // scan the CTCSS/DCS code
g_search_flag_start_scan = true; g_search_flag_start_scan = true;
@ -720,7 +711,7 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF; g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
} }
// g_ptt_was_released = true; // why is this being set ? g_ptt_was_released = true;
g_update_status = true; g_update_status = true;
} }
@ -729,6 +720,16 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
{ {
uint8_t Channel = g_eeprom.screen_channel[g_eeprom.tx_vfo]; 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))
{
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");
#endif
}
if (key_held || !key_pressed) if (key_held || !key_pressed)
{ // long press { // long press
@ -759,20 +760,23 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
return; return;
} }
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL; // g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
} }
if (g_scan_state_dir == SCAN_STATE_DIR_OFF) if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
{ { // not scanning
#ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(Channel)) if (IS_NOT_NOAA_CHANNEL(Channel))
#endif
{ {
uint8_t Next; uint8_t Next;
if (IS_FREQ_CHANNEL(Channel)) if (IS_FREQ_CHANNEL(Channel))
{ // step/down in frequency { // step/down in frequency
const uint32_t frequency = APP_SetFrequencyByStep(g_tx_vfo, Direction);
const frequency_band_t old_band = FREQUENCY_GetBand(g_tx_vfo->freq_config_rx.frequency);
frequency_band_t new_band;
const uint32_t frequency = APP_set_frequency_by_step(g_tx_vfo, Direction);
if (RX_freq_check(frequency) < 0) if (RX_freq_check(frequency) < 0)
{ // frequency not allowed { // frequency not allowed
@ -780,9 +784,20 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
return; return;
} }
new_band = FREQUENCY_GetBand(frequency);
g_tx_vfo->freq_config_rx.frequency = frequency; g_tx_vfo->freq_config_rx.frequency = frequency;
if (new_band != old_band)
{
g_request_save_channel = 1; g_request_save_channel = 1;
}
else
{ // don't need to go through all the other stuff
BK4819_set_rf_frequency(frequency, true);
//BK4819_PickRXFilterPathBasedOnFrequency(frequency);
}
return; return;
} }
@ -815,21 +830,22 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
g_request_save_vfo = true; g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD; g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
return; return;
} }
// jump to the next channel // jump to the next channel
CHANNEL_Next(false, Direction); APP_channel_next(false, Direction);
g_scan_pause_delay_in_10ms = 1; g_scan_pause_delay_in_10ms = 1;
g_scan_schedule_scan_listen = false; g_scan_schedule_scan_listen = false;
// g_ptt_was_released = true; // why is this being set ? g_ptt_was_released = true;
} }
void MAIN_ProcessKeys(key_code_t key, bool key_pressed, bool key_held) void MAIN_process_key(key_code_t key, bool key_pressed, bool key_held)
{ {
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
UART_printf(" main 1 key %2u %u %u %u\r\n", key, key_pressed, key_held); // UART_printf(" main 1 key %2u %u %u %u\r\n", key, key_pressed, key_held);
#endif #endif
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
@ -850,7 +866,7 @@ void MAIN_ProcessKeys(key_code_t key, bool key_pressed, bool key_held)
{ {
DTMF_Append(Character); DTMF_Append(Character);
g_key_input_count_down = key_input_timeout_500ms; g_key_input_count_down = key_input_timeout_500ms;
//g_ptt_was_released = true; // why is this being set ? g_ptt_was_released = true;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL; g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_request_display_screen = DISPLAY_MAIN; g_request_display_screen = DISPLAY_MAIN;
} }

View File

@ -19,7 +19,7 @@
#include "driver/keyboard.h" #include "driver/keyboard.h"
void MAIN_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld); void MAIN_process_key(key_code_t Key, bool bKeyPressed, bool bKeyHeld);
#endif #endif

View File

@ -83,7 +83,7 @@ void MENU_StartCssScan(int8_t Direction)
g_menu_scroll_direction = Direction; g_menu_scroll_direction = Direction;
RADIO_SelectVfos(); RADIO_select_vfos();
MENU_SelectNextCode(); MENU_SelectNextCode();
@ -96,7 +96,7 @@ void MENU_StopCssScan(void)
g_css_scan_mode = CSS_SCAN_MODE_OFF; g_css_scan_mode = CSS_SCAN_MODE_OFF;
g_update_status = true; g_update_status = true;
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
} }
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax) int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
@ -253,8 +253,8 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
case MENU_NOAA_S: case MENU_NOAA_S:
#endif #endif
case MENU_350TX: case MENU_350TX:
case MENU_200TX: case MENU_174TX:
case MENU_500TX: case MENU_470TX:
case MENU_350EN: case MENU_350EN:
case MENU_SCREN: case MENU_SCREN:
case MENU_TX_EN: case MENU_TX_EN:
@ -559,12 +559,10 @@ void MENU_AcceptSetting(void)
break; break;
case MENU_XB: case MENU_XB:
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[0])) if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[0]))
return; return;
if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[1])) if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[1]))
return; return;
#endif
g_eeprom.cross_vfo_rx_tx = g_sub_menu_selection; g_eeprom.cross_vfo_rx_tx = g_sub_menu_selection;
g_flag_reconfigure_vfos = true; g_flag_reconfigure_vfos = true;
@ -795,12 +793,12 @@ void MENU_AcceptSetting(void)
g_setting_freq_lock = g_sub_menu_selection; g_setting_freq_lock = g_sub_menu_selection;
break; break;
case MENU_200TX: case MENU_174TX:
g_setting_200_tx_enable = g_sub_menu_selection; g_setting_174_tx_enable = g_sub_menu_selection;
break; break;
case MENU_500TX: case MENU_470TX:
g_setting_500_tx_enable = g_sub_menu_selection; g_setting_470_tx_enable = g_sub_menu_selection;
break; break;
case MENU_350EN: case MENU_350EN:
@ -883,7 +881,7 @@ void MENU_SelectNextCode(void)
g_selected_code = g_sub_menu_selection - 1; g_selected_code = g_sub_menu_selection - 1;
} }
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
g_scan_pause_delay_in_10ms = (g_selected_code_type == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms; g_scan_pause_delay_in_10ms = (g_selected_code_type == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
@ -1229,12 +1227,12 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_setting_freq_lock; g_sub_menu_selection = g_setting_freq_lock;
break; break;
case MENU_200TX: case MENU_174TX:
g_sub_menu_selection = g_setting_200_tx_enable; g_sub_menu_selection = g_setting_174_tx_enable;
break; break;
case MENU_500TX: case MENU_470TX:
g_sub_menu_selection = g_setting_500_tx_enable; g_sub_menu_selection = g_setting_470_tx_enable;
break; break;
case MENU_350EN: case MENU_350EN:
@ -1663,13 +1661,9 @@ static void MENU_Key_STAR(const bool key_pressed, const bool key_held)
return; return;
} }
RADIO_SelectVfos(); RADIO_select_vfos();
#ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_rx_vfo->am_mode == 0) if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_rx_vfo->am_mode == 0)
#else
if (g_rx_vfo->am_mode == 0)
#endif
{ {
if (g_menu_cursor == MENU_R_CTCS || g_menu_cursor == MENU_R_DCS) if (g_menu_cursor == MENU_R_CTCS || g_menu_cursor == MENU_R_DCS)
{ // scan CTCSS or DCS to find the tone/code of the incoming signal { // scan CTCSS or DCS to find the tone/code of the incoming signal
@ -1818,7 +1812,7 @@ static void MENU_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Direction)
g_request_display_screen = DISPLAY_MENU; g_request_display_screen = DISPLAY_MENU;
} }
void MENU_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held) void MENU_process_key(key_code_t Key, bool key_pressed, bool key_held)
{ {
switch (Key) switch (Key)
{ {

View File

@ -30,7 +30,7 @@ void MENU_ShowCurrentSetting(void);
void MENU_StartCssScan(int8_t Direction); void MENU_StartCssScan(int8_t Direction);
void MENU_StopCssScan(void); void MENU_StopCssScan(void);
void MENU_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held); void MENU_process_key(key_code_t Key, bool key_pressed, bool key_held);
#endif #endif

View File

@ -423,7 +423,7 @@ static void SEARCH_Key_UP_DOWN(bool key_pressed, bool pKeyHeld, int8_t Direction
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
} }
void SEARCH_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held) void SEARCH_process_key(key_code_t Key, bool key_pressed, bool key_held)
{ {
switch (Key) switch (Key)
{ {
@ -471,7 +471,7 @@ void SEARCH_Start(void)
BK4819_StopScan(); BK4819_StopScan();
RADIO_SelectVfos(); RADIO_select_vfos();
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save)) if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save))
@ -486,7 +486,7 @@ void SEARCH_Start(void)
g_rx_vfo->step_setting = BackupStep; g_rx_vfo->step_setting = BackupStep;
g_rx_vfo->step_freq = BackupStepFreq; g_rx_vfo->step_freq = BackupStepFreq;
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
g_is_noaa_mode = false; g_is_noaa_mode = false;

View File

@ -55,7 +55,7 @@ extern uint8_t g_search_delay_10ms;
extern uint8_t g_search_hit_count; extern uint8_t g_search_hit_count;
extern bool g_search_use_css_result; extern bool g_search_use_css_result;
void SEARCH_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held); void SEARCH_process_key(key_code_t Key, bool key_pressed, bool key_held);
void SEARCH_Start(void); void SEARCH_Start(void);
#endif #endif

View File

@ -202,7 +202,7 @@ static void SetModulation(ModulationType type)
static void SetF(uint32_t f) { static void SetF(uint32_t f) {
fMeasure = f; fMeasure = f;
BK4819_SetFrequency(fMeasure); BK4819_set_rf_frequency(fMeasure);
BK4819_PickRXFilterPathBasedOnFrequency(fMeasure); BK4819_PickRXFilterPathBasedOnFrequency(fMeasure);
uint16_t reg = BK4819_ReadRegister(BK4819_REG_30); uint16_t reg = BK4819_ReadRegister(BK4819_REG_30);
BK4819_WriteRegister(BK4819_REG_30, 0); BK4819_WriteRegister(BK4819_REG_30, 0);
@ -211,7 +211,7 @@ static void SetF(uint32_t f) {
static void SetTxF(uint32_t f) { static void SetTxF(uint32_t f) {
fTx = f; fTx = f;
BK4819_SetFrequency(f); BK4819_set_rf_frequency(f);
BK4819_PickRXFilterPathBasedOnFrequency(f); BK4819_PickRXFilterPathBasedOnFrequency(f);
uint16_t reg = BK4819_ReadRegister(BK4819_REG_30); uint16_t reg = BK4819_ReadRegister(BK4819_REG_30);
BK4819_WriteRegister(BK4819_REG_30, 0); BK4819_WriteRegister(BK4819_REG_30, 0);

View File

@ -729,9 +729,9 @@ void BOARD_EEPROM_load(void)
g_setting_freq_lock = (Data[0] < 6) ? Data[0] : FREQ_LOCK_NORMAL; g_setting_freq_lock = (Data[0] < 6) ? Data[0] : FREQ_LOCK_NORMAL;
#endif #endif
g_setting_350_tx_enable = (Data[1] < 2) ? Data[1] : false; // was true g_setting_350_tx_enable = (Data[1] < 2) ? Data[1] : false; // was true
g_setting_killed = (Data[2] < 2) ? Data[2] : false; g_setting_radio_disabled = (Data[2] < 2) ? Data[2] : false;
g_setting_200_tx_enable = (Data[3] < 2) ? Data[3] : false; g_setting_174_tx_enable = (Data[3] < 2) ? Data[3] : false;
g_setting_500_tx_enable = (Data[4] < 2) ? Data[4] : false; g_setting_470_tx_enable = (Data[4] < 2) ? Data[4] : false;
g_setting_350_enable = (Data[5] < 2) ? Data[5] : true; g_setting_350_enable = (Data[5] < 2) ? Data[5] : true;
g_setting_scramble_enable = (Data[6] < 2) ? Data[6] : true; g_setting_scramble_enable = (Data[6] < 2) ? Data[6] : true;
g_setting_tx_enable = (Data[7] & (1u << 0)) ? true : false; g_setting_tx_enable = (Data[7] & (1u << 0)) ? true : false;

View File

@ -704,10 +704,30 @@ void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency)
BK4819_WriteRegister(BK4819_REG_36, ((uint16_t)bias << 8) | ((uint16_t)enable << 7) | ((uint16_t)gain << 0)); BK4819_WriteRegister(BK4819_REG_36, ((uint16_t)bias << 8) | ((uint16_t)enable << 7) | ((uint16_t)gain << 0));
} }
void BK4819_SetFrequency(uint32_t Frequency) void BK4819_set_rf_frequency(const uint32_t frequency, const bool trigger_update)
{ {
BK4819_WriteRegister(BK4819_REG_38, (Frequency >> 0) & 0xFFFF); BK4819_WriteRegister(BK4819_REG_38, (frequency >> 0) & 0xFFFF);
BK4819_WriteRegister(BK4819_REG_39, (Frequency >> 16) & 0xFFFF); BK4819_WriteRegister(BK4819_REG_39, (frequency >> 16) & 0xFFFF);
if (trigger_update)
{
// <15> 0 VCO Calibration 1 = enable 0 = disable
// <14> ???
// <13:10> 0 RX Link 15 = enable 0 = disable
// <9> 0 AF DAC 1 = enable 0 = disable
// <8> 0 DISC Mode 1 = enable 0 = disable
// <7:4> 0 PLL/VCO 15 = enable 0 = disable
// <3> 0 PA Gain 1 = enable 0 = disable
// <2> 0 MIC ADC 1 = enable 0 = disable
// <1> 0 TX DSP 1 = enable 0 = disable
// <0> 0 RX DSP 1 = enable 0 = disable
//
// trigger a PLL/VCO update
//
const uint16_t reg = BK4819_ReadRegister(BK4819_REG_30);
BK4819_WriteRegister(BK4819_REG_30, reg & ~(1u << 15) & (15u << 4));
BK4819_WriteRegister(BK4819_REG_30, reg);
}
} }
void BK4819_SetupSquelch( void BK4819_SetupSquelch(
@ -1583,7 +1603,7 @@ void BK4819_EnableFrequencyScan(void)
void BK4819_SetScanFrequency(uint32_t Frequency) void BK4819_SetScanFrequency(uint32_t Frequency)
{ {
BK4819_SetFrequency(Frequency); BK4819_set_rf_frequency(Frequency, false);
// REG_51 // REG_51
// //

View File

@ -77,7 +77,7 @@ void BK4819_SetTailDetection(const uint32_t freq_10Hz);
void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold); void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold);
void BK4819_SetFilterBandwidth(const BK4819_filter_bandwidth_t Bandwidth, const bool weak_no_different); void BK4819_SetFilterBandwidth(const BK4819_filter_bandwidth_t Bandwidth, const bool weak_no_different);
void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency); void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency);
void BK4819_SetFrequency(uint32_t Frequency); void BK4819_set_rf_frequency(const uint32_t frequency, const bool trigger_update);
void BK4819_SetupSquelch( void BK4819_SetupSquelch(
uint8_t SquelchOpenRSSIThresh, uint8_t SquelchOpenRSSIThresh,
uint8_t SquelchCloseRSSIThresh, uint8_t SquelchCloseRSSIThresh,

Binary file not shown.

Binary file not shown.

View File

@ -152,7 +152,7 @@ int TX_freq_check(const uint32_t Frequency)
if (Frequency >= 13600000 && Frequency < 17400000) if (Frequency >= 13600000 && Frequency < 17400000)
return 0; return 0;
if (Frequency >= 17400000 && Frequency < 35000000) if (Frequency >= 17400000 && Frequency < 35000000)
if (g_setting_200_tx_enable) if (g_setting_174_tx_enable)
return 0; return 0;
if (Frequency >= 35000000 && Frequency < 40000000) if (Frequency >= 35000000 && Frequency < 40000000)
if (g_setting_350_tx_enable && g_setting_350_enable) if (g_setting_350_tx_enable && g_setting_350_enable)
@ -160,7 +160,7 @@ int TX_freq_check(const uint32_t Frequency)
if (Frequency >= 40000000 && Frequency < 47000000) if (Frequency >= 40000000 && Frequency < 47000000)
return 0; return 0;
if (Frequency >= 47000000 && Frequency <= 60000000) if (Frequency >= 47000000 && Frequency <= 60000000)
if (g_setting_500_tx_enable) if (g_setting_470_tx_enable)
return 0; return 0;
break; break;

View File

@ -43,18 +43,14 @@ function_type_t g_current_function;
void FUNCTION_Init(void) void FUNCTION_Init(void)
{ {
#ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save)) if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
#endif
{ {
g_current_code_type = g_selected_code_type; g_current_code_type = g_selected_code_type;
if (g_css_scan_mode == CSS_SCAN_MODE_OFF) if (g_css_scan_mode == CSS_SCAN_MODE_OFF)
g_current_code_type = g_rx_vfo->am_mode ? CODE_TYPE_NONE : g_rx_vfo->p_rx->code_type; g_current_code_type = g_rx_vfo->am_mode ? CODE_TYPE_NONE : g_rx_vfo->p_rx->code_type;
} }
#ifdef ENABLE_NOAA
else else
g_current_code_type = CODE_TYPE_CONTINUOUS_TONE; g_current_code_type = CODE_TYPE_CONTINUOUS_TONE;
#endif
DTMF_clear_RX(); DTMF_clear_RX();

10
main.c
View File

@ -95,9 +95,9 @@ void Main(void)
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
RADIO_SelectVfos(); RADIO_select_vfos();
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
for (i = 0; i < ARRAY_SIZE(g_battery_voltages); i++) for (i = 0; i < ARRAY_SIZE(g_battery_voltages); i++)
BOARD_ADC_GetBatteryInfo(&g_battery_voltages[i], &g_usb_current); BOARD_ADC_GetBatteryInfo(&g_battery_voltages[i], &g_usb_current);
@ -216,17 +216,17 @@ void Main(void)
while (1) while (1)
{ {
APP_Update(); APP_process();
if (g_next_time_slice) if (g_next_time_slice)
{ {
APP_TimeSlice10ms(); APP_time_slice_10ms();
g_next_time_slice = false; g_next_time_slice = false;
} }
if (g_next_time_slice_500ms) if (g_next_time_slice_500ms)
{ {
APP_TimeSlice500ms(); APP_time_slice_500ms();
g_next_time_slice_500ms = false; g_next_time_slice_500ms = false;
} }
} }

10
misc.c
View File

@ -46,7 +46,7 @@ const uint8_t key_lock_timeout_500ms = 30000 / 500; // 30 sec
const uint8_t key_debounce_10ms = 30 / 10; // 30ms const uint8_t key_debounce_10ms = 30 / 10; // 30ms
const uint8_t key_long_press_10ms = 300 / 10; // 300ms const uint8_t key_long_press_10ms = 300 / 10; // 300ms
const uint8_t key_repeat_10ms = 80 / 10; // 80ms const uint8_t key_repeat_10ms = 50 / 10; // 50ms
const uint16_t scan_freq_css_timeout_10ms = 10000 / 10; // 10 seconds const uint16_t scan_freq_css_timeout_10ms = 10000 / 10; // 10 seconds
const uint8_t scan_freq_css_delay_10ms = 210 / 10; // 210ms .. don't reduce this const uint8_t scan_freq_css_delay_10ms = 210 / 10; // 210ms .. don't reduce this
@ -89,9 +89,9 @@ const uint32_t g_default_aes_key[4] = {0x4AA5CC60, 0x0312C
const uint8_t g_mic_gain_dB_2[5] = {3, 8, 16, 24, 31}; const uint8_t g_mic_gain_dB_2[5] = {3, 8, 16, 24, 31};
bool g_setting_350_tx_enable; bool g_setting_350_tx_enable;
bool g_setting_killed; bool g_setting_radio_disabled;
bool g_setting_200_tx_enable; bool g_setting_174_tx_enable;
bool g_setting_500_tx_enable; bool g_setting_470_tx_enable;
bool g_setting_350_enable; bool g_setting_350_enable;
bool g_setting_tx_enable; bool g_setting_tx_enable;
uint8_t g_setting_freq_lock; uint8_t g_setting_freq_lock;
@ -140,7 +140,6 @@ volatile bool g_schedule_dual_watch = true;
volatile uint16_t g_dual_watch_count_down_10ms; volatile uint16_t g_dual_watch_count_down_10ms;
volatile bool g_dual_watch_count_down_expired = true; volatile bool g_dual_watch_count_down_expired = true;
bool g_dual_watch_active;
volatile uint8_t g_serial_config_count_down_500ms; volatile uint8_t g_serial_config_count_down_500ms;
@ -213,6 +212,7 @@ volatile uint16_t g_flash_light_blink_counter;
bool g_flag_end_tx; bool g_flag_end_tx;
uint16_t g_low_batteryCountdown; uint16_t g_low_batteryCountdown;
reception_mode_t g_rx_reception_mode; reception_mode_t g_rx_reception_mode;
uint8_t g_scan_next_channel; uint8_t g_scan_next_channel;

7
misc.h
View File

@ -170,9 +170,9 @@ extern const uint16_t scan_pause_delay_in_7_10ms;
extern const uint8_t g_mic_gain_dB_2[5]; extern const uint8_t g_mic_gain_dB_2[5];
extern bool g_setting_350_tx_enable; extern bool g_setting_350_tx_enable;
extern bool g_setting_killed; extern bool g_setting_radio_disabled;
extern bool g_setting_200_tx_enable; extern bool g_setting_174_tx_enable;
extern bool g_setting_500_tx_enable; extern bool g_setting_470_tx_enable;
extern bool g_setting_350_enable; extern bool g_setting_350_enable;
extern bool g_setting_tx_enable; extern bool g_setting_tx_enable;
extern uint8_t g_setting_freq_lock; extern uint8_t g_setting_freq_lock;
@ -223,7 +223,6 @@ extern volatile bool g_schedule_dual_watch;
extern volatile uint16_t g_dual_watch_count_down_10ms; extern volatile uint16_t g_dual_watch_count_down_10ms;
extern volatile bool g_dual_watch_count_down_expired; extern volatile bool g_dual_watch_count_down_expired;
extern bool g_dual_watch_active;
extern volatile uint8_t g_serial_config_count_down_500ms; extern volatile uint8_t g_serial_config_count_down_500ms;

101
radio.c
View File

@ -165,12 +165,9 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Channel >= NOAA_CHANNEL_FIRST) if (Channel >= NOAA_CHANNEL_FIRST)
{ {
RADIO_InitInfo(pRadio, g_eeprom.screen_channel[VFO], NOAA_FREQUENCY_TABLE[Channel - NOAA_CHANNEL_FIRST]); RADIO_InitInfo(pRadio, g_eeprom.screen_channel[VFO], NOAA_FREQUENCY_TABLE[Channel - NOAA_CHANNEL_FIRST]);
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF)
return; return;
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF; g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
g_update_status = true; g_update_status = true;
return; return;
} }
@ -588,7 +585,7 @@ static void RADIO_SelectCurrentVfo(void)
g_current_vfo = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_rx_vfo : &g_eeprom.vfo_info[g_eeprom.tx_vfo]; g_current_vfo = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_rx_vfo : &g_eeprom.vfo_info[g_eeprom.tx_vfo];
} }
void RADIO_SelectVfos(void) void RADIO_select_vfos(void)
{ {
g_eeprom.tx_vfo = get_TX_VFO(); g_eeprom.tx_vfo = get_TX_VFO();
g_eeprom.rx_vfo = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.tx_vfo : (g_eeprom.tx_vfo + 1) & 1u; g_eeprom.rx_vfo = (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_OFF) ? g_eeprom.tx_vfo : (g_eeprom.tx_vfo + 1) & 1u;
@ -599,10 +596,10 @@ void RADIO_SelectVfos(void)
RADIO_SelectCurrentVfo(); RADIO_SelectCurrentVfo();
} }
void RADIO_SetupRegisters(bool bSwitchToFunction0) void RADIO_setup_registers(bool switch_to_function_0)
{ {
BK4819_filter_bandwidth_t Bandwidth = g_rx_vfo->channel_bandwidth; BK4819_filter_bandwidth_t Bandwidth = g_rx_vfo->channel_bandwidth;
uint16_t InterruptMask; uint16_t interrupt_mask;
uint32_t Frequency; uint32_t Frequency;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
@ -636,7 +633,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1, false); // ??? BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1, false); // ???
while (1) while (1)
{ // wait for the interrupt to clear ??? { // wait for the interrupt to clear ?
const uint16_t status_bits = BK4819_ReadRegister(BK4819_REG_0C); const uint16_t status_bits = BK4819_ReadRegister(BK4819_REG_0C);
if ((status_bits & (1u << 0)) == 0) if ((status_bits & (1u << 0)) == 0)
break; break;
@ -644,20 +641,18 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
SYSTEM_DelayMs(1); SYSTEM_DelayMs(1);
} }
BK4819_WriteRegister(BK4819_REG_3F, 0); BK4819_WriteRegister(BK4819_REG_3F, 0); // disable interrupts
// mic gain 0.5dB/step 0 to 31 // mic gain 0.5dB/step 0 to 31
BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (g_eeprom.mic_sensitivity_tuning & 0x1f)); BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (g_eeprom.mic_sensitivity_tuning & 0x1f));
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save) || !g_is_noaa_mode) if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_is_noaa_mode)
Frequency = g_rx_vfo->p_rx->frequency;
else
Frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel]; Frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
#else else
Frequency = g_rx_vfo->p_rx->frequency;
#endif #endif
BK4819_SetFrequency(Frequency); Frequency = g_rx_vfo->p_rx->frequency;
BK4819_set_rf_frequency(Frequency, false);
BK4819_SetupSquelch( BK4819_SetupSquelch(
g_rx_vfo->squelch_open_rssi_thresh, g_rx_vfo->squelch_close_rssi_thresh, g_rx_vfo->squelch_open_rssi_thresh, g_rx_vfo->squelch_close_rssi_thresh,
@ -672,16 +667,15 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
// AF RX Gain and DAC // AF RX Gain and DAC
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8); // 1011 00 111010 1000 BK4819_WriteRegister(BK4819_REG_48, 0xB3A8); // 1011 00 111010 1000
InterruptMask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST; interrupt_mask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST;
#ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save)) if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
#endif
{ {
if (g_rx_vfo->am_mode == 0) if (g_rx_vfo->am_mode == 0)
{ // FM { // FM
uint8_t code_type = g_selected_code_type; uint8_t code_type = g_selected_code_type;
uint8_t Code = g_selected_code; uint8_t Code = g_selected_code;
if (g_css_scan_mode == CSS_SCAN_MODE_OFF) if (g_css_scan_mode == CSS_SCAN_MODE_OFF)
{ {
code_type = g_rx_vfo->p_rx->code_type; code_type = g_rx_vfo->p_rx->code_type;
@ -700,7 +694,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
// BK4819_SetTailDetection(670); // 67Hz // BK4819_SetTailDetection(670); // 67Hz
//#endif //#endif
InterruptMask = BK4819_REG_3F_CxCSS_TAIL | BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST; interrupt_mask = BK4819_REG_3F_CxCSS_TAIL | BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST;
break; break;
case CODE_TYPE_CONTINUOUS_TONE: case CODE_TYPE_CONTINUOUS_TONE:
@ -712,24 +706,24 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
// BK4819_SetTailDetection(CTCSS_OPTIONS[Code]); // BK4819_SetTailDetection(CTCSS_OPTIONS[Code]);
//#endif //#endif
InterruptMask = 0 interrupt_mask =
| BK4819_REG_3F_CxCSS_TAIL BK4819_REG_3F_CxCSS_TAIL |
| BK4819_REG_3F_CTCSS_FOUND BK4819_REG_3F_CTCSS_FOUND |
| BK4819_REG_3F_CTCSS_LOST BK4819_REG_3F_CTCSS_LOST |
| BK4819_REG_3F_SQUELCH_FOUND BK4819_REG_3F_SQUELCH_FOUND |
| BK4819_REG_3F_SQUELCH_LOST; BK4819_REG_3F_SQUELCH_LOST;
break; break;
case CODE_TYPE_DIGITAL: case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL: case CODE_TYPE_REVERSE_DIGITAL:
BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(code_type, Code)); BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(code_type, Code));
InterruptMask = 0 interrupt_mask =
| BK4819_REG_3F_CxCSS_TAIL BK4819_REG_3F_CxCSS_TAIL |
| BK4819_REG_3F_CDCSS_FOUND BK4819_REG_3F_CDCSS_FOUND |
| BK4819_REG_3F_CDCSS_LOST BK4819_REG_3F_CDCSS_LOST |
| BK4819_REG_3F_SQUELCH_FOUND BK4819_REG_3F_SQUELCH_FOUND |
| BK4819_REG_3F_SQUELCH_LOST; BK4819_REG_3F_SQUELCH_LOST;
break; break;
} }
@ -743,31 +737,26 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
else else
{ {
BK4819_SetCTCSSFrequency(2625); BK4819_SetCTCSSFrequency(2625);
InterruptMask = 0 interrupt_mask =
| BK4819_REG_3F_CTCSS_FOUND BK4819_REG_3F_CTCSS_FOUND |
| BK4819_REG_3F_CTCSS_LOST BK4819_REG_3F_CTCSS_LOST |
| BK4819_REG_3F_SQUELCH_FOUND BK4819_REG_3F_SQUELCH_FOUND |
| BK4819_REG_3F_SQUELCH_LOST; BK4819_REG_3F_SQUELCH_LOST;
} }
#endif #endif
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
#ifdef ENABLE_NOAA if (
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (g_eeprom.vox_switch && !g_fm_radio_mode && IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) && g_current_vfo->am_mode == 0) !g_fm_radio_mode &&
#else
if (g_eeprom.vox_switch && IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) && g_current_vfo->am_mode == 0)
#endif
#else
#ifdef ENABLE_FMRADIO
if (g_eeprom.vox_switch && !g_fm_radio_mode && g_current_vfo->am_mode == 0)
#else
if (g_eeprom.vox_switch && g_current_vfo->am_mode == 0)
#endif
#endif #endif
g_eeprom.vox_switch &&
!g_fm_radio_mode &&
IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) &&
g_current_vfo->am_mode == 0)
{ {
BK4819_EnableVox(g_eeprom.vox1_threshold, g_eeprom.vox0_threshold); BK4819_EnableVox(g_eeprom.vox1_threshold, g_eeprom.vox0_threshold);
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST; interrupt_mask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
} }
else else
#endif #endif
@ -777,21 +766,21 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_SetCompander((g_rx_vfo->am_mode == 0 && g_rx_vfo->compander >= 2) ? g_rx_vfo->compander : 0); BK4819_SetCompander((g_rx_vfo->am_mode == 0 && g_rx_vfo->compander >= 2) ? g_rx_vfo->compander : 0);
#if 0 #if 0
if (!g_rx_vfo->dtmf_decoding_enable && !g_setting_killed) if (!g_rx_vfo->dtmf_decoding_enable && !g_setting_radio_disabled)
{ {
BK4819_DisableDTMF(); BK4819_DisableDTMF();
} }
else else
{ {
BK4819_EnableDTMF(); BK4819_EnableDTMF();
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND; interrupt_mask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
} }
#else #else
if (g_current_function != FUNCTION_TRANSMIT) if (g_current_function != FUNCTION_TRANSMIT)
{ {
BK4819_DisableDTMF(); BK4819_DisableDTMF();
BK4819_EnableDTMF(); BK4819_EnableDTMF();
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND; interrupt_mask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
} }
else else
{ {
@ -800,11 +789,11 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
#endif #endif
// enable/disable BK4819 selected interrupts // enable/disable BK4819 selected interrupts
BK4819_WriteRegister(BK4819_REG_3F, InterruptMask); BK4819_WriteRegister(BK4819_REG_3F, interrupt_mask);
FUNCTION_Init(); FUNCTION_Init();
if (bSwitchToFunction0) if (switch_to_function_0)
FUNCTION_Select(FUNCTION_FOREGROUND); FUNCTION_Select(FUNCTION_FOREGROUND);
} }
@ -883,7 +872,7 @@ void RADIO_enableTX(const bool fsk_tx)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
BK4819_SetFrequency(g_current_vfo->p_tx->frequency); BK4819_set_rf_frequency(g_current_vfo->p_tx->frequency, false);
BK4819_SetCompander((!fsk_tx && g_rx_vfo->am_mode == 0 && (g_rx_vfo->compander == 1 || g_rx_vfo->compander >= 3)) ? g_rx_vfo->compander : 0); BK4819_SetCompander((!fsk_tx && g_rx_vfo->am_mode == 0 && (g_rx_vfo->compander == 1 || g_rx_vfo->compander >= 3)) ? g_rx_vfo->compander : 0);
BK4819_PrepareTransmit(); BK4819_PrepareTransmit();
BK4819_PickRXFilterPathBasedOnFrequency(g_current_vfo->p_tx->frequency); BK4819_PickRXFilterPathBasedOnFrequency(g_current_vfo->p_tx->frequency);
@ -979,8 +968,6 @@ void RADIO_PrepareTX(void)
g_current_vfo = g_rx_vfo; g_current_vfo = g_rx_vfo;
#endif #endif
// let the user see that DW is not active '><' symbol
g_dual_watch_active = false;
g_update_status = true; g_update_status = true;
} }
@ -1060,8 +1047,8 @@ void RADIO_PrepareTX(void)
else else
g_tx_timer_count_down_500ms = 120 * 15; // 15 minutes g_tx_timer_count_down_500ms = 120 * 15; // 15 minutes
} }
g_tx_timeout_reached = false;
g_tx_timeout_reached = false;
g_flag_end_tx = false; g_flag_end_tx = false;
g_rtte_count_down = 0; g_rtte_count_down = 0;
g_dtmf_reply_state = DTMF_REPLY_NONE; g_dtmf_reply_state = DTMF_REPLY_NONE;
@ -1095,7 +1082,7 @@ void RADIO_PrepareCssTX(void)
SYSTEM_DelayMs(200); SYSTEM_DelayMs(200);
RADIO_EnableCxCSS(); RADIO_EnableCxCSS();
RADIO_SetupRegisters(true); RADIO_setup_registers(true);
} }
void RADIO_SendEndOfTransmission(void) void RADIO_SendEndOfTransmission(void)

View File

@ -132,8 +132,8 @@ void RADIO_InitInfo(vfo_info_t *pInfo, const uint8_t ChannelSave, const uint
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure); void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo); void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo);
void RADIO_ApplyOffset(vfo_info_t *pInfo); void RADIO_ApplyOffset(vfo_info_t *pInfo);
void RADIO_SelectVfos(void); void RADIO_select_vfos(void);
void RADIO_SetupRegisters(bool bSwitchToFunction0); void RADIO_setup_registers(bool switch_to_function_0);
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
void RADIO_ConfigureNOAA(void); void RADIO_ConfigureNOAA(void);
#endif #endif

View File

@ -310,9 +310,9 @@ void SETTINGS_SaveSettings(void)
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
State[0] = g_setting_freq_lock; State[0] = g_setting_freq_lock;
State[1] = g_setting_350_tx_enable; State[1] = g_setting_350_tx_enable;
State[2] = g_setting_killed; State[2] = g_setting_radio_disabled;
State[3] = g_setting_200_tx_enable; State[3] = g_setting_174_tx_enable;
State[4] = g_setting_500_tx_enable; State[4] = g_setting_470_tx_enable;
State[5] = g_setting_350_enable; State[5] = g_setting_350_enable;
State[6] = g_setting_scramble_enable; State[6] = g_setting_scramble_enable;
if (!g_setting_tx_enable) State[7] &= ~(1u << 0); if (!g_setting_tx_enable) State[7] &= ~(1u << 0);
@ -335,10 +335,8 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const vfo_info_t *pVFO,
uint16_t OffsetVFO = OffsetMR; uint16_t OffsetVFO = OffsetMR;
uint8_t State[8]; uint8_t State[8];
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(Channel)) if (IS_NOAA_CHANNEL(Channel))
return; return;
#endif
if (IS_FREQ_CHANNEL(Channel)) if (IS_FREQ_CHANNEL(Channel))
{ // it's a VFO { // it's a VFO
@ -374,11 +372,11 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const vfo_info_t *pVFO,
SETTINGS_UpdateChannel(Channel, pVFO, true); SETTINGS_UpdateChannel(Channel, pVFO, true);
if (Channel > USER_CHANNEL_LAST) if (Channel > USER_CHANNEL_LAST)
return; // it's not a user channel return; // it's not a user memory channel
#ifndef ENABLE_KEEP_MEM_NAME #ifndef ENABLE_KEEP_MEM_NAME
// clear/reset the channel name // clear/reset the channel name
memset(&State, 0x00, sizeof(State)); memset(&State, 0, sizeof(State));
EEPROM_WriteBuffer(0x0F50 + OffsetMR, State); EEPROM_WriteBuffer(0x0F50 + OffsetMR, State);
EEPROM_WriteBuffer(0x0F58 + OffsetMR, State); EEPROM_WriteBuffer(0x0F58 + OffsetMR, State);
#else #else
@ -386,7 +384,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const vfo_info_t *pVFO,
{ // save the channel name { // save the channel name
memmove(State, pVFO->name + 0, 8); memmove(State, pVFO->name + 0, 8);
EEPROM_WriteBuffer(0x0F50 + OffsetMR, State); EEPROM_WriteBuffer(0x0F50 + OffsetMR, State);
memset(State, 0x00, sizeof(State)); memset(State, 0, sizeof(State));
memmove(State, pVFO->name + 8, 2); memmove(State, pVFO->name + 8, 2);
EEPROM_WriteBuffer(0x0F58 + OffsetMR, State); EEPROM_WriteBuffer(0x0F58 + OffsetMR, State);
} }
@ -399,10 +397,8 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const vfo_info_t *pVFO, bool keep)
uint8_t Attributes = 0xFF; // default attributes uint8_t Attributes = 0xFF; // default attributes
uint16_t Offset = 0x0D60 + (Channel & ~7u); uint16_t Offset = 0x0D60 + (Channel & ~7u);
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(Channel)) if (IS_NOAA_CHANNEL(Channel))
return; return;
#endif
Attributes &= (uint8_t)(~USER_CH_COMPAND); // default to '0' = compander disabled Attributes &= (uint8_t)(~USER_CH_COMPAND); // default to '0' = compander disabled
@ -412,7 +408,7 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const vfo_info_t *pVFO, bool keep)
{ {
Attributes = (pVFO->scanlist_1_participation << 7) | (pVFO->scanlist_2_participation << 6) | (pVFO->compander << 4) | (pVFO->band << 0); Attributes = (pVFO->scanlist_1_participation << 7) | (pVFO->scanlist_2_participation << 6) | (pVFO->compander << 4) | (pVFO->band << 0);
if (State[Channel & 7u] == Attributes) if (State[Channel & 7u] == Attributes)
return; // no change in the attributes return; // no change in the attributes .. don't place wear on the eeprom
} }
State[Channel & 7u] = Attributes; State[Channel & 7u] = Attributes;
@ -423,13 +419,12 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const vfo_info_t *pVFO, bool keep)
// #ifndef ENABLE_KEEP_MEM_NAME // #ifndef ENABLE_KEEP_MEM_NAME
if (Channel <= USER_CHANNEL_LAST) if (Channel <= USER_CHANNEL_LAST)
{ // it's a memory channel { // user memory channel
const uint16_t OffsetMR = Channel * 16; const uint16_t OffsetMR = Channel * 16;
if (!keep) if (!keep)
{ // clear/reset the channel name { // clear/reset the channel name
//memset(&State, 0xFF, sizeof(State)); memset(&State, 0, sizeof(State));
memset(&State, 0x00, sizeof(State)); // follow the QS way
EEPROM_WriteBuffer(0x0F50 + OffsetMR, State); EEPROM_WriteBuffer(0x0F50 + OffsetMR, State);
EEPROM_WriteBuffer(0x0F58 + OffsetMR, State); EEPROM_WriteBuffer(0x0F58 + OffsetMR, State);
} }
@ -437,8 +432,7 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const vfo_info_t *pVFO, bool keep)
// { // update the channel name // { // update the channel name
// memmove(State, pVFO->name + 0, 8); // memmove(State, pVFO->name + 0, 8);
// EEPROM_WriteBuffer(0x0F50 + OffsetMR, State); // EEPROM_WriteBuffer(0x0F50 + OffsetMR, State);
// //memset(State, 0xFF, sizeof(State)); // memset(State, 0, sizeof(State));
// memset(State, 0x00, sizeof(State)); // follow the QS way
// memmove(State, pVFO->name + 8, 2); // memmove(State, pVFO->name + 8, 2);
// EEPROM_WriteBuffer(0x0F58 + OffsetMR, State); // EEPROM_WriteBuffer(0x0F58 + OffsetMR, State);
// } // }

View File

@ -178,39 +178,39 @@ typedef struct {
// 0x1E00 // 0x1E00
struct { struct {
uint8_t open_rssi_thresh[10]; uint8_t open_rssi_thresh[10]; //
uint8_t unused1[6]; uint8_t unused1[6]; // 0xff's
uint8_t close_rssi_thresh[10]; uint8_t close_rssi_thresh[10]; //
uint8_t unused2[6]; uint8_t unused2[6]; // 0xff's
uint8_t open_noise_thresh[10]; uint8_t open_noise_thresh[10]; //
uint8_t unused3[6]; uint8_t unused3[6]; // 0xff's
uint8_t close_noise_thresh[10]; uint8_t close_noise_thresh[10]; //
uint8_t unused4[6]; uint8_t unused4[6]; // 0xff's
uint8_t open_glitch_thresh[10]; uint8_t open_glitch_thresh[10]; //
uint8_t unused5[6]; uint8_t unused5[6]; // 0xff's
uint8_t close_glitch_thresh[10]; uint8_t close_glitch_thresh[10]; //
uint8_t unused6[6]; uint8_t unused6[6]; // 0xff's
} __attribute__((packed)) squelch_band_4567[6]; } __attribute__((packed)) squelch_band_4567[6]; //
// 0x1E60 // 0x1E60
struct { struct {
uint8_t open_rssi_thresh[10]; uint8_t open_rssi_thresh[10]; //
uint8_t unused1[6]; uint8_t unused1[6]; // 0xff's
uint8_t close_rssi_thresh[10]; uint8_t close_rssi_thresh[10]; //
uint8_t unused2[6]; uint8_t unused2[6]; // 0xff's
uint8_t open_noise_thresh[10]; uint8_t open_noise_thresh[10]; //
uint8_t unused3[6]; uint8_t unused3[6]; // 0xff's
uint8_t close_noise_thresh[10]; uint8_t close_noise_thresh[10]; //
uint8_t unused4[6]; uint8_t unused4[6]; // 0xff's
uint8_t open_glitch_thresh[10]; uint8_t open_glitch_thresh[10]; //
uint8_t unused5[6]; uint8_t unused5[6]; // 0xff's
uint8_t close_glitch_thresh[10]; uint8_t close_glitch_thresh[10]; //
uint8_t unused6[6]; uint8_t unused6[6]; // 0xff's
} __attribute__((packed)) squelch_band_123[6]; } __attribute__((packed)) squelch_band_123[6]; //
// 0x1EC0 // 0x1EC0
uint16_t rssi_band_4567[4]; // uint16_t rssi_band_4567[4]; // RSSI bargraph thresholds .. (dBm + 160) * 2
uint16_t rssi_band_123[4]; // uint16_t rssi_band_123[4]; // RSSI bargraph thresholds .. (dBm + 160) * 2
// 0x1ED0 // 0x1ED0
struct struct
@ -218,18 +218,18 @@ typedef struct {
uint8_t low[3]; // uint8_t low[3]; //
uint8_t mid[3]; // uint8_t mid[3]; //
uint8_t high[3]; // uint8_t high[3]; //
uint8_t unused[7]; // uint8_t unused[7]; // 0xff's
} tx_band_power[7]; // } tx_band_power[7]; //
// 0x1F40 // 0x1F40
uint16_t battery[6]; // uint16_t battery[6]; //
uint8_t unused1[4]; // uint8_t unused1[4]; // 0xff's
// 0x1F50 // 0x1F50
struct struct
{ {
uint16_t threshold[10]; // uint16_t threshold[10]; //
uint8_t unused[4]; // uint8_t unused[4]; // 0xff's
} __attribute__((packed)) vox[2]; // } __attribute__((packed)) vox[2]; //
// 0x1F80 // 0x1F80
@ -241,7 +241,7 @@ typedef struct {
uint8_t volume_gain; // uint8_t volume_gain; //
uint8_t dac_gain; // uint8_t dac_gain; //
uint8_t unused5[8 * 10]; // uint8_t unused5[8 * 10]; // 0xff's
} __attribute__((packed)) t_calibration; } __attribute__((packed)) t_calibration;
@ -267,20 +267,20 @@ typedef struct {
// 0x0D60 // 0x0D60
struct { // these channel attribute settings could have been in the t_channel structure ! struct { // these channel attribute settings could have been in the t_channel structure !
uint8_t band:4; // why do QS have these 4 bits ? .. band can/is computed from the frequency uint8_t band:4; // why do QS have these 4 bits ? .. band can/is computed from the frequency
uint8_t unused:2; // uint8_t unused:2; // 0's ?
// uint8_t compander:2; // smoved this to the t_channel structure // uint8_t compander:2; // smoved this to the t_channel structure
uint8_t scanlist2:1; // set if is in scan list 2 uint8_t scanlist2:1; // set if is in scan list 2
uint8_t scanlist1:1; // set if is in scan list 1 uint8_t scanlist1:1; // set if is in scan list 1
} __attribute__((packed)) channel_attr[200]; // } __attribute__((packed)) channel_attr[200]; //
uint8_t unused1[8]; // uint8_t unused1[8]; // 0xff's
// 0x0E30 // 0x0E30
uint8_t unused2[16]; // uint8_t unused2[16]; // 0xff's
// 0x0E40 // 0x0E40
uint16_t fm_channel[20]; // uint16_t fm_channel[20]; //
uint8_t unused3[8]; // uint8_t unused3[8]; // 0xff's
// 0x0E70 // 0x0E70
uint8_t call1; // uint8_t call1; //
@ -291,7 +291,11 @@ typedef struct {
uint8_t vox_switch; // uint8_t vox_switch; //
uint8_t vox_level; // uint8_t vox_level; //
uint8_t mic_sensitivity; // uint8_t mic_sensitivity; //
#if 1
uint8_t lcd_contrast; // 1of11 uint8_t lcd_contrast; // 1of11
#else
uint8_t unused4; // 0xff's
#endif
uint8_t channel_display_mode; // uint8_t channel_display_mode; //
uint8_t cross_vfo; // uint8_t cross_vfo; //
uint8_t battery_save; // uint8_t battery_save; //
@ -312,7 +316,7 @@ typedef struct {
uint8_t fm_selected_frequency; // uint8_t fm_selected_frequency; //
uint8_t fm_selected_channel; // uint8_t fm_selected_channel; //
uint8_t fm_is_channel_mode; // uint8_t fm_is_channel_mode; //
uint8_t unused5[5]; // uint8_t unused5[5]; // 0xff's
// 0x0E90 // 0x0E90
uint8_t beep_control; // uint8_t beep_control; //
@ -324,11 +328,11 @@ typedef struct {
uint8_t auto_key_lock; // uint8_t auto_key_lock; //
uint8_t display_mode; // uint8_t display_mode; //
uint32_t power_on_password; // uint32_t power_on_password; //
uint8_t unused6[4]; // uint8_t unused6[4]; // 0xff's
// 0x0EA0 // 0x0EA0
uint8_t voice_prompt; // uint8_t voice_prompt; //
uint8_t unused7[7]; // uint8_t unused7[7]; // 0xff's
uint8_t alarm_mode; // uint8_t alarm_mode; //
uint8_t roger_mode; // uint8_t roger_mode; //
uint8_t repeater_tail_tone_elimination; // rp_ste uint8_t repeater_tail_tone_elimination; // rp_ste
@ -336,7 +340,7 @@ typedef struct {
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
uint32_t air_copy_freq; // 1of11 uint32_t air_copy_freq; // 1of11
#else #else
uint8_t unused8[4]; // uint8_t unused8[4]; // 0xff's
#endif #endif
// 0x0EB0 // 0x0EB0
@ -355,7 +359,7 @@ typedef struct {
uint8_t dtmf_code_time; // uint8_t dtmf_code_time; //
uint8_t dtmf_code_interval; // uint8_t dtmf_code_interval; //
uint8_t dtmf_permit_kill; // uint8_t dtmf_permit_kill; //
uint8_t unused9[5]; // uint8_t unused9[5]; // 0xff's
// 0x0EE0 // 0x0EE0
uint8_t dtmf_ani_id[8]; // uint8_t dtmf_ani_id[8]; //
@ -372,10 +376,10 @@ typedef struct {
uint8_t priority2_enable; // uint8_t priority2_enable; //
uint8_t priority2_channel1; // uint8_t priority2_channel1; //
uint8_t priority2_channel2; // uint8_t priority2_channel2; //
uint8_t unused10; // uint8_t unused10; // 0xff's
// 0x0F20 // 0x0F20
uint8_t unused11[8]; // uint8_t unused11[8]; // 0xff's
// 0x0F30 // 0x0F30
uint8_t aes_key[16]; // disabled = all 0xff uint8_t aes_key[16]; // disabled = all 0xff
@ -383,14 +387,14 @@ typedef struct {
// 0x0F40 // 0x0F40
uint8_t freq_lock; // uint8_t freq_lock; //
uint8_t enable_tx_350; // 350MHz ~ 400MHz uint8_t enable_tx_350; // 350MHz ~ 400MHz
uint8_t killed; // uint8_t radio_disabled; // 0 = not radio is not disabled
uint8_t enable_tx_200; // uint8_t enable_tx_200; // 174MHz ~ 350MHz
uint8_t enable_tx_500; // uint8_t enable_tx_470; // >= 470MHz disabled
uint8_t enable_350; // uint8_t enable_350; // 0 = 350HMz ~ 400MHz RX/TX disabled
uint8_t enable_scrambler; // uint8_t enable_scrambler; // 0 = scrambler disabled, 1 = enabled
#if 0 #if 0
// QS // QS
uint8_t unused12[9]; // uint8_t unused12[9]; // 0xff's
#else #else
// 1of11 // 1of11
uint8_t tx_enable:1; // 0 = completely disable TX, 1 = allow TX uint8_t tx_enable:1; // 0 = completely disable TX, 1 = allow TX
@ -400,14 +404,17 @@ typedef struct {
uint8_t am_fix:1; // 1 = RX AM fix uint8_t am_fix:1; // 1 = RX AM fix
uint8_t backlight_on_tx_rx:2; // 0 = no backlight when TX/RX, 1 = when TX, 2 = when RX, 3 = both RX/TX uint8_t backlight_on_tx_rx:2; // 0 = no backlight when TX/RX, 1 = when TX, 2 = when RX, 3 = both RX/TX
uint8_t unused12[8]; // uint8_t unused12[8]; // 0xff's
#endif #endif
// 0x0F50 // 0x0F50
char channel_name[200][16]; // each channels name text (max 10 chars used per channel) struct {
char name[10];
uint8_t unused[6]; // 0xff's
} __attribute__((packed)) channel_name[200];
// 0x1BD0 // 0x1BD0
uint8_t unused13[16 * 3]; // free to use uint8_t unused13[16 * 3]; // 0xff's .. free to use
// 0x1C00 // 0x1C00
struct { struct {

View File

@ -283,7 +283,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
} }
#endif #endif
void UI_UpdateRSSI(const int16_t rssi, const int vfo) void UI_update_rssi(const int16_t rssi, const int vfo)
{ {
#ifdef ENABLE_RSSI_BAR #ifdef ENABLE_RSSI_BAR
@ -809,7 +809,7 @@ void UI_DisplayMain(void)
} }
// show the DTMF decoding symbol // show the DTMF decoding symbol
if (g_eeprom.vfo_info[vfo_num].dtmf_decoding_enable || g_setting_killed) if (g_eeprom.vfo_info[vfo_num].dtmf_decoding_enable || g_setting_radio_disabled)
UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1); UI_PrintStringSmall("DTMF", LCD_WIDTH + 78, 0, line + 1);
// show the audio scramble symbol // show the audio scramble symbol

View File

@ -37,7 +37,7 @@ extern center_line_t center_line;
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
bool UI_DisplayAudioBar(const bool now); bool UI_DisplayAudioBar(const bool now);
#endif #endif
void UI_UpdateRSSI(const int16_t rssi, const int vfo); void UI_update_rssi(const int16_t rssi, const int vfo);
void UI_DisplayMain(void); void UI_DisplayMain(void);
#endif #endif

View File

@ -130,9 +130,9 @@ const t_menu_item g_menu_list[] =
// enabled by pressing both the PTT and upper side button at power-on // enabled by pressing both the PTT and upper side button at power-on
{"F LOCK", VOICE_ID_INVALID, MENU_FREQ_LOCK }, // country/area specific {"F LOCK", VOICE_ID_INVALID, MENU_FREQ_LOCK }, // country/area specific
{"Tx 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX" {"Tx 174", VOICE_ID_INVALID, MENU_174TX }, // was "200TX"
{"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX" {"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
{"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX" {"Tx 470", VOICE_ID_INVALID, MENU_470TX }, // was "500TX"
{"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN" {"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN" {"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"Tx EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX {"Tx EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
@ -752,10 +752,23 @@ void UI_DisplayMenu(void)
#endif #endif
case MENU_350TX: case MENU_350TX:
case MENU_200TX: strcpy(String, "350 ~ 400\n");
case MENU_500TX: strcat(String, g_sub_menu_DIS_EN[g_sub_menu_selection]);
break;
case MENU_174TX:
strcpy(String, "174 ~ 350\n");
strcat(String, g_sub_menu_DIS_EN[g_sub_menu_selection]);
break;
case MENU_470TX:
strcpy(String, "470 ~ 600\n");
strcat(String, g_sub_menu_DIS_EN[g_sub_menu_selection]);
break;
case MENU_350EN: case MENU_350EN:
strcpy(String, g_sub_menu_DIS_EN[g_sub_menu_selection]); strcpy(String, "350 ~ 400\n");
strcat(String, g_sub_menu_DIS_EN[g_sub_menu_selection]);
break; break;
case MENU_SCREN: case MENU_SCREN:

View File

@ -124,9 +124,9 @@ enum
// items after here are normally hidden // items after here are normally hidden
MENU_FREQ_LOCK, MENU_FREQ_LOCK,
MENU_200TX, MENU_174TX,
MENU_350TX, MENU_350TX,
MENU_500TX, MENU_470TX,
MENU_350EN, MENU_350EN,
MENU_SCREN, MENU_SCREN,

View File

@ -79,7 +79,7 @@ void UI_DisplayStatus(const bool test_display)
// hmmm, what to put in it's place // hmmm, what to put in it's place
#endif #endif
if (g_setting_killed) if (g_setting_radio_disabled)
{ {
memset(line + x, 0xFF, 10); memset(line + x, 0xFF, 10);
x1 = x + 10; x1 = x + 10;
@ -131,10 +131,17 @@ void UI_DisplayStatus(const bool test_display)
// DUAL-WATCH indicator // DUAL-WATCH indicator
if (g_eeprom.dual_watch != DUAL_WATCH_OFF || test_display) if (g_eeprom.dual_watch != DUAL_WATCH_OFF || test_display)
{ {
if (g_dual_watch_active || test_display) if (g_scan_state_dir == SCAN_STATE_DIR_OFF ||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1)); g_squelch_lost ||
g_current_function == FUNCTION_INCOMING ||
g_current_function == FUNCTION_MONITOR ||
g_screen_to_display == DISPLAY_SEARCH ||
test_display)
{
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1)); // dual-watch is paused
}
else else
memmove(line + x, BITMAP_TDR2, sizeof(BITMAP_TDR2)); memmove(line + x, BITMAP_TDR2, sizeof(BITMAP_TDR2)); // dual-watch is running
} }
x += sizeof(BITMAP_TDR1); x += sizeof(BITMAP_TDR1);