0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-19 08:21:18 +03:00

Fix PTT bug

This commit is contained in:
OneOfEleven 2023-10-10 00:56:55 +01:00
parent 79dae75556
commit 023e7b6ee3
8 changed files with 18 additions and 22 deletions

View File

@ -202,14 +202,11 @@ endif
CFLAGS = CFLAGS =
ifeq ($(ENABLE_CLANG),0) ifeq ($(ENABLE_CLANG),0)
CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -std=c11 -MMD
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
else else
# Oz needed to make it fit on flash # Oz needed to make it fit on flash
#CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -std=c11 -MMD
endif endif
ifeq ($(ENABLE_LTO),1) ifeq ($(ENABLE_LTO),1)

View File

@ -1792,7 +1792,6 @@ void cancelUserInputModes(void)
{ {
DTMF_clear_input_box(); DTMF_clear_input_box();
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
g_request_display_screen = DISPLAY_MAIN; g_request_display_screen = DISPLAY_MAIN;
g_update_display = true; g_update_display = true;
} }
@ -1802,7 +1801,6 @@ void cancelUserInputModes(void)
g_fkey_pressed = false; g_fkey_pressed = false;
g_input_box_index = 0; g_input_box_index = 0;
g_key_input_count_down = 0; g_key_input_count_down = 0;
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
g_update_status = true; g_update_status = true;
g_update_display = true; g_update_display = true;
@ -2331,7 +2329,6 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
if (Key == KEY_PTT && g_ptt_was_pressed) if (Key == KEY_PTT && g_ptt_was_pressed)
{ {
flag = key_held; flag = key_held;
if (!key_pressed) if (!key_pressed)
{ {
flag = true; flag = true;
@ -2345,7 +2342,6 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
{ {
if (key_held) if (key_held)
flag = true; flag = true;
// if (!key_pressed) // if (!key_pressed)
if (key_pressed) // I now use key released for button press detections if (key_pressed) // I now use key released for button press detections
{ {

View File

@ -25,6 +25,7 @@
#include "app/scanner.h" #include "app/scanner.h"
#include "audio.h" #include "audio.h"
#include "driver/keyboard.h" #include "driver/keyboard.h"
#include "driver/uart.h"
#include "dtmf.h" #include "dtmf.h"
#include "external/printf/printf.h" #include "external/printf/printf.h"
#include "functions.h" #include "functions.h"
@ -159,6 +160,10 @@ void GENERIC_Key_PTT(bool key_pressed)
// PTT pressed // PTT pressed
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_printf("gene key 1 %u\r\n", key_pressed);
#endif
if (g_scan_state_dir != SCAN_OFF || // frequency/channel scanning if (g_scan_state_dir != SCAN_OFF || // frequency/channel scanning
g_screen_to_display == DISPLAY_SCANNER || // CTCSS/CDCSS scanning g_screen_to_display == DISPLAY_SCANNER || // CTCSS/CDCSS scanning
g_css_scan_mode != CSS_SCAN_MODE_OFF) // " " g_css_scan_mode != CSS_SCAN_MODE_OFF) // " "

View File

@ -822,23 +822,21 @@ void MAIN_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held)
#endif #endif
if (g_dtmf_input_mode) if (g_dtmf_input_mode)
{
if (key_pressed && !key_held)
{ {
const char Character = DTMF_GetCharacter(Key); const char Character = DTMF_GetCharacter(Key);
if (Character != 0xFF) if (Character != 0xFF)
{ // add key to DTMF string { // add key to DTMF string
if (key_pressed && !key_held)
{
DTMF_Append(Character); DTMF_Append(Character);
g_key_input_count_down = key_input_timeout_500ms; g_key_input_count_down = key_input_timeout_500ms;
//g_ptt_was_released = true; // why is this being set ? //g_ptt_was_released = true; // why is this being set ?
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL; g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_request_display_screen = DISPLAY_MAIN; g_request_display_screen = DISPLAY_MAIN;
} }
}
return; return;
} }
}
switch (Key) switch (Key)
{ {

Binary file not shown.

Binary file not shown.

View File

@ -45,7 +45,7 @@ void UI_DrawBattery(uint8_t *bitmap, const unsigned int level, const unsigned in
} }
else else
if (blink == 0) if (blink == 0)
memset(bitmap, 0, sizeof(bitmap)); memset(bitmap, 0, sizeof(BITMAP_BATTERY_LEVEL));
} }
void UI_DisplayBattery(const unsigned int level, const unsigned int blink) void UI_DisplayBattery(const unsigned int level, const unsigned int blink)

View File

@ -539,7 +539,7 @@ void UI_DisplayMenu(void)
#endif #endif
case MENU_STEP: case MENU_STEP:
sprintf(String, "%d.%02ukHz", STEP_FREQ_TABLE[g_sub_menu_selection] / 100, abs(STEP_FREQ_TABLE[g_sub_menu_selection]) % 100); sprintf(String, "%d.%02ukHz", STEP_FREQ_TABLE[g_sub_menu_selection] / 100, STEP_FREQ_TABLE[g_sub_menu_selection] % 100);
break; break;
case MENU_TXP: case MENU_TXP: