mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
Key being ignored fix - hopefully
This commit is contained in:
parent
1ecc6e8769
commit
798f0f97f3
2
Makefile
2
Makefile
@ -16,7 +16,7 @@ ENABLE_FMRADIO := 1
|
|||||||
ENABLE_NOAA := 0
|
ENABLE_NOAA := 0
|
||||||
ENABLE_VOICE := 0
|
ENABLE_VOICE := 0
|
||||||
ENABLE_MUTE_RADIO_FOR_VOICE := 1
|
ENABLE_MUTE_RADIO_FOR_VOICE := 1
|
||||||
ENABLE_VOX := 1
|
ENABLE_VOX := 0
|
||||||
ENABLE_LOWER_LOW_MID_TX := 1
|
ENABLE_LOWER_LOW_MID_TX := 1
|
||||||
ENABLE_ALARM := 1
|
ENABLE_ALARM := 1
|
||||||
ENABLE_TX1750 := 1
|
ENABLE_TX1750 := 1
|
||||||
|
57
app/app.c
57
app/app.c
@ -1164,7 +1164,7 @@ void APP_Update(void)
|
|||||||
if (g_screen_to_display != DISPLAY_SEARCH && g_eeprom.dual_watch != DUAL_WATCH_OFF)
|
if (g_screen_to_display != DISPLAY_SEARCH && g_eeprom.dual_watch != DUAL_WATCH_OFF)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_SendText("dual watch\r\n");
|
UART_SendText("dual watch\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@ -1277,7 +1277,7 @@ void APP_Update(void)
|
|||||||
if (g_rx_idle_mode)
|
if (g_rx_idle_mode)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_SendText("ps wake up\r\n");
|
// UART_SendText("ps wake up\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||||
@ -1368,7 +1368,7 @@ void APP_CheckKeys(void)
|
|||||||
APP_ProcessKey(KEY_PTT, true, false);
|
APP_ProcessKey(KEY_PTT, true, false);
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released);
|
// UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1389,7 +1389,7 @@ void APP_CheckKeys(void)
|
|||||||
APP_ProcessKey(KEY_PTT, false, false);
|
APP_ProcessKey(KEY_PTT, false, false);
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released);
|
// UART_printf(" ptt key %3u %u %u\r\n", KEY_PTT, g_ptt_is_pressed, g_ptt_was_released);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1425,7 +1425,7 @@ void APP_CheckKeys(void)
|
|||||||
{ // key now fully released
|
{ // key now fully released
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_printf(" old key %3u %3u, %3u %3u, %u\r\n", key, g_key_prev, g_key_debounce_press, g_key_debounce_repeat, g_key_held);
|
// UART_printf(" old key %3u %3u, %3u %3u, %u\r\n", key, g_key_prev, g_key_debounce_press, g_key_debounce_repeat, g_key_held);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
@ -1463,7 +1463,7 @@ void APP_CheckKeys(void)
|
|||||||
g_key_held = false;
|
g_key_held = false;
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_printf("\r\n new key %3u %3u, %3u %3u, %u\r\n", key, g_key_prev, g_key_debounce_press, g_key_debounce_repeat, g_key_held);
|
// UART_printf("\r\n new key %3u %3u, %3u %3u, %u\r\n", key, g_key_prev, g_key_debounce_press, g_key_debounce_repeat, g_key_held);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_key_prev = key;
|
g_key_prev = key;
|
||||||
@ -1490,7 +1490,7 @@ void APP_CheckKeys(void)
|
|||||||
g_key_held = true;
|
g_key_held = true;
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_printf("long key %3u %3u, %3u %3u, %u\r\n", key, g_key_prev, g_key_debounce_press, g_key_debounce_repeat, g_key_held);
|
// UART_printf("long key %3u %3u, %3u %3u, %u\r\n", key, g_key_prev, g_key_debounce_press, g_key_debounce_repeat, g_key_held);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
@ -1514,7 +1514,7 @@ void APP_CheckKeys(void)
|
|||||||
g_key_debounce_repeat -= key_repeat_10ms;
|
g_key_debounce_repeat -= key_repeat_10ms;
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_printf("rept key %3u %3u, %3u %3u, %u\r\n", key, g_key_prev, g_key_debounce_press, g_key_debounce_repeat, g_key_held);
|
// UART_printf("rept key %3u %3u, %3u %3u, %u\r\n", key, g_key_prev, g_key_debounce_press, g_key_debounce_repeat, g_key_held);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
@ -2512,35 +2512,48 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
|
|||||||
|
|
||||||
// ********************
|
// ********************
|
||||||
|
|
||||||
if (Key == KEY_PTT && g_ptt_was_pressed)
|
if (g_ptt_was_pressed)
|
||||||
{
|
{
|
||||||
flag = key_held;
|
if (Key == KEY_PTT)
|
||||||
if (!key_pressed)
|
|
||||||
{
|
{
|
||||||
flag = true;
|
flag = key_held;
|
||||||
g_ptt_was_pressed = false;
|
if (!key_pressed)
|
||||||
|
{
|
||||||
|
flag = true;
|
||||||
|
g_ptt_was_pressed = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// g_ptt_was_pressed = 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
|
||||||
}
|
}
|
||||||
|
|
||||||
// this bit of code has caused soooooo many problems due
|
// this bit of code has caused soooooo many problems due
|
||||||
// to this causing key releases to be ignored :( .. 1of11
|
// to this causing key releases to be ignored :( .. 1of11
|
||||||
if (Key != KEY_PTT && g_ptt_was_released)
|
if (g_ptt_was_released)
|
||||||
{
|
{
|
||||||
if (key_held)
|
// if (Key != KEY_PTT)
|
||||||
flag = true;
|
if (Key == KEY_PTT)
|
||||||
if (key_pressed) // I now use key released for button press detections
|
|
||||||
{
|
{
|
||||||
flag = true;
|
if (key_held)
|
||||||
g_ptt_was_released = false;
|
flag = true;
|
||||||
|
if (key_pressed) // I now use key released for button press detections
|
||||||
|
{
|
||||||
|
flag = true;
|
||||||
|
g_ptt_was_released = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// g_ptt_was_released = false;
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#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);
|
UART_printf("proc key 2 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||||
//UART_printf("proc key 2 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
UART_printf("proc key 3 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!flag) // this flag is responsible for keys being ignored :(
|
if (!flag) // this flag is responsible for keys being ignored :(
|
||||||
@ -2619,7 +2632,7 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
|
|||||||
if (Key == KEY_PTT)
|
if (Key == KEY_PTT)
|
||||||
g_ptt_was_pressed = true;
|
g_ptt_was_pressed = true;
|
||||||
else
|
else
|
||||||
if (!key_held)
|
// if (!key_held)
|
||||||
g_ptt_was_released = true;
|
g_ptt_was_released = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
37
app/main.c
37
app/main.c
@ -27,6 +27,7 @@
|
|||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
#include "dtmf.h"
|
#include "dtmf.h"
|
||||||
#include "frequencies.h"
|
#include "frequencies.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
@ -117,7 +118,7 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
g_request_save_vfo = true;
|
g_request_save_vfo = true;
|
||||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||||
|
|
||||||
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;
|
||||||
break;
|
break;
|
||||||
@ -141,7 +142,7 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
g_request_save_settings = 1;
|
g_request_save_settings = 1;
|
||||||
g_flag_reconfigure_vfos = true;
|
g_flag_reconfigure_vfos = true;
|
||||||
|
|
||||||
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;
|
||||||
break;
|
break;
|
||||||
@ -166,7 +167,7 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
g_request_save_vfo = true;
|
g_request_save_vfo = true;
|
||||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||||
|
|
||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +185,7 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
g_request_save_vfo = true;
|
g_request_save_vfo = true;
|
||||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||||
|
|
||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +203,7 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
||||||
g_update_status = true;
|
g_update_status = true;
|
||||||
|
|
||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_5: // NOAA
|
case KEY_5: // NOAA
|
||||||
@ -229,13 +230,13 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_6: // H/M/L
|
case KEY_6: // H/M/L
|
||||||
|
|
||||||
ACTION_Power();
|
ACTION_Power();
|
||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_7: // VOX
|
case KEY_7: // VOX
|
||||||
@ -252,7 +253,7 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
|
|
||||||
g_tx_vfo->frequency_reverse = g_tx_vfo->frequency_reverse == false;
|
g_tx_vfo->frequency_reverse = g_tx_vfo->frequency_reverse == false;
|
||||||
g_request_save_channel = 1;
|
g_request_save_channel = 1;
|
||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_9: // CALL
|
case KEY_9: // CALL
|
||||||
@ -271,7 +272,7 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
// g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -280,9 +281,9 @@ static void processFKeyFunction(const key_code_t Key)
|
|||||||
g_fkey_pressed = false;
|
g_fkey_pressed = false;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (!g_fm_radio_mode)
|
// if (!g_fm_radio_mode)
|
||||||
#endif
|
#endif
|
||||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -825,10 +826,14 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
|
|||||||
// g_ptt_was_released = true; // why is this being set ?
|
// g_ptt_was_released = true; // why is this being set ?
|
||||||
}
|
}
|
||||||
|
|
||||||
void MAIN_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held)
|
void MAIN_ProcessKeys(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);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (g_fm_radio_mode && Key != KEY_PTT && Key != KEY_EXIT)
|
if (g_fm_radio_mode && key != KEY_PTT && key != KEY_EXIT)
|
||||||
{
|
{
|
||||||
if (!key_held && key_pressed)
|
if (!key_held && key_pressed)
|
||||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
@ -838,7 +843,7 @@ void MAIN_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
|
|
||||||
if (g_dtmf_input_mode)
|
if (g_dtmf_input_mode)
|
||||||
{
|
{
|
||||||
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)
|
if (key_pressed && !key_held)
|
||||||
@ -853,7 +858,7 @@ void MAIN_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case KEY_0:
|
case KEY_0:
|
||||||
case KEY_1:
|
case KEY_1:
|
||||||
@ -865,7 +870,7 @@ void MAIN_ProcessKeys(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
case KEY_7:
|
case KEY_7:
|
||||||
case KEY_8:
|
case KEY_8:
|
||||||
case KEY_9:
|
case KEY_9:
|
||||||
MAIN_Key_DIGITS(Key, key_pressed, key_held);
|
MAIN_Key_DIGITS(key, key_pressed, key_held);
|
||||||
break;
|
break;
|
||||||
case KEY_MENU:
|
case KEY_MENU:
|
||||||
MAIN_Key_MENU(key_pressed, key_held);
|
MAIN_Key_MENU(key_pressed, key_held);
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user