0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21: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)
{ // 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();

View File

@ -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)
{

View File

@ -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

413
app/app.c

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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);

View File

@ -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)

View File

@ -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;
}

View File

@ -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

View File

@ -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)
{

View File

@ -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

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;
}
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;

View File

@ -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

View File

@ -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);

View File

@ -729,9 +729,9 @@ void BOARD_EEPROM_load(void)
g_setting_freq_lock = (Data[0] < 6) ? Data[0] : FREQ_LOCK_NORMAL;
#endif
g_setting_350_tx_enable = (Data[1] < 2) ? Data[1] : false; // was true
g_setting_killed = (Data[2] < 2) ? Data[2] : false;
g_setting_200_tx_enable = (Data[3] < 2) ? Data[3] : false;
g_setting_500_tx_enable = (Data[4] < 2) ? Data[4] : false;
g_setting_radio_disabled = (Data[2] < 2) ? Data[2] : false;
g_setting_174_tx_enable = (Data[3] < 2) ? Data[3] : false;
g_setting_470_tx_enable = (Data[4] < 2) ? Data[4] : false;
g_setting_350_enable = (Data[5] < 2) ? Data[5] : true;
g_setting_scramble_enable = (Data[6] < 2) ? Data[6] : true;
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));
}
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_39, (Frequency >> 16) & 0xFFFF);
BK4819_WriteRegister(BK4819_REG_38, (frequency >> 0) & 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(
@ -1583,7 +1603,7 @@ void BK4819_EnableFrequencyScan(void)
void BK4819_SetScanFrequency(uint32_t Frequency)
{
BK4819_SetFrequency(Frequency);
BK4819_set_rf_frequency(Frequency, false);
// 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_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_SetFrequency(uint32_t Frequency);
void BK4819_set_rf_frequency(const uint32_t frequency, const bool trigger_update);
void BK4819_SetupSquelch(
uint8_t SquelchOpenRSSIThresh,
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)
return 0;
if (Frequency >= 17400000 && Frequency < 35000000)
if (g_setting_200_tx_enable)
if (g_setting_174_tx_enable)
return 0;
if (Frequency >= 35000000 && Frequency < 40000000)
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)
return 0;
if (Frequency >= 47000000 && Frequency <= 60000000)
if (g_setting_500_tx_enable)
if (g_setting_470_tx_enable)
return 0;
break;

View File

@ -43,18 +43,14 @@ function_type_t g_current_function;
void FUNCTION_Init(void)
{
#ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
#endif
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
{
g_current_code_type = g_selected_code_type;
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;
}
#ifdef ENABLE_NOAA
else
g_current_code_type = CODE_TYPE_CONTINUOUS_TONE;
#endif
else
g_current_code_type = CODE_TYPE_CONTINUOUS_TONE;
DTMF_clear_RX();

10
main.c
View File

@ -95,9 +95,9 @@ void Main(void)
RADIO_ConfigureChannel(0, 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++)
BOARD_ADC_GetBatteryInfo(&g_battery_voltages[i], &g_usb_current);
@ -216,17 +216,17 @@ void Main(void)
while (1)
{
APP_Update();
APP_process();
if (g_next_time_slice)
{
APP_TimeSlice10ms();
APP_time_slice_10ms();
g_next_time_slice = false;
}
if (g_next_time_slice_500ms)
{
APP_TimeSlice500ms();
APP_time_slice_500ms();
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_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 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};
bool g_setting_350_tx_enable;
bool g_setting_killed;
bool g_setting_200_tx_enable;
bool g_setting_500_tx_enable;
bool g_setting_radio_disabled;
bool g_setting_174_tx_enable;
bool g_setting_470_tx_enable;
bool g_setting_350_enable;
bool g_setting_tx_enable;
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 bool g_dual_watch_count_down_expired = true;
bool g_dual_watch_active;
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;
uint16_t g_low_batteryCountdown;
reception_mode_t g_rx_reception_mode;
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 bool g_setting_350_tx_enable;
extern bool g_setting_killed;
extern bool g_setting_200_tx_enable;
extern bool g_setting_500_tx_enable;
extern bool g_setting_radio_disabled;
extern bool g_setting_174_tx_enable;
extern bool g_setting_470_tx_enable;
extern bool g_setting_350_enable;
extern bool g_setting_tx_enable;
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 bool g_dual_watch_count_down_expired;
extern bool g_dual_watch_active;
extern volatile uint8_t g_serial_config_count_down_500ms;

147
radio.c
View File

@ -165,12 +165,9 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (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)
return;
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
g_update_status = true;
return;
}
@ -245,7 +242,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
uint8_t Tmp;
uint8_t Data[8];
// t_channel channel;
// EEPROM_ReadBuffer(Base, channel, sizeof(channel));
// ***************
@ -517,7 +514,7 @@ void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo)
// my calibration data
//
// 1ED0 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 50 MHz
// 1ED0 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 50 MHz
// 1EE0 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 108 MHz
// 1EF0 5F 5F 5F 69 69 69 91 91 8F FF FF FF FF FF FF FF .. 136 MHz
// 1F00 32 32 32 64 64 64 8C 8C 8C FF FF FF FF FF FF FF .. 174 MHz
@ -545,7 +542,7 @@ void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo)
TX_power[2] /= 3;
}
#endif
pInfo->txp_calculated_setting = FREQUENCY_CalculateOutputPower(
TX_power[0],
TX_power[1],
@ -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];
}
void RADIO_SelectVfos(void)
void RADIO_select_vfos(void)
{
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;
@ -599,11 +596,11 @@ void RADIO_SelectVfos(void)
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;
uint16_t InterruptMask;
uint32_t Frequency;
uint16_t interrupt_mask;
uint32_t Frequency;
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); // ???
while (1)
{ // wait for the interrupt to clear ???
{ // wait for the interrupt to clear ?
const uint16_t status_bits = BK4819_ReadRegister(BK4819_REG_0C);
if ((status_bits & (1u << 0)) == 0)
break;
@ -644,20 +641,18 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
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
BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (g_eeprom.mic_sensitivity_tuning & 0x1f));
#ifdef ENABLE_NOAA
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save) || !g_is_noaa_mode)
Frequency = g_rx_vfo->p_rx->frequency;
else
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_is_noaa_mode)
Frequency = NOAA_FREQUENCY_TABLE[g_noaa_channel];
#else
Frequency = g_rx_vfo->p_rx->frequency;
else
#endif
BK4819_SetFrequency(Frequency);
Frequency = g_rx_vfo->p_rx->frequency;
BK4819_set_rf_frequency(Frequency, false);
BK4819_SetupSquelch(
g_rx_vfo->squelch_open_rssi_thresh, g_rx_vfo->squelch_close_rssi_thresh,
@ -672,20 +667,19 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
// AF RX Gain and DAC
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))
#endif
if (IS_NOT_NOAA_CHANNEL(g_rx_vfo->channel_save))
{
if (g_rx_vfo->am_mode == 0)
{ // FM
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)
{
code_type = g_rx_vfo->p_rx->code_type;
Code = g_rx_vfo->p_rx->code;
Code = g_rx_vfo->p_rx->code;
}
switch (code_type)
@ -700,7 +694,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
// BK4819_SetTailDetection(670); // 67Hz
//#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;
case CODE_TYPE_CONTINUOUS_TONE:
@ -712,24 +706,24 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
// BK4819_SetTailDetection(CTCSS_OPTIONS[Code]);
//#endif
InterruptMask = 0
| BK4819_REG_3F_CxCSS_TAIL
| BK4819_REG_3F_CTCSS_FOUND
| BK4819_REG_3F_CTCSS_LOST
| BK4819_REG_3F_SQUELCH_FOUND
| BK4819_REG_3F_SQUELCH_LOST;
interrupt_mask =
BK4819_REG_3F_CxCSS_TAIL |
BK4819_REG_3F_CTCSS_FOUND |
BK4819_REG_3F_CTCSS_LOST |
BK4819_REG_3F_SQUELCH_FOUND |
BK4819_REG_3F_SQUELCH_LOST;
break;
case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL:
BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(code_type, Code));
InterruptMask = 0
| BK4819_REG_3F_CxCSS_TAIL
| BK4819_REG_3F_CDCSS_FOUND
| BK4819_REG_3F_CDCSS_LOST
| BK4819_REG_3F_SQUELCH_FOUND
| BK4819_REG_3F_SQUELCH_LOST;
interrupt_mask =
BK4819_REG_3F_CxCSS_TAIL |
BK4819_REG_3F_CDCSS_FOUND |
BK4819_REG_3F_CDCSS_LOST |
BK4819_REG_3F_SQUELCH_FOUND |
BK4819_REG_3F_SQUELCH_LOST;
break;
}
@ -743,55 +737,50 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
else
{
BK4819_SetCTCSSFrequency(2625);
InterruptMask = 0
| BK4819_REG_3F_CTCSS_FOUND
| BK4819_REG_3F_CTCSS_LOST
| BK4819_REG_3F_SQUELCH_FOUND
| BK4819_REG_3F_SQUELCH_LOST;
interrupt_mask =
BK4819_REG_3F_CTCSS_FOUND |
BK4819_REG_3F_CTCSS_LOST |
BK4819_REG_3F_SQUELCH_FOUND |
BK4819_REG_3F_SQUELCH_LOST;
}
#endif
#ifdef ENABLE_VOX
#ifdef ENABLE_NOAA
if (
#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)
#else
if (g_eeprom.vox_switch && IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) && g_current_vfo->am_mode == 0)
!g_fm_radio_mode &&
#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
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);
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
interrupt_mask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
}
else
#endif
BK4819_DisableVox();
BK4819_DisableVox();
// RX expander
BK4819_SetCompander((g_rx_vfo->am_mode == 0 && g_rx_vfo->compander >= 2) ? g_rx_vfo->compander : 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();
}
else
{
BK4819_EnableDTMF();
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
interrupt_mask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
}
#else
if (g_current_function != FUNCTION_TRANSMIT)
{
BK4819_DisableDTMF();
BK4819_EnableDTMF();
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
interrupt_mask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
}
else
{
@ -800,11 +789,11 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
#endif
// enable/disable BK4819 selected interrupts
BK4819_WriteRegister(BK4819_REG_3F, InterruptMask);
BK4819_WriteRegister(BK4819_REG_3F, interrupt_mask);
FUNCTION_Init();
if (bSwitchToFunction0)
if (switch_to_function_0)
FUNCTION_Select(FUNCTION_FOREGROUND);
}
@ -883,7 +872,7 @@ void RADIO_enableTX(const bool fsk_tx)
#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_PrepareTransmit();
BK4819_PickRXFilterPathBasedOnFrequency(g_current_vfo->p_tx->frequency);
@ -906,11 +895,11 @@ void RADIO_enableTX(const bool fsk_tx)
case CODE_TYPE_NONE:
BK4819_ExitSubAu();
break;
case CODE_TYPE_CONTINUOUS_TONE:
BK4819_SetCTCSSFrequency(CTCSS_OPTIONS[g_current_vfo->p_tx->code]);
break;
case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL:
BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(g_current_vfo->p_tx->code_type, g_current_vfo->p_tx->code));
@ -959,29 +948,27 @@ void RADIO_PrepareTX(void)
{ // dual-RX is enabled
g_dual_watch_count_down_10ms = dual_watch_count_after_tx_10ms;
g_schedule_dual_watch = false;
g_schedule_dual_watch = false;
#if 0
if (g_rx_vfo_is_active)
{ // use the TX vfo
g_eeprom.rx_vfo = g_eeprom.tx_vfo;
g_rx_vfo = &g_eeprom.vfo_info[g_eeprom.tx_vfo];
g_eeprom.rx_vfo = g_eeprom.tx_vfo;
g_rx_vfo = &g_eeprom.vfo_info[g_eeprom.tx_vfo];
g_rx_vfo_is_active = false;
}
g_current_vfo = g_rx_vfo;
#else
if (!g_rx_vfo_is_active)
{ // use the current RX vfo
g_eeprom.rx_vfo = g_eeprom.tx_vfo;
g_rx_vfo = &g_eeprom.vfo_info[g_eeprom.tx_vfo];
g_eeprom.rx_vfo = g_eeprom.tx_vfo;
g_rx_vfo = &g_eeprom.vfo_info[g_eeprom.tx_vfo];
g_rx_vfo_is_active = true;
}
g_current_vfo = g_rx_vfo;
#endif
// let the user see that DW is not active '><' symbol
g_dual_watch_active = false;
g_update_status = true;
g_update_status = true;
}
RADIO_SelectCurrentVfo();
@ -1033,8 +1020,8 @@ void RADIO_PrepareTX(void)
{
if (g_dtmf_call_mode == DTMF_CALL_MODE_DTMF)
{
g_dtmf_is_tx = true;
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_dtmf_is_tx = true;
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
g_dtmf_tx_stop_count_down_500ms = dtmf_txstop_countdown_500ms;
}
else
@ -1046,7 +1033,7 @@ void RADIO_PrepareTX(void)
FUNCTION_Select(FUNCTION_TRANSMIT);
g_tx_timer_count_down_500ms = 0; // no timeout
g_tx_timer_count_down_500ms = 0; // no timeout
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
if (g_alarm_state == ALARM_STATE_OFF)
@ -1060,11 +1047,11 @@ void RADIO_PrepareTX(void)
else
g_tx_timer_count_down_500ms = 120 * 15; // 15 minutes
}
g_tx_timeout_reached = false;
g_flag_end_tx = false;
g_rtte_count_down = 0;
g_dtmf_reply_state = DTMF_REPLY_NONE;
g_tx_timeout_reached = false;
g_flag_end_tx = false;
g_rtte_count_down = 0;
g_dtmf_reply_state = DTMF_REPLY_NONE;
}
void RADIO_EnableCxCSS(void)
@ -1095,7 +1082,7 @@ void RADIO_PrepareCssTX(void)
SYSTEM_DelayMs(200);
RADIO_EnableCxCSS();
RADIO_SetupRegisters(true);
RADIO_setup_registers(true);
}
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_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo);
void RADIO_ApplyOffset(vfo_info_t *pInfo);
void RADIO_SelectVfos(void);
void RADIO_SetupRegisters(bool bSwitchToFunction0);
void RADIO_select_vfos(void);
void RADIO_setup_registers(bool switch_to_function_0);
#ifdef ENABLE_NOAA
void RADIO_ConfigureNOAA(void);
#endif

