0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 22:58:04 +03:00

FM radio updates - faster scanning and gui update, also some renames

This commit is contained in:
OneOfEleven
2023-10-28 14:07:41 +01:00
parent 0082876274
commit 4153389778
36 changed files with 431 additions and 337 deletions

View File

@ -71,7 +71,7 @@ void ACTION_Power(void)
g_another_voice_id = VOICE_ID_POWER;
#endif
g_request_display_screen = g_screen_to_display;
g_request_display_screen = g_current_display_screen;
}
void ACTION_Monitor(void)
@ -97,7 +97,7 @@ void ACTION_Monitor(void)
#ifdef g_power_save_expired
if (g_eeprom.dual_watch == DUAL_WATCH_OFF && g_is_noaa_mode)
{
g_noaa_count_down_10ms = noaa_count_down_10ms;
g_noaa_tick_10ms = noaa_tick_10ms;
g_schedule_noaa = false;
}
#endif
@ -112,7 +112,7 @@ void ACTION_Monitor(void)
}
else
#endif
g_request_display_screen = g_screen_to_display;
g_request_display_screen = g_current_display_screen;
}
void ACTION_Scan(bool bRestart)
@ -169,7 +169,7 @@ void ACTION_Scan(bool bRestart)
}
#endif
if (g_screen_to_display != DISPLAY_SEARCH)
if (g_current_display_screen != DISPLAY_SEARCH)
{ // not in freq/ctcss/cdcss search mode
g_monitor_enabled = false;
@ -302,7 +302,7 @@ void ACTION_Scan(bool bRestart)
g_flag_prepare_tx = true;
if (g_screen_to_display != DISPLAY_MENU) // 1of11 .. don't close the menu
if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu
g_request_display_screen = DISPLAY_MAIN;
}
#endif

View File

@ -73,7 +73,7 @@ uint16_t g_fsk_buffer[AIRCOPY_DATA_PACKET_SIZE / 2];
unsigned int g_fsk_write_index;
uint16_t g_fsk_tx_timeout_10ms;
uint8_t aircopy_send_count_down_10ms;
uint8_t aircopy_send_tick_10ms;
void AIRCOPY_init(void)
{
@ -255,7 +255,7 @@ void AIRCOPY_stop_fsk_tx(void)
g_aircopy_block_number++;
// TX pause/gap time till we start the next packet
aircopy_send_count_down_10ms = 250 / 10; // 250ms
aircopy_send_tick_10ms = 250 / 10; // 250ms
g_update_display = true;
GUI_DisplayScreen();
@ -278,8 +278,8 @@ void AIRCOPY_process_fsk_tx_10ms(void)
if (g_fsk_write_index > 0)
return; // currently RX'ing a packet
if (aircopy_send_count_down_10ms > 0)
if (--aircopy_send_count_down_10ms > 0)
if (aircopy_send_tick_10ms > 0)
if (--aircopy_send_tick_10ms > 0)
return; // not yet time to TX next packet
if (g_aircopy_block_number >= g_aircopy_block_max)
@ -526,7 +526,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
else
{ // send them the block they want
g_aircopy_block_number = block_num; // go to the block number they want
aircopy_send_count_down_10ms = 0; // TX asap
aircopy_send_tick_10ms = 0; // TX asap
}
}
@ -800,7 +800,7 @@ static void AIRCOPY_Key_MENU(bool key_pressed, bool key_held)
g_aircopy_rx_errors_magic = 0;
g_aircopy_rx_errors_crc = 0;
g_fsk_tx_timeout_10ms = 0;
aircopy_send_count_down_10ms = 0;
aircopy_send_tick_10ms = 0;
g_aircopy_state = AIRCOPY_TX;
g_update_display = true;

237
app/app.c
View File

