0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-27 13:51:25 +03:00

added DTMF live decoder makefile option

This commit is contained in:
OneOfEleven 2023-11-25 11:15:24 +00:00
parent 1d9cdeecf5
commit 010721deac
19 changed files with 280 additions and 187 deletions

View File

@ -39,6 +39,7 @@ ENABLE_MDC1200_SIDE_BEEP := 1
ENABLE_PWRON_PASSWORD := 0
ENABLE_RESET_AES_KEY := 0
ENABLE_BIG_FREQ := 0
ENABLE_DTMF_LIVE_DECODER := 0
ENABLE_SHOW_FREQS_CHAN := 0
# smaa bolf 580 B
ENABLE_SMALL_BOLD := 1
@ -327,6 +328,9 @@ endif
ifeq ($(ENABLE_BIG_FREQ),1)
CFLAGS += -DENABLE_BIG_FREQ
endif
ifeq ($(ENABLE_DTMF_LIVE_DECODER),1)
CFLAGS += -DENABLE_DTMF_LIVE_DECODER
endif
ifeq ($(ENABLE_SHOW_FREQS_CHAN),1)
CFLAGS += -DENABLE_SHOW_FREQS_CHAN
endif

View File

@ -64,6 +64,7 @@ ENABLE_MDC1200_SIDE_BEEP := 1 enable short side tone/beep when MDC
ENABLE_PWRON_PASSWORD := 0 include power-on password code
ENABLE_RESET_AES_KEY := 1 '1' = reset/clear the AES key stored in the eeprom (only if it's set)
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
ENABLE_DTMF_LIVE_DECODER := 0 enable the live DTMF display/decoder .. adds a menu option
ENABLE_SHOW_FREQS_CHAN := 1 show the channel name under the frequency if the frequency is found in a channel
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
ENABLE_TRIM_TRAILING_ZEROS := 1 trim away any trailing zeros on frequencies

View File

@ -209,8 +209,10 @@ void ACTION_Scan(bool bRestart)
DTMF_clear_RX();
g_dtmf_rx_live_timeout = 0;
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
#ifdef ENABLE_DTMF_LIVE_DECODER
g_dtmf_rx_live_timeout = 0;
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
#endif
RADIO_select_vfos();

155
app/app.c
View File

@ -986,19 +986,21 @@ void APP_process_radio_interrupts(void)
const char c = DTMF_GetCharacter(BK4819_GetDTMF_5TONE_Code());
if (c != 0xff && g_current_function != FUNCTION_TRANSMIT)
{
if (g_eeprom.config.setting.dtmf_live_decoder)
{
size_t len = strlen(g_dtmf_rx_live);
if (len >= (sizeof(g_dtmf_rx_live) - 1))
{ // make room
memmove(&g_dtmf_rx_live[0], &g_dtmf_rx_live[1], sizeof(g_dtmf_rx_live) - 1);
len--;
#ifdef ENABLE_DTMF_LIVE_DECODER
if (g_eeprom.config.setting.dtmf_live_decoder)
{
size_t len = strlen(g_dtmf_rx_live);
if (len >= (sizeof(g_dtmf_rx_live) - 1))
{ // make room
memmove(&g_dtmf_rx_live[0], &g_dtmf_rx_live[1], sizeof(g_dtmf_rx_live) - 1);
len--;
}
g_dtmf_rx_live[len++] = c;
g_dtmf_rx_live[len] = 0;
g_dtmf_rx_live_timeout = dtmf_rx_live_timeout_500ms; // time till we delete it
g_update_display = true;
}
g_dtmf_rx_live[len++] = c;
g_dtmf_rx_live[len] = 0;
g_dtmf_rx_live_timeout = dtmf_rx_live_timeout_500ms; // time till we delete it
g_update_display = true;
}
#endif
#ifdef ENABLE_KILL_REVIVE
if (g_rx_vfo->channel.dtmf_decoding_enable || g_eeprom.config.setting.radio_disabled)
@ -1264,9 +1266,14 @@ 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_tick_500ms > 0)
if (g_current_function == FUNCTION_TRANSMIT)
return;
#if defined(ENABLE_UART)
if (g_serial_config_tick_500ms > 0)
return;
#endif
// ************* go into TX mode
g_dtmf_reply_state = DTMF_REPLY_NONE;
@ -1303,25 +1310,31 @@ void APP_process_keys(void)
if (ptt_pressed)
{ // PTT pressed
#ifdef ENABLE_AIRCOPY
if (!g_ptt_is_pressed && g_serial_config_tick_500ms == 0 && g_eeprom.config.setting.tx_enable && g_current_function != FUNCTION_TRANSMIT && g_current_display_screen != DISPLAY_AIRCOPY)
#else
if (!g_ptt_is_pressed && g_serial_config_tick_500ms == 0 && g_eeprom.config.setting.tx_enable && g_current_function != FUNCTION_TRANSMIT)
#endif
if (!g_ptt_is_pressed && g_eeprom.config.setting.tx_enable && g_current_function != FUNCTION_TRANSMIT)
{
#ifdef ENABLE_KILL_REVIVE
if (!g_eeprom.config.setting.radio_disabled)
#endif
#if defined(ENABLE_UART)
if (g_serial_config_tick_500ms == 0)
#endif
{
if (++g_ptt_debounce >= 3) // 30ms debounce
{ // start TX'ing
g_boot_tick_10ms = 0; // cancel the boot-up screen
g_ptt_is_pressed = ptt_pressed;
g_ptt_was_released = false;
g_ptt_debounce = 3;
APP_process_key(KEY_PTT, true, false);
#ifdef ENABLE_AIRCOPY
if (g_current_display_screen != DISPLAY_AIRCOPY)
#endif
{
#ifdef ENABLE_KILL_REVIVE
if (!g_eeprom.config.setting.radio_disabled)
#endif
{
if (++g_ptt_debounce >= 3) // 30ms debounce
{ // start TX'ing
g_boot_tick_10ms = 0; // cancel the boot-up screen
g_ptt_is_pressed = ptt_pressed;
g_ptt_was_released = false;
g_ptt_debounce = 3;
APP_process_key(KEY_PTT, true, false);
}
}
}
}
}
@ -1329,7 +1342,11 @@ void APP_process_keys(void)
else
{ // PTT released
#if defined(ENABLE_UART)
if (g_ptt_is_pressed || g_serial_config_tick_500ms > 0)
#else
if (g_ptt_is_pressed)
#endif
{
// if (g_ptt_debounce > 0)
{
@ -1357,15 +1374,17 @@ void APP_process_keys(void)
// scan the hardware keys
key = KEYBOARD_Poll();
if (g_serial_config_tick_500ms > 0)
{ // config upload/download in progress
g_key_debounce_press = 0;
g_key_debounce_repeat = 0;
g_key_prev = KEY_INVALID;
g_key_held = false;
g_fkey_pressed = false;
return;
}
#if defined(ENABLE_UART)
if (g_serial_config_tick_500ms > 0)
{ // config upload/download in progress
g_key_debounce_press = 0;
g_key_debounce_repeat = 0;
g_key_prev = KEY_INVALID;
g_key_held = false;
g_fkey_pressed = false;
return;
}
#endif
if (key == KEY_INVALID || (g_key_prev != KEY_INVALID && key != g_key_prev))
{ // key not pressed or different key pressed
@ -1974,7 +1993,9 @@ void APP_time_slice_500ms(void)
if (g_beep_to_play != BEEP_NONE)
{
#if defined(ENABLE_UART)
if (g_serial_config_tick_500ms == 0)
#endif
AUDIO_PlayBeep(g_beep_to_play);
g_beep_to_play = BEEP_NONE;
}
@ -1995,10 +2016,10 @@ void APP_time_slice_500ms(void)
if (--g_keypad_locked == 0)
g_update_display = true;
if (g_serial_config_tick_500ms > 0)
{ // config upload/download is running
return;
}
#if defined(ENABLE_UART)
if (g_serial_config_tick_500ms > 0)
return;
#endif
if (g_current_function == FUNCTION_TRANSMIT)
{
@ -2039,23 +2060,25 @@ void APP_time_slice_500ms(void)
}
#endif
if (g_dtmf_rx_live_timeout > 0)
{
#ifdef ENABLE_RX_SIGNAL_BAR
if (g_center_line == CENTER_LINE_DTMF_DEC ||
g_center_line == CENTER_LINE_NONE) // wait till the center line is free for us to use before timing out
#endif
#ifdef ENABLE_DTMF_LIVE_DECODER
if (g_dtmf_rx_live_timeout > 0)
{
if (--g_dtmf_rx_live_timeout == 0)
#ifdef ENABLE_RX_SIGNAL_BAR
if (g_center_line == CENTER_LINE_DTMF_DEC ||
g_center_line == CENTER_LINE_NONE) // wait till the center line is free for us to use before timing out
#endif
{
if (g_dtmf_rx_live[0] != 0)
if (--g_dtmf_rx_live_timeout == 0)
{
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
g_update_display = true;
if (g_dtmf_rx_live[0] != 0)
{
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
g_update_display = true;
}
}
}
}
}
#endif
if (g_menu_tick_10ms > 0)
if (--g_menu_tick_10ms == 0)
@ -2412,7 +2435,11 @@ void APP_time_slice_10ms(void)
}
#endif
#if defined(ENABLE_UART)
if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timeout_reached || g_serial_config_tick_500ms > 0))
#else
if (g_current_function == FUNCTION_TRANSMIT && g_tx_timeout_reached)
#endif
{ // transmitter timed out or must de-key
BK4819_stop_tones(true);
@ -2450,7 +2477,11 @@ void APP_time_slice_10ms(void)
}
#endif
#if defined(ENABLE_UART)
if (g_reduced_service || g_serial_config_tick_500ms > 0)
#else
if (g_reduced_service)
#endif
{
if (g_current_function == FUNCTION_TRANSMIT)
g_tx_timeout_reached = true;
@ -2659,13 +2690,15 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
if (Key == KEY_EXIT && key_held && key_pressed)
{ // exit key held pressed
// clear the live DTMF decoder
if (g_dtmf_rx_live[0] != 0)
{
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
g_dtmf_rx_live_timeout = 0;
g_update_display = true;
}
#ifdef ENABLE_DTMF_LIVE_DECODER
// clear the live DTMF decoder
if (g_dtmf_rx_live[0] != 0)
{
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
g_dtmf_rx_live_timeout = 0;
g_update_display = true;
}
#endif
// cancel user input
APP_cancel_user_input_modes();

View File

@ -46,8 +46,10 @@ uint8_t g_dtmf_rx_index;
uint8_t g_dtmf_rx_timeout;
bool g_dtmf_rx_pending;
char g_dtmf_rx_live[20];
uint8_t g_dtmf_rx_live_timeout;
#ifdef ENABLE_DTMF_LIVE_DECODER
char g_dtmf_rx_live[20];
uint8_t g_dtmf_rx_live_timeout;
#endif
bool g_dtmf_is_contact_valid;
char g_dtmf_id[4];

View File

@ -77,8 +77,10 @@ extern uint8_t g_dtmf_rx_index;
extern uint8_t g_dtmf_rx_timeout;
extern bool g_dtmf_rx_pending;
extern char g_dtmf_rx_live[20];
extern uint8_t g_dtmf_rx_live_timeout;
#ifdef ENABLE_DTMF_LIVE_DECODER
extern char g_dtmf_rx_live[20];
extern uint8_t g_dtmf_rx_live_timeout;
#endif
extern bool g_dtmf_is_contact_valid;
extern char g_dtmf_id[4];

View File

@ -99,7 +99,11 @@ void GENERIC_Key_PTT(bool key_pressed)
{
g_input_box_index = 0;
#if defined(ENABLE_UART)
if (!key_pressed || g_serial_config_tick_500ms > 0)
#else
if (!key_pressed)
#endif
{ // PTT released
if (g_current_function == FUNCTION_TRANSMIT)

View File

@ -264,7 +264,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
case MENU_STE:
case MENU_DTMF_ST:
case MENU_DTMF_DCD:
case MENU_DTMF_LIVE_DEC:
#ifdef ENABLE_DTMF_LIVE_DECODER
case MENU_DTMF_LIVE_DEC:
#endif
*pMin = 0;
*pMax = ARRAY_SIZE(g_sub_menu_off_on) - 1;
break;
@ -771,15 +773,17 @@ void MENU_AcceptSetting(void)
g_request_save_channel = 1;
return;
case MENU_DTMF_LIVE_DEC:
g_eeprom.config.setting.dtmf_live_decoder = g_sub_menu_selection;
g_dtmf_rx_live_timeout = 0;
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
if (!g_eeprom.config.setting.dtmf_live_decoder)
BK4819_DisableDTMF();
g_flag_reconfigure_vfos = true;
g_update_status = true;
break;
#ifdef ENABLE_DTMF_LIVE_DECODER
case MENU_DTMF_LIVE_DEC:
g_eeprom.config.setting.dtmf_live_decoder = g_sub_menu_selection;
g_dtmf_rx_live_timeout = 0;
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
if (!g_eeprom.config.setting.dtmf_live_decoder)
BK4819_DisableDTMF();
g_flag_reconfigure_vfos = true;
g_update_status = true;
break;
#endif
case MENU_DTMF_LIST:
g_dtmf_chosen_contact = g_sub_menu_selection - 1;
@ -1285,9 +1289,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_dtmf_chosen_contact + 1;
break;
case MENU_DTMF_LIVE_DEC:
g_sub_menu_selection = g_eeprom.config.setting.dtmf_live_decoder;
break;
#ifdef ENABLE_DTMF_LIVE_DECODER
case MENU_DTMF_LIVE_DEC:
g_sub_menu_selection = g_eeprom.config.setting.dtmf_live_decoder;
break;
#endif
case MENU_PON_MSG:
g_sub_menu_selection = g_eeprom.config.setting.power_on_display_mode;
@ -1712,7 +1718,7 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
g_edit_index = g_tx_vfo->channel.tx_power_user;
}
else
{
{ // save the new power level
g_tx_vfo->channel.tx_power_user = g_edit_index;
g_request_save_channel = 1;

Binary file not shown.

Binary file not shown.

View File

@ -215,9 +215,11 @@ void FUNCTION_Select(function_type_t Function)
// clear the DTMF RX buffer
DTMF_clear_RX();
// clear the DTMF RX live decoder buffer
g_dtmf_rx_live_timeout = 0;
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
#ifdef ENABLE_DTMF_LIVE_DECODER
// clear the DTMF RX live decoder buffer
g_dtmf_rx_live_timeout = 0;
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
#endif
#ifdef ENABLE_FMRADIO
// disable the FM radio

8
misc.c
View File

@ -33,7 +33,9 @@ const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 min
const uint16_t backlight_tx_rx_time_secs = 10; // 10 seconds
const uint8_t dtmf_rx_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
#ifdef ENABLE_DTMF_LIVE_DECODER
const uint8_t dtmf_rx_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
#endif
const uint8_t dtmf_rx_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
const uint8_t dtmf_decode_ring_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
const uint8_t dtmf_txstop_500ms = 3000 / 500; // 6 seconds
@ -101,7 +103,9 @@ volatile bool g_power_save_expired;
volatile uint16_t g_dual_watch_tick_10ms;
volatile bool g_dual_watch_delay_down_expired = true;
volatile uint8_t g_serial_config_tick_500ms;
#if defined(ENABLE_UART)
volatile uint8_t g_serial_config_tick_500ms;
#endif
volatile bool g_next_time_slice_500ms;

8
misc.h
View File

@ -132,7 +132,9 @@ extern const uint16_t menu_timeout_long_500ms;
extern const uint16_t backlight_tx_rx_time_secs;
extern const uint8_t dtmf_rx_live_timeout_500ms;
#ifdef ENABLE_DTMF_LIVE_DECODER
extern const uint8_t dtmf_rx_live_timeout_500ms;
#endif
extern const uint8_t dtmf_rx_timeout_500ms;
extern const uint8_t dtmf_decode_ring_500ms;
extern const uint8_t dtmf_txstop_500ms;
@ -197,7 +199,9 @@ extern volatile bool g_power_save_expired;
extern volatile uint16_t g_dual_watch_tick_10ms;
extern volatile bool g_dual_watch_delay_down_expired;
extern volatile uint8_t g_serial_config_tick_500ms;
#if defined(ENABLE_UART)
extern volatile uint8_t g_serial_config_tick_500ms;
#endif
extern volatile bool g_next_time_slice_500ms;

View File

@ -139,7 +139,6 @@ void PAN_process_10ms(void)
#endif
// g_single_vfo < 0 ||
g_reduced_service ||
g_monitor_enabled ||
g_current_function == FUNCTION_POWER_SAVE ||
g_current_display_screen == DISPLAY_SEARCH ||
g_css_scan_mode != CSS_SCAN_MODE_OFF ||
@ -156,7 +155,7 @@ void PAN_process_10ms(void)
return;
}
if (g_current_function == FUNCTION_TRANSMIT)
if (g_current_function == FUNCTION_TRANSMIT || g_monitor_enabled)
{
panadapter_rssi_index = -1;
return;

View File

@ -1114,7 +1114,11 @@ void RADIO_PrepareTX(void)
}
else
#endif
if (!g_eeprom.config.setting.tx_enable || g_serial_config_tick_500ms > 0)
#if defined(ENABLE_UART)
if (!g_eeprom.config.setting.tx_enable || g_serial_config_tick_500ms > 0)
#else
if (!g_eeprom.config.setting.tx_enable)
#endif
{ // TX is disabled or config upload/download in progress
State = VFO_STATE_TX_DISABLE;
}

View File

@ -58,7 +58,10 @@ void SystickHandler(void)
g_next_time_slice_500ms = true;
DECREMENT_AND_TRIGGER(g_tx_timer_tick_500ms, g_tx_timeout_reached);
DECREMENT(g_serial_config_tick_500ms);
#if defined(ENABLE_UART)
DECREMENT(g_serial_config_tick_500ms);
#endif
}
if ((g_global_sys_tick_counter & 3) == 0)

197
ui/main.c
View File

@ -53,7 +53,8 @@
const int rssi_offset_band_123 = -44;
const int rssi_offset_band_4567 = -18;
int single_vfo = -1;
int single_vfo = -1;
bool pan_enabled = false;
center_line_t g_center_line = CENTER_LINE_NONE;
@ -395,6 +396,7 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
void UI_DisplayMain_pan(const bool now)
{
const bool valid = (g_panadapter_cycles > 0 && !g_monitor_enabled && g_current_function != FUNCTION_TRANSMIT) ? true : false;
const unsigned int line = (g_eeprom.config.setting.tx_vfo_num == 0) ? 4 : 0;
uint8_t *base_line = g_frame_buffer[line + 2];
uint8_t max_rssi;
@ -404,21 +406,22 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
if (!g_eeprom.config.setting.panadapter ||
!g_panadapter_enabled ||
g_monitor_enabled ||
single_vfo < 0 ||
!pan_enabled ||
g_reduced_service ||
g_current_display_screen != DISPLAY_MAIN ||
g_current_function == FUNCTION_POWER_SAVE ||
// g_current_function == FUNCTION_TRANSMIT ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
// g_dtmf_is_tx ||
g_dtmf_input_mode)
{ // don't draw the panadapter
return;
}
// auto vertical scale
if (g_panadapter_cycles > 0)
// clear our assigned screen area
memset(g_frame_buffer[line], 0, LCD_WIDTH * 3);
if (valid)
{
// auto vertical scale
max_rssi = g_panadapter_max_rssi;
min_rssi = g_panadapter_min_rssi;
span_rssi = max_rssi - min_rssi;
@ -429,60 +432,60 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
min_rssi = 255 - span_rssi;
max_rssi = min_rssi + span_rssi;
}
#ifdef ENABLE_PANADAPTER_PEAK_FREQ
if (g_panadapter_peak_freq > 0)
{ // print the peak frequency
char str[16];
sprintf(str, "%u.%05u", g_panadapter_peak_freq / 100000, g_panadapter_peak_freq % 100000);
NUMBER_trim_trailing_zeros(str);
UI_PrintStringSmall(str, 8, 0, line + 0);
}
#endif
}
// clear our assigned screen area
memset(g_frame_buffer[line], 0, LCD_WIDTH * 3);
#ifdef ENABLE_PANADAPTER_PEAK_FREQ
if (g_panadapter_peak_freq > 0 && g_panadapter_cycles > 0)
{ // print the peak frequency
char str[16];
sprintf(str, "%u.%05u", g_panadapter_peak_freq / 100000, g_panadapter_peak_freq % 100000);
NUMBER_trim_trailing_zeros(str);
UI_PrintStringSmall(str, 8, 0, line + 0);
}
#endif
// draw top center vertical marker (the VFO frequency)
base_line[PANADAPTER_BINS - (LCD_WIDTH * 2)] = 0x3F;
{ // draw top & bottom horizontal dotted line
const unsigned int top = PANADAPTER_BINS - (LCD_WIDTH * 2);
const unsigned int bot = PANADAPTER_BINS - (LCD_WIDTH * 0);
for (i = 0; i < PANADAPTER_BINS; i += 4)
{
// top line
base_line[top - i] |= 0x01;
base_line[top + i] |= 0x01;
if (i <= 4)
{
base_line[top - i] |= 1u << 0;
base_line[top + i] |= 1u << 0;
}
// bottom line
base_line[bot - i] |= 0x20;
base_line[bot + i] |= 0x20;
base_line[bot - i] |= 1u << 6;
base_line[bot + i] |= 1u << 6;
}
}
// draw top center vertical marker (the VFO frequency)
base_line[PANADAPTER_BINS - (LCD_WIDTH * 2)] = 0x15;
// draw the panadapter vertical bins
if (g_panadapter_cycles > 0)
if (valid)
{
for (i = 0; i < ARRAY_SIZE(g_panadapter_rssi); i++)
{
uint32_t pixels;
uint8_t rssi = g_panadapter_rssi[i];
#if 0
rssi = (rssi < ((-129 + 160) * 2)) ? 0 : rssi - ((-129 + 160) * 2); // min of -129dBm (S3)
rssi = rssi >> 2;
#else
rssi = ((uint16_t)(rssi - min_rssi) * 21) / span_rssi; // 0 ~ 21
rssi = ((uint16_t)(rssi - min_rssi) * 22) / span_rssi; // 0 ~ 22
#endif
rssi += 2; // offset from the bottom
if (rssi > 22)
rssi = 22; // limit peak value
pixels = (1u << rssi) - 1; // set the line pixels
if (rssi > 24)
rssi = 24; // limit peak value
pixels = (1u << rssi) - 1; // pixels
pixels &= 0xfffffffe; // clear the bottom line
base_line[i - (LCD_WIDTH * 2)] |= bit_reverse_8(pixels >> 16);
base_line[i - (LCD_WIDTH * 1)] |= bit_reverse_8(pixels >> 8);
base_line[i - (LCD_WIDTH * 0)] |= bit_reverse_8(pixels >> 0);
@ -508,23 +511,33 @@ void UI_DisplayMain(void)
g_center_line = CENTER_LINE_NONE;
single_vfo = -1;
if (g_eeprom.config.setting.dual_watch == DUAL_WATCH_OFF && g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF)
{
single_vfo = main_vfo_num;
}
else
{
single_vfo = -1;
pan_enabled = false;
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF && g_rx_vfo_is_active)
current_vfo_num = g_rx_vfo_num; // we're currently monitoring the other VFO
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF && g_rx_vfo_is_active)
current_vfo_num = g_rx_vfo_num; // we're currently monitoring the other VFO
}
// clear the screen
// clear the screen buffer
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
if (g_serial_config_tick_500ms > 0)
{
BACKLIGHT_turn_on(5); // 5 seconds
UI_PrintString("UART", 0, LCD_WIDTH, 1, 8);
UI_PrintString("CONFIG COMMS", 0, LCD_WIDTH, 3, 8);
ST7565_BlitFullScreen();
g_center_line = CENTER_LINE_IN_USE;
return;
}
#if defined(ENABLE_UART)
if (g_serial_config_tick_500ms > 0)
{ // tell user the serial comms is in use
BACKLIGHT_turn_on(5); // 5 seconds
UI_PrintString("UART", 0, LCD_WIDTH, 1, 8);
UI_PrintString("CONFIG COMMS", 0, LCD_WIDTH, 3, 8);
ST7565_BlitFullScreen();
g_center_line = CENTER_LINE_IN_USE;
return;
}
#endif
#ifdef ENABLE_KEYLOCK
if (g_eeprom.config.setting.key_lock && g_keypad_locked > 0)
@ -539,20 +552,19 @@ void UI_DisplayMain(void)
#endif
#ifdef ENABLE_PANADAPTER
if (g_eeprom.config.setting.dual_watch == DUAL_WATCH_OFF && g_eeprom.config.setting.cross_vfo == CROSS_BAND_OFF)
if (g_dtmf_call_state == DTMF_CALL_STATE_NONE && !g_dtmf_is_tx && !g_dtmf_input_mode)
if (g_eeprom.config.setting.panadapter && g_panadapter_enabled)
if (!g_monitor_enabled)
single_vfo = g_eeprom.config.setting.tx_vfo_num;
if (g_eeprom.config.setting.panadapter && g_panadapter_enabled && single_vfo >= 0)
pan_enabled = true;
else
single_vfo = -1;
#endif
for (vfo_num = 0; vfo_num < 2; vfo_num++)
{
const unsigned int scrn_chan = g_eeprom.config.setting.indices.vfo[vfo_num].screen;
const unsigned int line = (vfo_num == 0) ? line0 : line1;
uint8_t *p_line0 = g_frame_buffer[line + 0];
uint8_t *p_line1 = g_frame_buffer[line + 1];
unsigned int mode = 0;
const unsigned int scrn_chan = g_eeprom.config.setting.indices.vfo[vfo_num].screen;
const unsigned int line = (vfo_num == 0) ? line0 : line1;
uint8_t *p_line0 = g_frame_buffer[line + 0];
uint8_t *p_line1 = g_frame_buffer[line + 1];
unsigned int mode = 0;
unsigned int state;
if (single_vfo >= 0 && single_vfo != vfo_num)
@ -618,6 +630,8 @@ void UI_DisplayMain(void)
str[16] = 0;
UI_PrintString(str, 2, 0, 2 + (vfo_num * 3), 8);
pan_enabled = false;
g_center_line = CENTER_LINE_IN_USE;
continue;
}
@ -1096,36 +1110,38 @@ void UI_DisplayMain(void)
if (rx || g_current_function == FUNCTION_FOREGROUND || g_current_function == FUNCTION_POWER_SAVE)
{
#if 1
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_live[0] != 0)
{ // show live DTMF decode
const unsigned int len = strlen(g_dtmf_rx_live);
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return;
g_center_line = CENTER_LINE_DTMF_DEC;
strcpy(str, "DTMF ");
strcat(str, g_dtmf_rx_live + idx);
UI_PrintStringSmall(str, 2, 0, 3);
}
#else
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_index > 0)
{ // show live DTMF decode
const unsigned int len = g_dtmf_rx_index;
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return;
g_center_line = CENTER_LINE_DTMF_DEC;
strcpy(str, "DTMF ");
strcat(str, g_dtmf_rx + idx);
UI_PrintStringSmall(str, 2, 0, 3);
}
#ifdef ENABLE_DTMF_LIVE_DECODER
#if 1
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_live[0] != 0)
{ // show live DTMF decode
const unsigned int len = strlen(g_dtmf_rx_live);
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return;
g_center_line = CENTER_LINE_DTMF_DEC;
strcpy(str, "DTMF ");
strcat(str, g_dtmf_rx_live + idx);
UI_PrintStringSmall(str, 2, 0, 3);
}
#else
if (g_eeprom.config.setting.dtmf_live_decoder && g_dtmf_rx_index > 0)
{ // show live DTMF decode
const unsigned int len = g_dtmf_rx_index;
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (g_current_display_screen != DISPLAY_MAIN || g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return;
g_center_line = CENTER_LINE_DTMF_DEC;
strcpy(str, "DTMF ");
strcat(str, g_dtmf_rx + idx);
UI_PrintStringSmall(str, 2, 0, 3);
}
#endif
#endif
#ifdef ENABLE_SHOW_CHARGE_LEVEL
@ -1147,8 +1163,7 @@ void UI_DisplayMain(void)
}
#ifdef ENABLE_PANADAPTER
//if (single_vfo >= 0)
UI_DisplayMain_pan(false);
UI_DisplayMain_pan(false);
#endif
ST7565_BlitFullScreen();

View File

@ -125,7 +125,9 @@ const t_menu_item g_menu_list[] =
{"D PRE", VOICE_ID_INVALID, MENU_DTMF_PRE },
{"D DCD", VOICE_ID_INVALID, MENU_DTMF_DCD },
{"D LIST", VOICE_ID_INVALID, MENU_DTMF_LIST },
#ifdef ENABLE_DTMF_LIVE_DECODER
{"D LIVE", VOICE_ID_INVALID, MENU_DTMF_LIVE_DEC }, // live DTMF decoder
#endif
{"PonMSG", VOICE_ID_INVALID, MENU_PON_MSG },
{"ROGER", VOICE_ID_INVALID, MENU_ROGER_MODE },
{"BatVOL", VOICE_ID_INVALID, MENU_VOLTAGE }, // was "VOL"
@ -829,10 +831,14 @@ void UI_DisplayMenu(void)
// Fallthrough
case MENU_DTMF_LIVE_DEC:
strcpy(str, "DTMF\nDECODE\n");
strcat(str, g_sub_menu_off_on[g_sub_menu_selection]);
break;
#ifdef ENABLE_DTMF_LIVE_DECODER
case MENU_DTMF_LIVE_DEC:
strcpy(str, "DTMF\nDECODE\n");
strcat(str, g_sub_menu_off_on[g_sub_menu_selection]);
break;
#endif
// Fallthrough
case MENU_STE:
strcpy(str, "SUB TAIL\nELIMIN\n");

View File

@ -106,7 +106,9 @@ enum
MENU_DTMF_PRE,
MENU_DTMF_DCD,
MENU_DTMF_LIST,
#ifdef ENABLE_DTMF_LIVE_DECODER
MENU_DTMF_LIVE_DEC,
#endif
#ifdef ENABLE_MDC1200
MENU_MDC1200_MODE,
MENU_MDC1200_ID,