mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-08-03 09:36:32 +03:00
Try up/down butts with squelch off/monitor enabled
This commit is contained in:
116
app/action.c
116
app/action.c
@@ -76,13 +76,13 @@ void ACTION_Monitor(void)
|
||||
{
|
||||
if (g_current_function != FUNCTION_MONITOR)
|
||||
{ // enable the monitor
|
||||
RADIO_SelectVfos();
|
||||
#ifdef g_power_save_expired
|
||||
RADIO_select_vfos();
|
||||
#ifdef ENABLE_NOAA
|
||||
if (g_rx_vfo->channel_save >= NOAA_CHANNEL_FIRST && g_is_noaa_mode)
|
||||
g_noaa_channel = g_rx_vfo->channel_save - NOAA_CHANNEL_FIRST;
|
||||
#endif
|
||||
RADIO_SetupRegisters(true);
|
||||
APP_StartListening(FUNCTION_MONITOR, false);
|
||||
RADIO_setup_registers(true);
|
||||
APP_start_listening(FUNCTION_MONITOR, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ void ACTION_Monitor(void)
|
||||
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||
{
|
||||
g_scan_pause_delay_in_10ms = scan_pause_delay_in_1_10ms;
|
||||
g_scan_schedule_scan_listen = false;
|
||||
g_scan_pause_mode = true;
|
||||
g_scan_pause_delay_in_10ms = scan_pause_delay_in_1_10ms;
|
||||
g_scan_schedule_scan_listen = false;
|
||||
g_scan_pause_mode = true;
|
||||
}
|
||||
|
||||
#ifdef g_power_save_expired
|
||||
@@ -103,7 +103,7 @@ void ACTION_Monitor(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode)
|
||||
@@ -139,19 +139,18 @@ void ACTION_Scan(bool bRestart)
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
{ // start scanning
|
||||
uint16_t Frequency;
|
||||
|
||||
if (bRestart)
|
||||
{ // going to scan and auto store what we find
|
||||
{ // scan with auto store
|
||||
FM_EraseChannels();
|
||||
|
||||
g_fm_auto_scan = true;
|
||||
g_fm_channel_position = 0;
|
||||
Frequency = FM_RADIO_BAND.lower;
|
||||
}
|
||||
else
|
||||
{
|
||||
{ // scan without auto store
|
||||
g_fm_auto_scan = false;
|
||||
g_fm_channel_position = 0;
|
||||
Frequency = g_eeprom.fm_frequency_playing;
|
||||
@@ -172,7 +171,7 @@ void ACTION_Scan(bool bRestart)
|
||||
#endif
|
||||
|
||||
if (g_screen_to_display != DISPLAY_SEARCH)
|
||||
{ // not scanning
|
||||
{ // not in freq/ctcss/cdcss search mode
|
||||
|
||||
g_monitor_enabled = false;
|
||||
|
||||
@@ -181,69 +180,78 @@ void ACTION_Scan(bool bRestart)
|
||||
g_dtmf_rx_live_timeout = 0;
|
||||
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))
|
||||
#endif
|
||||
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||
{ // already scanning
|
||||
{ // currently scanning
|
||||
|
||||
if (g_scan_next_channel <= USER_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
|
||||
// keep scanning but toggle between scan lists
|
||||
g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3;
|
||||
if (g_eeprom.scan_list_default < 2)
|
||||
{ // keep scanning but toggle between scan lists
|
||||
|
||||
// jump to the next channel
|
||||
CHANNEL_Next(true, g_scan_state_dir);
|
||||
g_scan_pause_delay_in_10ms = 1;
|
||||
g_scan_schedule_scan_listen = false;
|
||||
//g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3;
|
||||
g_eeprom.scan_list_default++;
|
||||
|
||||
g_update_status = true;
|
||||
}
|
||||
else
|
||||
{ // stop scanning
|
||||
|
||||
SCAN_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // start scanning
|
||||
// jump to the next channel
|
||||
APP_channel_next(true, g_scan_state_dir);
|
||||
g_scan_pause_delay_in_10ms = 1;
|
||||
g_scan_schedule_scan_listen = false;
|
||||
|
||||
CHANNEL_Next(true, SCAN_STATE_DIR_FORWARD);
|
||||
g_update_status = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// stop scanning
|
||||
|
||||
APP_stop_scan();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
AUDIO_PlaySingleVoice(true);
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
|
||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
// start scanning
|
||||
|
||||
APP_channel_next(true, SCAN_STATE_DIR_FORWARD);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
AUDIO_PlaySingleVoice(true);
|
||||
#endif
|
||||
|
||||
// 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_update_status = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
// freq/ctcss/cdcss/search mode
|
||||
|
||||
|
||||
// TODO: fixme
|
||||
|
||||
|
||||
// if (!bRestart)
|
||||
if (!bRestart && g_scan_next_channel <= USER_CHANNEL_LAST)
|
||||
{ // channel mode, keep scanning but toggle between scan lists
|
||||
g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
CHANNEL_Next(true, g_scan_state_dir);
|
||||
g_scan_pause_delay_in_10ms = 1;
|
||||
g_scan_schedule_scan_listen = false;
|
||||
APP_channel_next(true, g_scan_state_dir);
|
||||
g_scan_pause_delay_in_10ms = 1;
|
||||
g_scan_schedule_scan_listen = false;
|
||||
|
||||
g_update_status = true;
|
||||
}
|
||||
@@ -251,7 +259,7 @@ void ACTION_Scan(bool bRestart)
|
||||
{ // stop scanning
|
||||
g_monitor_enabled = false;
|
||||
|
||||
SCAN_Stop();
|
||||
APP_stop_scan();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
@@ -320,8 +328,8 @@ void ACTION_Scan(bool bRestart)
|
||||
|
||||
g_monitor_enabled = false;
|
||||
|
||||
RADIO_SelectVfos();
|
||||
RADIO_SetupRegisters(true);
|
||||
RADIO_select_vfos();
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
FM_Start();
|
||||
|
||||
|
@@ -70,7 +70,7 @@ void AIRCOPY_init(void)
|
||||
// turn the backlight ON
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
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)
|
||||
{
|
||||
|
@@ -42,6 +42,6 @@ extern uint16_t g_fsk_tx_timeout_10ms;
|
||||
void AIRCOPY_init(void);
|
||||
void AIRCOPY_process_fsk_tx_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
|
||||
|
16
app/app.h
16
app/app.h
@@ -28,14 +28,14 @@ extern const uint8_t orig_lna;
|
||||
extern const uint8_t orig_mixer;
|
||||
extern const uint8_t orig_pga;
|
||||
|
||||
void APP_EndTransmission(void);
|
||||
void SCAN_Stop(void);
|
||||
void CHANNEL_Next(const bool flag, const scan_state_dir_t scan_direction);
|
||||
void APP_StartListening(function_type_t Function, const bool reset_am_fix);
|
||||
uint32_t APP_SetFrequencyByStep(vfo_info_t *pInfo, int8_t Step);
|
||||
void APP_Update(void);
|
||||
void APP_TimeSlice10ms(void);
|
||||
void APP_TimeSlice500ms(void);
|
||||
void APP_end_tx(void);
|
||||
void APP_stop_scan(void);
|
||||
void APP_channel_next(const bool flag, const scan_state_dir_t scan_direction);
|
||||
void APP_start_listening(function_type_t Function, const bool reset_am_fix);
|
||||
uint32_t APP_set_frequency_by_step(vfo_info_t *pInfo, int8_t Step);
|
||||
void APP_process(void);
|
||||
void APP_time_slice_10ms(void);
|
||||
void APP_time_slice_500ms(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
10
app/dtmf.c
10
app/dtmf.c
@@ -215,7 +215,7 @@ void DTMF_HandleRequest(void)
|
||||
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
|
||||
DTMF_clear_RX();
|
||||
return;
|
||||
@@ -235,7 +235,7 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
if (g_eeprom.permit_remote_kill)
|
||||
{
|
||||
g_setting_killed = true; // oooerr !
|
||||
g_setting_radio_disabled = true; // oooerr !
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
@@ -274,7 +274,7 @@ void DTMF_HandleRequest(void)
|
||||
if (DTMF_CompareMessage(g_dtmf_rx + Offset, String, strlen(String), true))
|
||||
{ // shit, we're back !
|
||||
|
||||
g_setting_killed = false;
|
||||
g_setting_radio_disabled = false;
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
@@ -328,8 +328,8 @@ void DTMF_HandleRequest(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_setting_killed || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
{ // we've been killed or expecting a reply
|
||||
if (g_setting_radio_disabled || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
|
||||
{ // we've been disabled, or expecting a reply
|
||||
return;
|
||||
}
|
||||
|
||||
|
2
app/fm.c
2
app/fm.c
@@ -605,7 +605,7 @@ Bail:
|
||||
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)
|
||||
{
|
||||
|
2
app/fm.h
2
app/fm.h
@@ -50,7 +50,7 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag);
|
||||
void FM_PlayAndUpdate(void);
|
||||
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_Start(void);
|
||||
|
@@ -109,7 +109,7 @@ void GENERIC_Key_PTT(bool key_pressed)
|
||||
}
|
||||
else
|
||||
{
|
||||
APP_EndTransmission();
|
||||
APP_end_tx();
|
||||
|
||||
if (g_eeprom.repeater_tail_tone_elimination == 0)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
@@ -153,7 +153,7 @@ void GENERIC_Key_PTT(bool key_pressed)
|
||||
else
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||
{ // frequency/channel scanning . .stop
|
||||
SCAN_Stop();
|
||||
APP_stop_scan();
|
||||
}
|
||||
else
|
||||
if (g_css_scan_mode != CSS_SCAN_MODE_OFF)
|
||||
|
154
app/main.c
154
app/main.c
@@ -80,7 +80,7 @@ static void processFKeyFunction(const key_code_t Key)
|
||||
switch (Key)
|
||||
{
|
||||
case KEY_0: // FM
|
||||
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
ACTION_FM();
|
||||
#else
|
||||
@@ -93,7 +93,7 @@ static void processFKeyFunction(const key_code_t Key)
|
||||
break;
|
||||
|
||||
case KEY_1: // BAND
|
||||
|
||||
|
||||
if (!IS_FREQ_CHANNEL(g_tx_vfo->channel_save))
|
||||
{
|
||||
g_fkey_pressed = false;
|
||||
@@ -124,7 +124,7 @@ static void processFKeyFunction(const key_code_t Key)
|
||||
break;
|
||||
|
||||
case KEY_2: // A/B
|
||||
|
||||
|
||||
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_CHAN_A)
|
||||
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_CHAN_B;
|
||||
else
|
||||
@@ -148,11 +148,7 @@ static void processFKeyFunction(const key_code_t Key)
|
||||
break;
|
||||
|
||||
case KEY_3: // VFO/MR
|
||||
#ifdef ENABLE_NOAA
|
||||
if (g_eeprom.vfo_open && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
#else
|
||||
if (g_eeprom.vfo_open)
|
||||
#endif
|
||||
if (g_eeprom.vfo_open && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
{
|
||||
uint8_t Channel;
|
||||
|
||||
@@ -195,7 +191,7 @@ static void processFKeyFunction(const key_code_t Key)
|
||||
break;
|
||||
|
||||
case KEY_4: // FC
|
||||
|
||||
|
||||
g_fkey_pressed = false;
|
||||
g_search_flag_start_scan = true;
|
||||
g_search_single_frequency = false;
|
||||
@@ -207,7 +203,7 @@ static void processFKeyFunction(const key_code_t Key)
|
||||
break;
|
||||
|
||||
case KEY_5: // NOAA
|
||||
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
|
||||
if (IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
@@ -234,13 +230,13 @@ static void processFKeyFunction(const key_code_t Key)
|
||||
break;
|
||||
|
||||
case KEY_6: // H/M/L
|
||||
|
||||
|
||||
ACTION_Power();
|
||||
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_7: // VOX
|
||||
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
ACTION_Vox();
|
||||
#else
|
||||
@@ -250,14 +246,14 @@ static void processFKeyFunction(const key_code_t Key)
|
||||
break;
|
||||
|
||||
case KEY_8: // R
|
||||
|
||||
|
||||
g_tx_vfo->frequency_reverse = g_tx_vfo->frequency_reverse == false;
|
||||
g_request_save_channel = 1;
|
||||
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_9: // CALL
|
||||
|
||||
|
||||
if (RADIO_CheckValidChannel(g_eeprom.chan_1_call, false, 0))
|
||||
{
|
||||
g_eeprom.user_channel[Vfo] = g_eeprom.chan_1_call;
|
||||
@@ -461,14 +457,14 @@ static void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
Channel = (g_input_box[0] * 10) + g_input_box[1];
|
||||
if (Channel >= 1 && Channel <= ARRAY_SIZE(NOAA_FREQUENCY_TABLE))
|
||||
{
|
||||
Channel += NOAA_CHANNEL_FIRST;
|
||||
Channel += NOAA_CHANNEL_FIRST;
|
||||
#ifdef ENABLE_VOICE
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
g_eeprom.noaa_channel[Vfo] = Channel;
|
||||
g_eeprom.screen_channel[Vfo] = Channel;
|
||||
g_request_save_vfo = true;
|
||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||
g_request_save_vfo = true;
|
||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -518,7 +514,7 @@ static void MAIN_Key_EXIT(bool key_pressed, bool key_held)
|
||||
}
|
||||
else
|
||||
{
|
||||
SCAN_Stop();
|
||||
APP_stop_scan();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
@@ -573,8 +569,8 @@ static void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
g_fkey_pressed = false;
|
||||
g_update_status = true;
|
||||
g_fkey_pressed = false;
|
||||
g_update_status = true;
|
||||
|
||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||
|
||||
@@ -584,7 +580,7 @@ static void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||
{
|
||||
if (g_current_function != FUNCTION_INCOMING ||
|
||||
g_rx_reception_mode == RX_MODE_NONE ||
|
||||
g_rx_reception_mode == RX_MODE_NONE ||
|
||||
g_scan_pause_delay_in_10ms == 0)
|
||||
{ // scan is running (not paused)
|
||||
return;
|
||||
@@ -598,14 +594,14 @@ static void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
|
||||
const unsigned int channel = FREQ_CHANNEL_FIRST + g_eeprom.vfo_info[vfo].band;
|
||||
|
||||
g_eeprom.screen_channel[vfo] = channel;
|
||||
g_eeprom.screen_channel[vfo] = 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_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
g_request_save_vfo = true;
|
||||
|
||||
@@ -629,8 +625,10 @@ static void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
|
||||
if (!key_pressed && !g_dtmf_input_mode)
|
||||
{ // menu key released
|
||||
|
||||
const bool flag = (g_input_box_index == 0);
|
||||
g_input_box_index = 0;
|
||||
|
||||
g_input_box_index = 0;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
@@ -654,15 +652,18 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
|
||||
|
||||
if (g_input_box_index > 0)
|
||||
{ // entering a frequency or DTMF string
|
||||
|
||||
if (!key_held && key_pressed)
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_held && !g_fkey_pressed)
|
||||
{ // long press .. toggle scanning
|
||||
|
||||
if (!key_pressed)
|
||||
return; // released
|
||||
return; // released
|
||||
|
||||
ACTION_Scan(false);
|
||||
|
||||
@@ -672,31 +673,23 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
|
||||
|
||||
if (key_pressed)
|
||||
{ // just pressed
|
||||
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
g_beep_to_play = BEEP_880HZ_40MS_OPTIONAL;
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
// just released
|
||||
|
||||
if (!g_fkey_pressed)
|
||||
{ // 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))
|
||||
#else
|
||||
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
|
||||
#endif
|
||||
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
{ // start entering a DTMF string
|
||||
|
||||
memmove(
|
||||
g_dtmf_input_box,
|
||||
g_dtmf_string,
|
||||
memmove( 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);
|
||||
|
||||
g_dtmf_input_box_index = 0;
|
||||
g_dtmf_input_mode = true;
|
||||
|
||||
g_key_input_count_down = key_input_timeout_500ms;
|
||||
g_key_input_count_down = key_input_timeout_500ms;
|
||||
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
}
|
||||
@@ -705,30 +698,38 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
|
||||
{ // with the F-key
|
||||
g_fkey_pressed = false;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
{
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
{
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
// scan the CTCSS/DCS code
|
||||
g_search_flag_start_scan = true;
|
||||
g_search_single_frequency = true;
|
||||
g_backup_cross_vfo_rx_tx = g_eeprom.cross_vfo_rx_tx;
|
||||
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
||||
g_search_flag_start_scan = true;
|
||||
g_search_single_frequency = true;
|
||||
g_backup_cross_vfo_rx_tx = g_eeprom.cross_vfo_rx_tx;
|
||||
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;
|
||||
}
|
||||
|
||||
static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Direction)
|
||||
{
|
||||
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)
|
||||
{ // long press
|
||||
|
||||
@@ -759,20 +760,23 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
|
||||
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)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
||||
#endif
|
||||
{ // not scanning
|
||||
|
||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
||||
{
|
||||
uint8_t Next;
|
||||
|
||||
if (IS_FREQ_CHANNEL(Channel))
|
||||
{ // 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)
|
||||
{ // 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;
|
||||
}
|
||||
|
||||
new_band = FREQUENCY_GetBand(frequency);
|
||||
|
||||
g_tx_vfo->freq_config_rx.frequency = frequency;
|
||||
|
||||
g_request_save_channel = 1;
|
||||
if (new_band != old_band)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -815,23 +830,24 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
|
||||
|
||||
g_request_save_vfo = true;
|
||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// jump to the next channel
|
||||
CHANNEL_Next(false, Direction);
|
||||
g_scan_pause_delay_in_10ms = 1;
|
||||
g_scan_schedule_scan_listen = false;
|
||||
APP_channel_next(false, Direction);
|
||||
g_scan_pause_delay_in_10ms = 1;
|
||||
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)
|
||||
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
|
||||
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode && key != KEY_PTT && key != KEY_EXIT)
|
||||
{
|
||||
@@ -850,7 +866,7 @@ void MAIN_ProcessKeys(key_code_t key, bool key_pressed, bool key_held)
|
||||
{
|
||||
DTMF_Append(Character);
|
||||
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_request_display_screen = DISPLAY_MAIN;
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#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
|
||||
|
||||
|
46
app/menu.c
46
app/menu.c
@@ -83,7 +83,7 @@ void MENU_StartCssScan(int8_t Direction)
|
||||
|
||||
g_menu_scroll_direction = Direction;
|
||||
|
||||
RADIO_SelectVfos();
|
||||
RADIO_select_vfos();
|
||||
|
||||
MENU_SelectNextCode();
|
||||
|
||||
@@ -96,7 +96,7 @@ void MENU_StopCssScan(void)
|
||||
g_css_scan_mode = CSS_SCAN_MODE_OFF;
|
||||
g_update_status = true;
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
RADIO_setup_registers(true);
|
||||
}
|
||||
|
||||
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:
|
||||
#endif
|
||||
case MENU_350TX:
|
||||
case MENU_200TX:
|
||||
case MENU_500TX:
|
||||
case MENU_174TX:
|
||||
case MENU_470TX:
|
||||
case MENU_350EN:
|
||||
case MENU_SCREN:
|
||||
case MENU_TX_EN:
|
||||
@@ -559,12 +559,10 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[0]))
|
||||
return;
|
||||
if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[1]))
|
||||
return;
|
||||
#endif
|
||||
if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[0]))
|
||||
return;
|
||||
if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[1]))
|
||||
return;
|
||||
|
||||
g_eeprom.cross_vfo_rx_tx = g_sub_menu_selection;
|
||||
g_flag_reconfigure_vfos = true;
|
||||
@@ -795,12 +793,12 @@ void MENU_AcceptSetting(void)
|
||||
g_setting_freq_lock = g_sub_menu_selection;
|
||||
break;
|
||||
|
||||
case MENU_200TX:
|
||||
g_setting_200_tx_enable = g_sub_menu_selection;
|
||||
case MENU_174TX:
|
||||
g_setting_174_tx_enable = g_sub_menu_selection;
|
||||
break;
|
||||
|
||||
case MENU_500TX:
|
||||
g_setting_500_tx_enable = g_sub_menu_selection;
|
||||
case MENU_470TX:
|
||||
g_setting_470_tx_enable = g_sub_menu_selection;
|
||||
break;
|
||||
|
||||
case MENU_350EN:
|
||||
@@ -883,7 +881,7 @@ void MENU_SelectNextCode(void)
|
||||
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;
|
||||
|
||||
@@ -1229,12 +1227,12 @@ void MENU_ShowCurrentSetting(void)
|
||||
g_sub_menu_selection = g_setting_freq_lock;
|
||||
break;
|
||||
|
||||
case MENU_200TX:
|
||||
g_sub_menu_selection = g_setting_200_tx_enable;
|
||||
case MENU_174TX:
|
||||
g_sub_menu_selection = g_setting_174_tx_enable;
|
||||
break;
|
||||
|
||||
case MENU_500TX:
|
||||
g_sub_menu_selection = g_setting_500_tx_enable;
|
||||
case MENU_470TX:
|
||||
g_sub_menu_selection = g_setting_470_tx_enable;
|
||||
break;
|
||||
|
||||
case MENU_350EN:
|
||||
@@ -1663,13 +1661,9 @@ static void MENU_Key_STAR(const bool key_pressed, const bool key_held)
|
||||
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)
|
||||
#else
|
||||
if (g_rx_vfo->am_mode == 0)
|
||||
#endif
|
||||
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_rx_vfo->am_mode == 0)
|
||||
{
|
||||
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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@@ -30,7 +30,7 @@ void MENU_ShowCurrentSetting(void);
|
||||
void MENU_StartCssScan(int8_t Direction);
|
||||
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
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -471,7 +471,7 @@ void SEARCH_Start(void)
|
||||
|
||||
BK4819_StopScan();
|
||||
|
||||
RADIO_SelectVfos();
|
||||
RADIO_select_vfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
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_freq = BackupStepFreq;
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
RADIO_setup_registers(true);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
g_is_noaa_mode = false;
|
||||
|
@@ -55,7 +55,7 @@ extern uint8_t g_search_delay_10ms;
|
||||
extern uint8_t g_search_hit_count;
|
||||
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);
|
||||
|
||||
#endif
|
||||
|
@@ -202,7 +202,7 @@ static void SetModulation(ModulationType type)
|
||||
static void SetF(uint32_t f) {
|
||||
fMeasure = f;
|
||||
|
||||
BK4819_SetFrequency(fMeasure);
|
||||
BK4819_set_rf_frequency(fMeasure);
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(fMeasure);
|
||||
uint16_t reg = BK4819_ReadRegister(BK4819_REG_30);
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0);
|
||||
@@ -211,7 +211,7 @@ static void SetF(uint32_t f) {
|
||||
|
||||
static void SetTxF(uint32_t f) {
|
||||
fTx = f;
|
||||
BK4819_SetFrequency(f);
|
||||
BK4819_set_rf_frequency(f);
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(f);
|
||||
uint16_t reg = BK4819_ReadRegister(BK4819_REG_30);
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0);
|
||||
|
Reference in New Issue
Block a user