@ -122,7 +122,7 @@ static void APP_check_for_new_receive(void)
#ifdef ENABLE_NOAA
if (g_is_noaa_mode)
{
g_noaa_count_down_10ms = noaa_count_down_3_10ms;
g_noaa_tick_10ms = noaa_tick_3_10ms;
g_schedule_noaa = false;
}
#endif
@ -192,9 +192,9 @@ static void APP_process_new_receive(void)
flag = (g_scan_state_dir == SCAN_STATE_DIR_OFF && g_current_code_type == CODE_TYPE_NONE);
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_noaa_count_down_10ms > 0)
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_noaa_tick_10ms > 0)
{
g_noaa_count_down_10ms = 0;
g_noaa_tick_10ms = 0;
flag = true;
}
#endif
@ -291,7 +291,7 @@ static void APP_process_rx(void)
break;
case CODE_TYPE_CONTINUOUS_TONE:
if (g_found_ctcss && g_found_ctcss_count_down_10ms == 0)
if (g_found_ctcss && g_found_ctcss_tick_10ms == 0)
{
g_found_ctcss = false;
g_found_cdcss = false;
@ -302,7 +302,7 @@ static void APP_process_rx(void)
case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL:
if (g_found_cdcss && g_found_cdcss_count_down_10ms == 0)
if (g_found_cdcss && g_found_cdcss_tick_10ms == 0)
{
g_found_ctcss = false;
g_found_cdcss = false;
@ -341,7 +341,7 @@ static void APP_process_rx(void)
if (!g_found_ctcss)
{
g_found_ctcss = true;
g_found_ctcss_count_down_10ms = 100; // 1 sec
g_found_ctcss_tick_10ms = 100; // 1 sec
}
if (g_cxcss_tail_found)
@ -361,7 +361,7 @@ static void APP_process_rx(void)
if (!g_found_cdcss)
{
g_found_cdcss = true;
g_found_cdcss_count_down_10ms = 100; // 1 sec
g_found_cdcss_tick_10ms = 100; // 1 sec
}
if (g_cxcss_tail_found)
@ -406,7 +406,7 @@ Skip:
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save))
g_noaa_count_down_10ms = 3000 / 10; // 3 sec
g_noaa_tick_10ms = 3000 / 10; // 3 sec
#endif
g_update_display = true;
@ -419,7 +419,7 @@ Skip:
{
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_tail_tone_elimination_count_down_10ms = 20;
g_tail_tone_elimination_tick_10ms = 20;
g_flag_tail_tone_elimination_complete = false;
g_end_of_rx_detected_maybe = true;
g_speaker_enabled = false;
@ -549,7 +549,7 @@ bool APP_start_listening(function_type_t Function)
g_rx_vfo->p_rx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
g_rx_vfo->p_tx->frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
g_eeprom.screen_channel[chan] = g_rx_vfo->channel_save;
g_noaa_count_down_10ms = 5000 / 10; // 5 sec
g_noaa_tick_10ms = 5000 / 10; // 5 sec
g_schedule_noaa = false;
}
#endif
@ -601,7 +601,7 @@ bool APP_start_listening(function_type_t Function)
if (Function == FUNCTION_MONITOR)
#endif
{ // monitor mode (open squelch)
if (g_screen_to_display != DISPLAY_MENU) // 1of11 .. don't close the menu
if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu
GUI_SelectNextDisplay(DISPLAY_MAIN);
}
else
@ -909,7 +909,7 @@ static void APP_toggle_dual_watch_vfo(void)
void APP_process_radio_interrupts(void)
{
if (g_screen_to_display == DISPLAY_SEARCH)
if (g_current_display_screen == DISPLAY_SEARCH)
return;
while (BK4819_ReadRegister(0x0C) & (1u << 0))
@ -981,6 +981,10 @@ void APP_process_radio_interrupts(void)
if (interrupt_bits & BK4819_REG_02_CTCSS_FOUND)
g_ctcss_lost = false;
#ifdef ENABLE_MDC1200
MDC1200_process_rx(interrupt_bits);
#endif
#ifdef ENABLE_VOX
if (interrupt_bits & BK4819_REG_02_VOX_LOST)
{
@ -1029,10 +1033,6 @@ void APP_process_radio_interrupts(void)
UART_SendText("sq open\r\n");
#endif
}
#ifdef ENABLE_MDC1200
MDC1200_process_rx(interrupt_bits);
#endif
}
}
@ -1095,9 +1095,9 @@ void APP_end_tx(void)
if (g_vox_noise_detected)
{
if (g_vox_lost)
g_vox_stop_count_down_10ms = vox_stop_count_down_10ms;
g_vox_stop_10ms = vox_stop_10ms;
else
if (g_vox_stop_count_down_10ms == 0)
if (g_vox_stop_10ms == 0)
g_vox_noise_detected = false;
if (g_current_function == FUNCTION_TRANSMIT &&
@ -1136,7 +1136,7 @@ void APP_end_tx(void)
if (g_current_function == FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_FOREGROUND);
if (g_current_function != FUNCTION_TRANSMIT && g_serial_config_count_down_500ms == 0)
if (g_current_function != FUNCTION_TRANSMIT && g_serial_config_tick_500ms == 0)
{
g_dtmf_reply_state = DTMF_REPLY_NONE;
RADIO_PrepareTX();
@ -1156,7 +1156,7 @@ void APP_process(void)
}
#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_tick_500ms > 0))
{ // transmitter timed out or must de-key
g_tx_timeout_reached = false;
@ -1169,13 +1169,13 @@ void APP_process(void)
GUI_DisplayScreen();
}
if (g_reduced_service || g_serial_config_count_down_500ms > 0)
if (g_reduced_service || g_serial_config_tick_500ms > 0)
return;
APP_process_function();
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0)
if (g_fm_radio_mode && g_fm_radio_tick_500ms > 0)
return;
#endif
@ -1186,7 +1186,7 @@ void APP_process(void)
if ((g_current_function == FUNCTION_FOREGROUND ||
g_current_function == FUNCTION_NEW_RECEIVE ||
g_current_function == FUNCTION_RECEIVE) &&
g_screen_to_display != DISPLAY_SEARCH &&
g_current_display_screen != DISPLAY_SEARCH &&
g_scan_state_dir != SCAN_STATE_DIR_OFF &&
!g_ptt_is_pressed)
{ // RF scanning
@ -1260,7 +1260,7 @@ void APP_process(void)
APP_next_noaa();
RADIO_setup_registers(false);
g_noaa_count_down_10ms = 7; // 70ms
g_noaa_tick_10ms = 7; // 70ms
g_schedule_noaa = false;
}
}
@ -1277,7 +1277,7 @@ void APP_process(void)
!g_fm_radio_mode &&
#endif
g_dtmf_call_state == DTMF_CALL_STATE_NONE &&
g_screen_to_display != DISPLAY_SEARCH &&
g_current_display_screen != DISPLAY_SEARCH &&
g_scan_state_dir == SCAN_STATE_DIR_OFF &&
g_css_scan_mode == CSS_SCAN_MODE_OFF &&
g_current_function != FUNCTION_POWER_SAVE &&
@ -1285,7 +1285,7 @@ void APP_process(void)
{
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_current_display_screen == DISPLAY_MAIN)
GUI_SelectNextDisplay(DISPLAY_MAIN);
g_rx_vfo_is_active = false;
@ -1321,10 +1321,10 @@ void APP_process(void)
g_eeprom.battery_save == 0 ||
g_scan_state_dir != SCAN_STATE_DIR_OFF ||
g_css_scan_mode != CSS_SCAN_MODE_OFF ||
g_screen_to_display != DISPLAY_MAIN ||
g_current_display_screen != DISPLAY_MAIN ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE)
{
g_battery_save_count_down_10ms = battery_save_count_10ms;
g_battery_save_tick_10ms = battery_save_count_10ms;
}
else
if ((IS_NOT_NOAA_CHANNEL(g_eeprom.screen_channel[0]) &&
@ -1335,7 +1335,7 @@ void APP_process(void)
}
else
{
g_battery_save_count_down_10ms = battery_save_count_10ms;
g_battery_save_tick_10ms = battery_save_count_10ms;
}
#else
if (
@ -1347,10 +1347,10 @@ void APP_process(void)
g_eeprom.battery_save == 0 ||
g_scan_state_dir != SCAN_STATE_DIR_OFF ||
g_css_scan_mode != CSS_SCAN_MODE_OFF ||
g_screen_to_display != DISPLAY_MAIN ||
g_current_display_screen != DISPLAY_MAIN ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE)
{
g_battery_save_count_down_10ms = battery_save_count_10ms;
g_battery_save_tick_10ms = battery_save_count_10ms;
}
else
{
@ -1431,7 +1431,7 @@ void APP_process(void)
// called every 10ms
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_tick_500ms == 0) && g_setting_tx_enable;
key_code_t key;
@ -1450,7 +1450,7 @@ void APP_check_keys(void)
#endif
{
#ifdef ENABLE_AIRCOPY
if (!g_ptt_is_pressed && g_screen_to_display != DISPLAY_AIRCOPY)
if (!g_ptt_is_pressed && g_current_display_screen != DISPLAY_AIRCOPY)
#else
if (!g_ptt_is_pressed)
#endif
@ -1504,7 +1504,7 @@ void APP_check_keys(void)
g_boot_counter_10ms = 0; // cancel boot screen/beeps
if (g_serial_config_count_down_500ms > 0)
if (g_serial_config_tick_500ms > 0)
{ // config upload/download in progress
g_key_debounce_press = 0;
g_key_debounce_repeat = 0;
@ -1528,7 +1528,7 @@ void APP_check_keys(void)
#endif
#ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY)
if (g_current_display_screen != DISPLAY_AIRCOPY)
APP_process_key(g_key_prev, false, g_key_held);
else
AIRCOPY_process_key(g_key_prev, false, g_key_held);
@ -1568,7 +1568,7 @@ void APP_check_keys(void)
g_key_prev = key;
#ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY)
if (g_current_display_screen != DISPLAY_AIRCOPY)
APP_process_key(g_key_prev, true, g_key_held);
else
AIRCOPY_process_key(g_key_prev, true, g_key_held);
@ -1593,7 +1593,7 @@ void APP_check_keys(void)
#endif
#ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY)
if (g_current_display_screen != DISPLAY_AIRCOPY)
APP_process_key(g_key_prev, true, g_key_held);
else
AIRCOPY_process_key(g_key_prev, true, g_key_held);
@ -1617,7 +1617,7 @@ void APP_check_keys(void)
#endif
#ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY)
if (g_current_display_screen != DISPLAY_AIRCOPY)
APP_process_key(g_key_prev, true, g_key_held);
else
AIRCOPY_process_key(g_key_prev, true, g_key_held);
@ -1645,9 +1645,44 @@ void APP_time_slice_10ms(void)
UART_HandleCommand();
__enable_irq();
}
if (g_serial_config_tick_500ms > 0)
{ // config upload/download is running
if (g_update_display)
GUI_DisplayScreen();
if (g_update_status)
UI_DisplayStatus(false);
return;
}
#endif
// ***********
#ifdef ENABLE_AIRCOPY
if (g_current_display_screen == DISPLAY_AIRCOPY)
{ // we're in AIRCOPY mode
if (g_aircopy_state == AIRCOPY_TX)
AIRCOPY_process_fsk_tx_10ms();
AIRCOPY_process_fsk_rx_10ms();
APP_check_keys();
if (g_update_display)
GUI_DisplayScreen();
if (g_update_status)
UI_DisplayStatus(false);
return;
}
#endif
#ifdef ENABLE_AM_FIX
// if (g_eeprom.vfo_info[g_eeprom.rx_vfo].am_mode && g_setting_am_fix)
if (g_rx_vfo->am_mode && g_setting_am_fix)
AM_fix_10ms(g_eeprom.rx_vfo);
#endif
if (g_flag_save_vfo)
{
@ -1667,6 +1702,10 @@ void APP_time_slice_10ms(void)
SETTINGS_save_fm();
g_flag_save_fm = false;
}
if (g_fm_radio_mode && g_current_display_screen == DISPLAY_FM)
if ((g_flash_light_blink_counter % (500 / 10)) == 0) // once every 500ms
g_update_display = true;
#endif
if (g_flag_save_channel)
@ -1680,19 +1719,6 @@ void APP_time_slice_10ms(void)
GUI_SelectNextDisplay(DISPLAY_MAIN);
}
// ***********
if (g_serial_config_count_down_500ms > 0)
{ // config upload/download is running
if (g_update_display)
GUI_DisplayScreen();
if (g_update_status)
UI_DisplayStatus(false);
return;
}
// ***********
#ifdef ENABLE_BOOT_BEEPS
if (g_boot_counter_10ms > 0 && (g_boot_counter_10ms % 25) == 0)
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
@ -1701,35 +1727,6 @@ void APP_time_slice_10ms(void)
if (g_reduced_service)
return;
#ifdef ENABLE_AIRCOPY
if (g_screen_to_display == DISPLAY_AIRCOPY)
{ // we're in AIRCOPY mode
if (g_aircopy_state == AIRCOPY_TX)
AIRCOPY_process_fsk_tx_10ms();
AIRCOPY_process_fsk_rx_10ms();
APP_check_keys();
if (g_update_display)
GUI_DisplayScreen();
if (g_update_status)
UI_DisplayStatus(false);
return;
}
#endif
#ifdef ENABLE_AM_FIX
// if (g_eeprom.vfo_info[g_eeprom.rx_vfo].am_mode && g_setting_am_fix)
if (g_rx_vfo->am_mode && g_setting_am_fix)
{
AM_fix_10ms(g_eeprom.rx_vfo);
}
#endif
if (g_current_function != FUNCTION_POWER_SAVE || !g_rx_idle_mode)
APP_process_radio_interrupts();
@ -1750,7 +1747,7 @@ void APP_time_slice_10ms(void)
// Skipping authentic device checks
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0)
if (g_fm_radio_mode && g_fm_radio_tick_500ms > 0)
return;
#endif
@ -1833,9 +1830,9 @@ void APP_time_slice_10ms(void)
}
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode && g_fm_restore_count_down_10ms > 0)
if (g_fm_radio_mode && g_fm_restore_tick_10ms > 0)
{
if (--g_fm_restore_count_down_10ms == 0)
if (--g_fm_restore_tick_10ms == 0)
{ // switch back to FM radio mode
FM_Start();
GUI_SelectNextDisplay(DISPLAY_FM);
@ -1843,7 +1840,7 @@ void APP_time_slice_10ms(void)
}
#endif
if (g_screen_to_display == DISPLAY_SEARCH)
if (g_current_display_screen == DISPLAY_SEARCH)
{
uint32_t Result;
int32_t Delta;
@ -2102,7 +2099,7 @@ void APP_time_slice_500ms(void)
// Skipped authentic device check
if (g_serial_config_count_down_500ms > 0)
if (g_serial_config_tick_500ms > 0)
{ // config upload/download is running
return;
}
@ -2152,7 +2149,7 @@ void APP_time_slice_500ms(void)
if (g_menu_count_down > 0)
if (--g_menu_count_down == 0)
exit_menu = (g_screen_to_display == DISPLAY_MENU); // exit menu mode
exit_menu = (g_current_display_screen == DISPLAY_MENU); // exit menu mode
if (g_dtmf_rx_timeout > 0)
if (--g_dtmf_rx_timeout == 0)
@ -2161,9 +2158,9 @@ void APP_time_slice_500ms(void)
// Skipped authentic device check
#ifdef ENABLE_FMRADIO
if (g_fm_radio_count_down_500ms > 0)
if (g_fm_radio_tick_500ms > 0)
{
g_fm_radio_count_down_500ms--;
g_fm_radio_tick_500ms--;
if (g_fm_radio_mode) // 1of11
return;
}
@ -2172,9 +2169,9 @@ void APP_time_slice_500ms(void)
if (g_backlight_count_down > 0 &&
!g_ask_to_save &&
g_css_scan_mode == CSS_SCAN_MODE_OFF &&
g_screen_to_display != DISPLAY_AIRCOPY)
g_current_display_screen != DISPLAY_AIRCOPY)
{
if (g_screen_to_display != DISPLAY_MENU || g_menu_cursor != MENU_AUTO_BACKLITE) // don't turn off backlight if user is in backlight menu option
if (g_current_display_screen != DISPLAY_MENU || g_menu_cursor != MENU_AUTO_BACKLITE) // don't turn off backlight if user is in backlight menu option
if (--g_backlight_count_down == 0)
if (g_eeprom.backlight < (ARRAY_SIZE(g_sub_menu_backlight) - 1))
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
@ -2224,12 +2221,12 @@ void APP_time_slice_500ms(void)
#endif
{
#ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_AIRCOPY)
if (g_current_display_screen != DISPLAY_AIRCOPY)
#endif
{
if (g_css_scan_mode == CSS_SCAN_MODE_OFF &&
g_scan_state_dir == SCAN_STATE_DIR_OFF &&
(g_screen_to_display != DISPLAY_SEARCH ||
(g_current_display_screen != DISPLAY_SEARCH ||
g_search_css_state == SEARCH_CSS_STATE_FOUND ||
g_search_css_state == SEARCH_CSS_STATE_FAILED ||
g_search_css_state == SEARCH_CSS_STATE_REPEAT))
@ -2237,12 +2234,12 @@ void APP_time_slice_500ms(void)
#ifdef ENABLE_KEYLOCK
if (g_eeprom.auto_keypad_lock &&
g_key_lock_count_down_500ms > 0 &&
g_key_lock_tick_500ms > 0 &&
!g_dtmf_input_mode &&
g_input_box_index == 0 &&
g_screen_to_display != DISPLAY_MENU)
g_current_display_screen != DISPLAY_MENU)
{
if (--g_key_lock_count_down_500ms == 0)
if (--g_key_lock_tick_500ms == 0)
{ // lock the keyboard
g_eeprom.key_lock = true;
g_update_status = true;
@ -2263,7 +2260,7 @@ void APP_time_slice_500ms(void)
if (g_input_box_index > 0 || g_dtmf_input_mode)
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
/*
if (g_screen_to_display == DISPLAY_SEARCH)
if (g_current_display_screen == DISPLAY_SEARCH)
{
BK4819_StopScan();
@ -2300,7 +2297,7 @@ void APP_time_slice_500ms(void)
if (disp == DISPLAY_INVALID)
{
#ifndef ENABLE_CODE_SEARCH_TIMEOUT
if (g_screen_to_display != DISPLAY_SEARCH)
if (g_current_display_screen != DISPLAY_SEARCH)
#endif
disp = DISPLAY_MAIN;
}
@ -2317,9 +2314,9 @@ void APP_time_slice_500ms(void)
APP_update_rssi(g_eeprom.rx_vfo);
#ifdef ENABLE_FMRADIO
if (!g_ptt_is_pressed && g_fm_resume_count_down_500ms > 0)
if (!g_ptt_is_pressed && g_fm_resume_tick_500ms > 0)
{
if (--g_fm_resume_count_down_500ms == 0)
if (--g_fm_resume_tick_500ms == 0)
{
RADIO_Setg_vfo_state(VFO_STATE_NORMAL);
@ -2388,9 +2385,9 @@ void APP_time_slice_500ms(void)
if (g_current_function != FUNCTION_TRANSMIT)
{
if (g_dtmf_decode_ring_count_down_500ms > 0)
if (g_dtmf_decode_ring_tick_500ms > 0)
{ // make "ring-ring" sound
g_dtmf_decode_ring_count_down_500ms--;
g_dtmf_decode_ring_tick_500ms--;
#ifdef ENABLE_DTMF_CALL_FLASH_LIGHT
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); // light on
@ -2404,7 +2401,7 @@ void APP_time_slice_500ms(void)
}
}
else
g_dtmf_decode_ring_count_down_500ms = 0;
g_dtmf_decode_ring_tick_500ms = 0;
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE &&
g_current_function != FUNCTION_TRANSMIT &&
@ -2429,9 +2426,9 @@ void APP_time_slice_500ms(void)
// }
}
if (g_dtmf_is_tx && g_dtmf_tx_stop_count_down_500ms > 0)
if (g_dtmf_is_tx && g_dtmf_tx_stop_tick_500ms > 0)
{
if (--g_dtmf_tx_stop_count_down_500ms == 0)
if (--g_dtmf_tx_stop_tick_500ms == 0)
{
g_dtmf_is_tx = false;
g_update_display = true;
@ -2439,7 +2436,7 @@ void APP_time_slice_500ms(void)
}
#ifdef ENABLE_TX_TIMEOUT_BAR
if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timer_count_down_500ms & 1))
if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timer_tick_500ms & 1))
UI_DisplayTXCountdown(true);
#endif
}
@ -2466,7 +2463,7 @@ void APP_time_slice_500ms(void)
RADIO_setup_registers(true);
if (g_screen_to_display != DISPLAY_MENU) // 1of11 .. don't close the menu
if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu
g_request_display_screen = DISPLAY_MAIN;
}
#endif
@ -2546,12 +2543,12 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
FUNCTION_Select(FUNCTION_FOREGROUND);
// stay awake - for now
g_battery_save_count_down_10ms = battery_save_count_10ms;
g_battery_save_tick_10ms = battery_save_count_10ms;
#ifdef ENABLE_KEYLOCK
// keep the auto keylock at bay
if (g_eeprom.auto_keypad_lock)
g_key_lock_count_down_500ms = key_lock_timeout_500ms;
g_key_lock_tick_500ms = key_lock_timeout_500ms;
#endif
if (g_fkey_pressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2))
@ -2628,12 +2625,12 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
APP_cancel_user_input_modes();
}
if (key_pressed && g_screen_to_display == DISPLAY_MENU)
if (key_pressed && g_current_display_screen == DISPLAY_MENU)
g_menu_count_down = menu_timeout_500ms;
// cancel the ringing
if (key_pressed && g_dtmf_decode_ring_count_down_500ms > 0)
g_dtmf_decode_ring_count_down_500ms = 0;
if (key_pressed && g_dtmf_decode_ring_tick_500ms > 0)
g_dtmf_decode_ring_tick_500ms = 0;
// ********************
@ -2783,7 +2780,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
else
if (Key != KEY_SIDE1 && Key != KEY_SIDE2)
{
switch (g_screen_to_display)
switch (g_current_display_screen)
{
case DISPLAY_MAIN:
MAIN_process_key(Key, key_pressed, key_held);
@ -2816,9 +2813,9 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
}
else
#ifdef ENABLE_AIRCOPY
if (g_screen_to_display != DISPLAY_SEARCH && g_screen_to_display != DISPLAY_AIRCOPY)
if (g_current_display_screen != DISPLAY_SEARCH && g_current_display_screen != DISPLAY_AIRCOPY)
#else
if (g_screen_to_display != DISPLAY_SEARCH)
if (g_current_display_screen != DISPLAY_SEARCH)
#endif
{
ACTION_process(Key, key_pressed, key_held);
@ -2895,7 +2892,7 @@ Skip:
{
SETTINGS_save_channel(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_current_display_screen != DISPLAY_SEARCH)
if (g_vfo_configure_mode == VFO_CONFIGURE_NONE) // don't wipe previous variable setting
g_vfo_configure_mode = VFO_CONFIGURE;
}
@ -2942,10 +2939,10 @@ Skip:
// g_tx_vfo->freq_in_channel = BOARD_find_channel(frequency);
g_dtmf_auto_reset_time_500ms = 0;
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_dtmf_tx_stop_count_down_500ms = 0;
g_dtmf_is_tx = false;
g_dtmf_auto_reset_time_500ms = 0;
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_dtmf_tx_stop_tick_500ms = 0;
g_dtmf_is_tx = false;
g_vfo_rssi_bar_level[0] = 0;
g_vfo_rssi_bar_level[1] = 0;

View File

@ -53,14 +53,14 @@ char g_dtmf_id[4];
char g_dtmf_caller[4];
char g_dtmf_callee[4];
dtmf_state_t g_dtmf_state;
uint8_t g_dtmf_decode_ring_count_down_500ms;
uint8_t g_dtmf_decode_ring_tick_500ms;
uint8_t g_dtmf_chosen_contact;
uint8_t g_dtmf_auto_reset_time_500ms;
dtmf_call_state_t g_dtmf_call_state;
dtmf_reply_state_t g_dtmf_reply_state;
dtmf_call_mode_t g_dtmf_call_mode;
bool g_dtmf_is_tx;
uint8_t g_dtmf_tx_stop_count_down_500ms;
uint8_t g_dtmf_tx_stop_tick_500ms;
bool g_dtmf_IsGroupCall;
void DTMF_clear_RX(void)
@ -367,16 +367,16 @@ void DTMF_HandleRequest(void)
switch (g_eeprom.dtmf_decode_response)
{
case DTMF_DEC_RESPONSE_BOTH:
g_dtmf_decode_ring_count_down_500ms = dtmf_decode_ring_countdown_500ms;
g_dtmf_decode_ring_tick_500ms = dtmf_decode_ring_500ms;
case DTMF_DEC_RESPONSE_REPLY:
g_dtmf_reply_state = DTMF_REPLY_AAAAA;
break;
case DTMF_DEC_RESPONSE_RING:
g_dtmf_decode_ring_count_down_500ms = dtmf_decode_ring_countdown_500ms;
g_dtmf_decode_ring_tick_500ms = dtmf_decode_ring_500ms;
break;
default:
case DTMF_DEC_RESPONSE_NONE:
g_dtmf_decode_ring_count_down_500ms = 0;
g_dtmf_decode_ring_tick_500ms = 0;
g_dtmf_reply_state = DTMF_REPLY_NONE;
break;
}

View File

@ -85,14 +85,14 @@ extern char g_dtmf_id[4];
extern char g_dtmf_caller[4];
extern char g_dtmf_callee[4];
extern dtmf_state_t g_dtmf_state;
extern uint8_t g_dtmf_decode_ring_count_down_500ms;
extern uint8_t g_dtmf_decode_ring_tick_500ms;
extern uint8_t g_dtmf_chosen_contact;
extern uint8_t g_dtmf_auto_reset_time_500ms;
extern dtmf_call_state_t g_dtmf_call_state;
extern dtmf_reply_state_t g_dtmf_reply_state;
extern dtmf_call_mode_t g_dtmf_call_mode;
extern bool g_dtmf_is_tx;
extern uint8_t g_dtmf_tx_stop_count_down_500ms;
extern uint8_t g_dtmf_tx_stop_tick_500ms;
void DTMF_clear_RX(void);
bool DTMF_ValidateCodes(char *pCode, const unsigned int size);

View File

@ -40,15 +40,15 @@
uint16_t g_fm_channels[20];
bool g_fm_radio_mode;
uint8_t g_fm_radio_count_down_500ms;
volatile uint16_t g_fm_play_count_down_10ms;
uint8_t g_fm_radio_tick_500ms;
volatile uint16_t g_fm_play_tick_10ms;
volatile int8_t g_fm_scan_state;
bool g_fm_auto_scan;
uint8_t g_fm_channel_position;
bool g_fm_found_frequency;
bool g_fm_auto_scan;
uint8_t g_fm_resume_count_down_500ms;
uint16_t g_fm_restore_count_down_10ms;
uint8_t g_fm_resume_tick_500ms;
uint16_t g_fm_restore_tick_10ms;
bool FM_CheckValidChannel(uint8_t Channel)
{
@ -100,7 +100,7 @@ void FM_TurnOff(void)
{
g_fm_radio_mode = false;
g_fm_scan_state = FM_SCAN_OFF;
g_fm_restore_count_down_10ms = 0;
g_fm_restore_tick_10ms = 0;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
@ -129,7 +129,7 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool flag)
g_speaker_enabled = false;
g_fm_play_count_down_10ms = (g_fm_scan_state == FM_SCAN_OFF) ? fm_play_countdown_noscan_10ms : fm_play_countdown_scan_10ms;
g_fm_play_tick_10ms = (g_fm_scan_state == FM_SCAN_OFF) ? fm_play_noscan_10ms : fm_play_scan_10ms;
g_schedule_fm = false;
g_fm_found_frequency = false;
@ -168,7 +168,7 @@ void FM_PlayAndUpdate(void)
BK1080_SetFrequency(g_eeprom.fm_frequency_playing);
SETTINGS_save_fm();
g_fm_play_count_down_10ms = 0;
g_fm_play_tick_10ms = 0;
g_schedule_fm = false;
g_ask_to_save = false;
@ -386,14 +386,18 @@ static void FM_Key_STAR(bool key_pressed, bool key_held)
{
g_key_input_count_down = key_input_timeout_500ms;
if (key_held && !key_pressed)
return;
if (!key_held && !key_pressed)
ACTION_Scan(false); // short key press just released .. scan without store
{
ACTION_Scan(false); // short key press just released .. frequency scan without store
}
else
if (key_held && key_pressed)
ACTION_Scan(true); // long key press still pressed .. scan and store
{
ACTION_Scan(true); // long key press still pressed .. frequency scan and store
}
g_fkey_pressed = false;
g_update_status = true;
}
static void FM_Key_EXIT(bool key_pressed, bool key_held)
@ -656,7 +660,7 @@ void FM_Play(void)
{
if (!g_fm_auto_scan)
{
g_fm_play_count_down_10ms = 0;
g_fm_play_tick_10ms = 0;
g_fm_found_frequency = true;
if (!g_eeprom.fm_channel_mode)
@ -692,7 +696,7 @@ void FM_Start(void)
{
g_fm_radio_mode = true;
g_fm_scan_state = FM_SCAN_OFF;
g_fm_restore_count_down_10ms = 0;
g_fm_restore_tick_10ms = 0;
BK1080_Init(g_eeprom.fm_frequency_playing, true);

View File

@ -28,8 +28,8 @@ enum {
extern uint16_t g_fm_channels[20];
extern bool g_fm_radio_mode;
extern uint8_t g_fm_radio_count_down_500ms;
extern volatile uint16_t g_fm_play_count_down_10ms;
extern uint8_t g_fm_radio_tick_500ms;
extern volatile uint16_t g_fm_play_tick_10ms;
extern volatile int8_t g_fm_scan_state;
extern bool g_fm_auto_scan;
extern uint8_t g_fm_channel_position;
@ -37,8 +37,8 @@ extern uint8_t g_fm_channel_position;
extern uint16_t g_fm_frequency_deviation;
extern bool g_fm_found_frequency;
extern bool g_fm_auto_scan;
extern uint8_t g_fm_resume_count_down_500ms;
extern uint16_t g_fm_restore_count_down_10ms;
extern uint8_t g_fm_resume_tick_500ms;
extern uint16_t g_fm_restore_tick_10ms;
bool FM_CheckValidChannel(uint8_t Channel);
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction);

View File

@ -54,7 +54,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
{ // f-key held
#ifdef ENABLE_KEYLOCK
if (key_pressed && g_screen_to_display != DISPLAY_MENU && g_current_function != FUNCTION_TRANSMIT)
if (key_pressed && g_current_display_screen != DISPLAY_MENU && g_current_function != FUNCTION_TRANSMIT)
{ // toggle the keyboad lock
#ifdef ENABLE_VOICE
@ -101,7 +101,7 @@ void GENERIC_Key_PTT(bool key_pressed)
{
g_input_box_index = 0;
if (!key_pressed || g_serial_config_count_down_500ms > 0)
if (!key_pressed || g_serial_config_tick_500ms > 0)
{ // PTT released
if (g_current_function == FUNCTION_TRANSMIT)
@ -129,7 +129,7 @@ void GENERIC_Key_PTT(bool key_pressed)
RADIO_Setg_vfo_state(VFO_STATE_NORMAL);
if (g_screen_to_display != DISPLAY_MENU) // 1of11 .. don't close the menu
if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu
g_request_display_screen = DISPLAY_MAIN;
}
@ -143,11 +143,11 @@ void GENERIC_Key_PTT(bool key_pressed)
#endif
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || // freq/chan scanning
g_screen_to_display == DISPLAY_SEARCH || // CTCSS/CDCSS scanning
g_current_display_screen == DISPLAY_SEARCH || // CTCSS/CDCSS scanning
g_css_scan_mode != CSS_SCAN_MODE_OFF) // " "
{ // we're scanning .. stop
if (g_screen_to_display == DISPLAY_SEARCH)
if (g_current_display_screen == DISPLAY_SEARCH)
{ // CTCSS/CDCSS scanning .. stop
g_eeprom.cross_vfo_rx_tx = g_backup_cross_vfo_rx_tx;
g_search_flag_stop_scan = true;
@ -184,7 +184,7 @@ void GENERIC_Key_PTT(bool key_pressed)
goto cancel_tx;
}
if (g_screen_to_display == DISPLAY_FM)
if (g_current_display_screen == DISPLAY_FM)
goto start_tx; // listening to the FM radio .. start TX'ing
#endif
@ -194,7 +194,7 @@ void GENERIC_Key_PTT(bool key_pressed)
return;
}
if (g_screen_to_display != DISPLAY_MENU) // 1of11 .. don't close the menu
if (g_current_display_screen != DISPLAY_MENU) // 1of11 .. don't close the menu
g_request_display_screen = DISPLAY_MAIN;
if (!g_dtmf_input_mode && g_dtmf_input_box_index == 0)
@ -247,7 +247,7 @@ cancel_tx:
done:
g_ptt_debounce = 0;
if (g_screen_to_display != DISPLAY_MENU && g_request_display_screen != DISPLAY_FM) // 1of11 .. don't close the menu
if (g_current_display_screen != DISPLAY_MENU && g_request_display_screen != DISPLAY_FM) // 1of11 .. don't close the menu
g_request_display_screen = DISPLAY_MAIN;
g_update_status = true;
g_update_display = true;

View File

@ -65,7 +65,7 @@ void toggle_chan_scanlist(void)
return;
}
if (g_screen_to_display != DISPLAY_MAIN ||
if (g_current_display_screen != DISPLAY_MAIN ||
g_current_function == FUNCTION_TRANSMIT ||
g_current_function == FUNCTION_PANADAPTER)
{
@ -157,7 +157,7 @@ void toggle_chan_scanlist(void)
break;
}
g_screen_to_display = DISPLAY_INVALID;
g_current_display_screen = DISPLAY_INVALID;
GUI_SelectNextDisplay(DISPLAY_MENU);
g_menu_cursor = MENU_MEM_SAVE;
g_in_sub_menu = true;
@ -169,7 +169,7 @@ void toggle_chan_scanlist(void)
g_sub_menu_selection = chan;
g_flag_refresh_menu = false;
g_screen_to_display = DISPLAY_MENU;
g_current_display_screen = DISPLAY_MENU;
g_update_display = false;
UI_DisplayMenu();
}
@ -188,7 +188,7 @@ void processFKeyFunction(const key_code_t Key)
uint8_t Band;
uint8_t Vfo = g_eeprom.tx_vfo;
if (g_current_function == FUNCTION_TRANSMIT || g_screen_to_display == DISPLAY_MENU)
if (g_current_function == FUNCTION_TRANSMIT || g_current_display_screen == DISPLAY_MENU)
{
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
@ -424,7 +424,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
if (key_pressed)
{ // and pressed
if (g_screen_to_display == DISPLAY_MAIN)
if (g_current_display_screen == DISPLAY_MAIN)
{
if (g_input_box_index > 0)
{ // clear the user box
@ -697,7 +697,7 @@ void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
g_fkey_pressed = false;
if (g_screen_to_display == DISPLAY_MAIN)
if (g_current_display_screen == DISPLAY_MAIN)
{
if (g_input_box_index > 0)
{ // delete any inputted chars

View File

@ -630,7 +630,7 @@ void MENU_AcceptSetting(void)
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK:
g_eeprom.auto_keypad_lock = g_sub_menu_selection;
g_key_lock_count_down_500ms = key_lock_timeout_500ms;
g_key_lock_tick_500ms = key_lock_timeout_500ms;
break;
#endif
@ -2013,7 +2013,7 @@ void MENU_process_key(key_code_t Key, bool key_pressed, bool key_held)
break;
}
if (g_screen_to_display == DISPLAY_MENU)
if (g_current_display_screen == DISPLAY_MENU)
{
if (g_menu_cursor == MENU_VOLTAGE ||
#ifdef ENABLE_F_CAL_MENU

View File

@ -247,7 +247,7 @@ static void cmd_0514(const uint8_t *pBuffer)
time_stamp = pCmd->time_stamp;
g_serial_config_count_down_500ms = serial_config_count_down_500ms;
g_serial_config_tick_500ms = serial_config_tick_500ms;
// show message
g_request_display_screen = DISPLAY_MAIN;
@ -268,7 +268,7 @@ static void cmd_051B(const uint8_t *pBuffer)
// if (pCmd->time_stamp != time_stamp)
// return;
g_serial_config_count_down_500ms = serial_config_count_down_500ms;
g_serial_config_tick_500ms = serial_config_tick_500ms;
if (addr >= EEPROM_SIZE)
return;
@ -312,7 +312,7 @@ static void cmd_051D(const uint8_t *pBuffer)
// if (pCmd->time_stamp != time_stamp)
// return;
g_serial_config_count_down_500ms = serial_config_count_down_500ms;
g_serial_config_tick_500ms = serial_config_tick_500ms;
if (addr >= EEPROM_SIZE)
return;
@ -418,7 +418,7 @@ static void cmd_052D(const uint8_t *pBuffer)
uint32_t response[4];
reply_052D_t reply;
g_serial_config_count_down_500ms = serial_config_count_down_500ms;
g_serial_config_tick_500ms = serial_config_tick_500ms;
if (!locked)
{
@ -472,7 +472,7 @@ static void cmd_052F(const uint8_t *pBuffer)
g_eeprom.vfo_info[0].dtmf_ptt_id_tx_mode = PTT_ID_OFF;
g_eeprom.vfo_info[0].dtmf_decoding_enable = false;
g_serial_config_count_down_500ms = serial_config_count_down_500ms;
g_serial_config_tick_500ms = serial_config_tick_500ms;
#ifdef ENABLE_NOAA
g_is_noaa_mode = false;