mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
Fix DTMF and frequency entry bug
This commit is contained in:
parent
44f90a20b4
commit
79dae75556
15
app/app.c
15
app/app.c
@ -2313,6 +2313,9 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
|
||||
if ((Key >= KEY_0 && Key <= KEY_9) || Key == KEY_F)
|
||||
{
|
||||
if (g_scan_state_dir != SCAN_OFF || g_css_scan_mode != CSS_SCAN_MODE_OFF)
|
||||
@ -2323,6 +2326,8 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
if (Key == KEY_PTT && g_ptt_was_pressed)
|
||||
{
|
||||
flag = key_held;
|
||||
@ -2338,20 +2343,20 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
|
||||
// to this causing key releases to be totally ignored :( .. 1of11
|
||||
if (Key != KEY_PTT && g_ptt_was_released)
|
||||
{
|
||||
/* if (key_held)
|
||||
if (key_held)
|
||||
flag = true;
|
||||
|
||||
if (!key_pressed)
|
||||
// if (!key_pressed)
|
||||
if (key_pressed) // I now use key released for button press detections
|
||||
{
|
||||
flag = true;
|
||||
*/
|
||||
g_ptt_was_released = false;
|
||||
/* }
|
||||
}
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("proc key 1 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||
#endif
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
if (g_fkey_pressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2))
|
||||
|
33
app/main.c
33
app/main.c
@ -821,28 +821,25 @@ void MAIN_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_dtmf_input_mode && key_pressed && !key_held)
|
||||
if (g_dtmf_input_mode)
|
||||
{
|
||||
const char Character = DTMF_GetCharacter(Key);
|
||||
if (Character != 0xFF)
|
||||
{ // add key to DTMF string
|
||||
DTMF_Append(Character);
|
||||
g_key_input_count_down = key_input_timeout_500ms;
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
|
||||
// g_ptt_was_released = true; // why is this being set ?
|
||||
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
if (key_pressed && !key_held)
|
||||
{
|
||||
const char Character = DTMF_GetCharacter(Key);
|
||||
if (Character != 0xFF)
|
||||
{ // add key to DTMF string
|
||||
|
||||
DTMF_Append(Character);
|
||||
|
||||
g_key_input_count_down = key_input_timeout_500ms;
|
||||
// g_ptt_was_released = true; // why is this being set ?
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: ???
|
||||
// if (Key > KEY_PTT)
|
||||
// {
|
||||
// Key = KEY_SIDE2; // what's this doing ???
|
||||
// }
|
||||
|
||||
switch (Key)
|
||||
{
|
||||
case KEY_0:
|
||||
|
@ -1264,6 +1264,9 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
||||
|
||||
if (g_edit_index < 10)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
|
||||
if (Key >= KEY_0 && Key <= KEY_9)
|
||||
{
|
||||
g_edit[g_edit_index] = '0' + Key - KEY_0;
|
||||
@ -1276,6 +1279,8 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
||||
|
||||
g_request_display_screen = DISPLAY_MENU;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -22,8 +22,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
enum key_code_e {
|
||||
KEY_INVALID = 0,
|
||||
KEY_0, // DTMF 0
|
||||
KEY_0 = 0, // DTMF 0
|
||||
KEY_1, // DTMF 1
|
||||
KEY_2, // DTMF 2
|
||||
KEY_3, // DTMF 3
|
||||
@ -42,7 +41,7 @@ enum key_code_e {
|
||||
KEY_PTT, //
|
||||
KEY_SIDE2, //
|
||||
KEY_SIDE1, //
|
||||
// KEY_INVALID //
|
||||
KEY_INVALID //
|
||||
};
|
||||
typedef enum key_code_e key_code_t;
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -29,7 +29,12 @@ void INPUTBOX_Append(const key_code_t Digit)
|
||||
if (g_input_box_index == 0)
|
||||
memset(g_input_box, 10, sizeof(g_input_box));
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
|
||||
if (Digit >= KEY_0 && Digit != KEY_INVALID)
|
||||
g_input_box[g_input_box_index++] = (char)(Digit - KEY_0);
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user