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

Updated DTMF to full char range

This commit is contained in:
OneOfEleven 2023-10-11 20:44:35 +01:00
parent 6374160045
commit 04f9262635
6 changed files with 58 additions and 17 deletions

View File

@ -1814,10 +1814,28 @@ void APP_TimeSlice10ms(void)
void cancelUserInputModes(void) void cancelUserInputModes(void)
{ {
if (g_ask_to_save)
{
g_ask_to_save = false;
g_update_display = true;
}
if (g_ask_to_delete)
{
g_ask_to_delete = false;
g_update_display = true;
}
if (g_dtmf_input_mode || g_dtmf_input_box_index > 0) if (g_dtmf_input_mode || g_dtmf_input_box_index > 0)
{ {
DTMF_clear_input_box(); DTMF_clear_input_box();
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode)
g_request_display_screen = DISPLAY_FM;
else
g_request_display_screen = DISPLAY_MAIN; g_request_display_screen = DISPLAY_MAIN;
#else
g_request_display_screen = DISPLAY_MAIN;
#endif
g_update_display = true; g_update_display = true;
} }

View File

@ -380,6 +380,8 @@ static void FM_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
static void FM_Key_STAR(bool key_pressed, bool key_held) 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) if (key_held && !key_pressed)
return; return;
@ -392,6 +394,8 @@ static void FM_Key_STAR(bool key_pressed, bool key_held)
static void FM_Key_EXIT(bool key_pressed, bool key_held) static void FM_Key_EXIT(bool key_pressed, bool key_held)
{ {
g_key_input_count_down = key_input_timeout_500ms;
if (key_held || key_pressed) if (key_held || key_pressed)
return; return;
@ -451,6 +455,8 @@ static void FM_Key_MENU(bool key_pressed, bool key_held)
unsigned int i; unsigned int i;
int channel = -1; int channel = -1;
g_key_input_count_down = key_input_timeout_500ms;
if (key_held || key_pressed) if (key_held || key_pressed)
return; return;
@ -518,6 +524,8 @@ static void FM_Key_MENU(bool key_pressed, bool key_held)
static void FM_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Step) static void FM_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Step)
{ {
g_key_input_count_down = key_input_timeout_500ms;
if (key_held || !key_pressed) if (key_held || !key_pressed)
{ {
if (g_input_box_index > 0) if (g_input_box_index > 0)

View File

@ -983,7 +983,8 @@ void BK4819_EnableDTMF(void)
(1u << BK4819_REG_24_SHIFT_UNKNOWN_6) | (1u << BK4819_REG_24_SHIFT_UNKNOWN_6) |
BK4819_REG_24_ENABLE | BK4819_REG_24_ENABLE |
BK4819_REG_24_SELECT_DTMF | BK4819_REG_24_SELECT_DTMF |
(14u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15 // (14u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
(15u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
} }
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch) void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch)

Binary file not shown.

Binary file not shown.

View File

@ -34,8 +34,6 @@ void UI_DisplayFM(void)
memset(g_frame_buffer, 0, sizeof(g_frame_buffer)); memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
// *************************************
if (g_eeprom.key_lock && g_keypad_locked > 0) if (g_eeprom.key_lock && g_keypad_locked > 0)
{ // tell user how to unlock the keyboard { // tell user how to unlock the keyboard
backlight_turn_on(); backlight_turn_on();
@ -46,19 +44,22 @@ void UI_DisplayFM(void)
} }
// ************************************* // *************************************
// upper text line
UI_PrintString("FM", 0, 127, 0, 12); UI_PrintString("FM", 0, 127, 0, 12);
// ************************************* // *************************************
// middle text line
if (g_ask_to_save) if (g_ask_to_save)
{ {
strcpy(String, "SAVE ?"); const unsigned int freq = g_eeprom.fm_frequency_playing;
sprintf(String, "SAVE %u.%u ?", freq / 10, freq % 10);
} }
else else
if (g_ask_to_delete) if (g_ask_to_delete)
{ {
strcpy(String, "DEL ?"); strcpy(String, "DELETE ?");
} }
else else
{ {
@ -72,7 +73,7 @@ void UI_DisplayFM(void)
{ {
if (g_eeprom.fm_frequency_playing == g_fm_channels[i]) if (g_eeprom.fm_frequency_playing == g_fm_channels[i])
{ {
sprintf(String, "VFO (CH %u)", i + 1); sprintf(String, "VFO (CH %u)", 1 + i);
break; break;
} }
} }
@ -81,22 +82,32 @@ void UI_DisplayFM(void)
strcpy(String, "VFO"); strcpy(String, "VFO");
} }
else else
sprintf(String, "CH %u", g_eeprom.fm_selected_channel + 1); sprintf(String, "CH %u", 1 + g_eeprom.fm_selected_channel);
} }
else else
if (!g_fm_auto_scan) if (!g_fm_auto_scan)
strcpy(String, "M-SCAN"); strcpy(String, "M-SCAN");
else else
sprintf(String, "A-SCAN %u", g_fm_channel_position + 1); sprintf(String, "A-SCAN %u", 1 + g_fm_channel_position);
} }
UI_PrintString(String, 0, 127, 2, 10); UI_PrintString(String, 0, 127, 2, 10);
// ************************************* // *************************************
// lower text line
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (g_ask_to_save || (g_eeprom.fm_is_channel_mode && g_input_box_index > 0)) if (g_ask_to_save)
{ // channel mode
const unsigned int chan = g_fm_channel_position;
const uint32_t freq = g_fm_channels[chan];
UI_GenerateChannelString(String, chan, ' ');
if (FM_CheckValidChannel(chan))
sprintf(String + strlen(String), " (%u.%u)", freq / 10, freq % 10);
}
else
if (g_eeprom.fm_is_channel_mode && g_input_box_index > 0)
{ // user is entering a channel number { // user is entering a channel number
UI_GenerateChannelString(String, g_fm_channel_position, ' '); UI_GenerateChannelString(String, g_fm_channel_position, ' ');
} }
@ -104,8 +115,9 @@ void UI_DisplayFM(void)
if (!g_ask_to_delete) if (!g_ask_to_delete)
{ {
if (g_input_box_index == 0) if (g_input_box_index == 0)
{ { // frequency mode
NUMBER_ToDigits(g_eeprom.fm_frequency_playing * 10000, String); const uint32_t freq = g_eeprom.fm_frequency_playing;
NUMBER_ToDigits(freq * 10000, String);
UI_DisplayFrequency(String, 23, 4, false, true); UI_DisplayFrequency(String, 23, 4, false, true);
} }
else else
@ -114,11 +126,13 @@ void UI_DisplayFM(void)
} }
} }
else else
{ { // delete channel
sprintf(String, "CH %u", g_eeprom.fm_selected_channel + 1); const uint32_t chan = g_eeprom.fm_selected_channel;
const uint32_t freq = g_fm_channels[chan];
sprintf(String, "CH %u (%u.%u)", 1 + chan, freq / 10, freq % 10);
} }
UI_PrintString(String, 0, 127, 4, 10); UI_PrintString(String, 0, 127, 4, (strlen(String) >= 8) ? 8 : 10);
// ************************************* // *************************************