View File

@ -310,9 +310,9 @@ void SETTINGS_SaveSettings(void)
memset(State, 0xFF, sizeof(State));
State[0] = g_setting_freq_lock;
State[1] = g_setting_350_tx_enable;
State[2] = g_setting_killed;
State[3] = g_setting_200_tx_enable;
State[4] = g_setting_500_tx_enable;
State[2] = g_setting_radio_disabled;
State[3] = g_setting_174_tx_enable;
State[4] = g_setting_470_tx_enable;
State[5] = g_setting_350_enable;
State[6] = g_setting_scramble_enable;
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;
uint8_t State[8];
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(Channel))
return;
#endif
if (IS_NOAA_CHANNEL(Channel))
return;
if (IS_FREQ_CHANNEL(Channel))
{ // 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);
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
// clear/reset the channel name
memset(&State, 0x00, sizeof(State));
memset(&State, 0, sizeof(State));
EEPROM_WriteBuffer(0x0F50 + OffsetMR, State);
EEPROM_WriteBuffer(0x0F58 + OffsetMR, State);
#else
@ -386,7 +384,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const vfo_info_t *pVFO,
{ // save the channel name
memmove(State, pVFO->name + 0, 8);
EEPROM_WriteBuffer(0x0F50 + OffsetMR, State);
memset(State, 0x00, sizeof(State));
memset(State, 0, sizeof(State));
memmove(State, pVFO->name + 8, 2);
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
uint16_t Offset = 0x0D60 + (Channel & ~7u);
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(Channel))
return;
#endif
if (IS_NOAA_CHANNEL(Channel))
return;
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);
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;
@ -423,13 +419,12 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const vfo_info_t *pVFO, bool keep)
// #ifndef ENABLE_KEEP_MEM_NAME
if (Channel <= USER_CHANNEL_LAST)
{ // it's a memory channel
{ // user memory channel
const uint16_t OffsetMR = Channel * 16;
if (!keep)
{ // clear/reset the channel name
//memset(&State, 0xFF, sizeof(State));
memset(&State, 0x00, sizeof(State)); // follow the QS way
memset(&State, 0, sizeof(State));
EEPROM_WriteBuffer(0x0F50 + 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
// memmove(State, pVFO->name + 0, 8);
// EEPROM_WriteBuffer(0x0F50 + OffsetMR, State);
// //memset(State, 0xFF, sizeof(State));
// memset(State, 0x00, sizeof(State)); // follow the QS way
// memset(State, 0, sizeof(State));
// memmove(State, pVFO->name + 8, 2);
// EEPROM_WriteBuffer(0x0F58 + OffsetMR, State);
// }

View File

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

View File

@ -283,7 +283,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
}
#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
@ -809,7 +809,7 @@ void UI_DisplayMain(void)
}
// 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);
// show the audio scramble symbol

View File

@ -37,7 +37,7 @@ extern center_line_t center_line;
#ifdef ENABLE_AUDIO_BAR
bool UI_DisplayAudioBar(const bool now);
#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);
#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
{"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 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"
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"Tx EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
@ -752,10 +752,23 @@ void UI_DisplayMenu(void)
#endif
case MENU_350TX:
case MENU_200TX:
case MENU_500TX:
strcpy(String, "350 ~ 400\n");
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:
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;
case MENU_SCREN:

View File

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

View File

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