mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 14:48:03 +03:00
increase side-key long-press time to 1 second (was 300ms)
This commit is contained in:
@ -840,6 +840,7 @@ void AIRCOPY_process_key(key_code_t Key, bool key_pressed, bool key_held)
|
|||||||
case KEY_EXIT:
|
case KEY_EXIT:
|
||||||
AIRCOPY_Key_EXIT(key_pressed, key_held);
|
AIRCOPY_Key_EXIT(key_pressed, key_held);
|
||||||
break;
|
break;
|
||||||
|
// case KEY_PTT:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
77
app/app.c
77
app/app.c
@ -1374,22 +1374,12 @@ void APP_check_keys(void)
|
|||||||
{
|
{
|
||||||
if (g_key_prev != KEY_INVALID)
|
if (g_key_prev != KEY_INVALID)
|
||||||
{ // key now fully released
|
{ // key now fully released
|
||||||
|
APP_process_key(g_key_prev, false, g_key_held);
|
||||||
#ifdef ENABLE_AIRCOPY
|
|
||||||
if (g_current_display_screen != DISPLAY_AIRCOPY)
|
|
||||||
APP_process_key(g_key_prev, false, g_key_held);
|
|
||||||
else
|
|
||||||
AIRCOPY_process_key(g_key_prev, false, g_key_held);
|
|
||||||
#else
|
|
||||||
APP_process_key(g_key_prev, false, g_key_held);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_key_debounce_press = 0;
|
g_key_debounce_press = 0;
|
||||||
g_key_debounce_repeat = 0;
|
g_key_debounce_repeat = 0;
|
||||||
g_key_prev = KEY_INVALID;
|
g_key_prev = KEY_INVALID;
|
||||||
g_key_held = false;
|
g_key_held = false;
|
||||||
g_boot_tick_10ms = 0; // cancel the boot-up screen
|
g_boot_tick_10ms = 0; // cancel the boot-up screen
|
||||||
|
|
||||||
g_update_status = true;
|
g_update_status = true;
|
||||||
// g_update_display = true;
|
// g_update_display = true;
|
||||||
}
|
}
|
||||||
@ -1401,6 +1391,10 @@ void APP_check_keys(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // key pressed
|
{ // key pressed
|
||||||
|
|
||||||
|
// long press time can be different for different keys
|
||||||
|
const uint8_t long_press_ticks = (key == KEY_SIDE1 || key == KEY_SIDE2) ? key_side_long_press_10ms : key_long_press_10ms;
|
||||||
|
|
||||||
if (g_key_debounce_press < key_debounce_10ms)
|
if (g_key_debounce_press < key_debounce_10ms)
|
||||||
{
|
{
|
||||||
if (++g_key_debounce_press >= key_debounce_10ms)
|
if (++g_key_debounce_press >= key_debounce_10ms)
|
||||||
@ -1410,38 +1404,20 @@ void APP_check_keys(void)
|
|||||||
g_key_debounce_repeat = key_debounce_10ms;
|
g_key_debounce_repeat = key_debounce_10ms;
|
||||||
g_key_held = false;
|
g_key_held = false;
|
||||||
g_key_prev = key;
|
g_key_prev = key;
|
||||||
|
APP_process_key(g_key_prev, true, g_key_held);
|
||||||
#ifdef ENABLE_AIRCOPY
|
g_update_status = true;
|
||||||
if (g_current_display_screen != DISPLAY_AIRCOPY)
|
// g_update_display = true;
|
||||||
APP_process_key(g_key_prev, true, g_key_held);
|
|
||||||
else
|
|
||||||
AIRCOPY_process_key(g_key_prev, true, g_key_held);
|
|
||||||
#else
|
|
||||||
APP_process_key(g_key_prev, true, g_key_held);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_update_status = true;
|
|
||||||
// g_update_display = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (g_key_debounce_repeat < key_long_press_10ms)
|
if (g_key_debounce_repeat < long_press_ticks)
|
||||||
{
|
{
|
||||||
if (++g_key_debounce_repeat >= key_long_press_10ms)
|
if (++g_key_debounce_repeat >= long_press_ticks)
|
||||||
{ // key long press
|
{ // key long press
|
||||||
g_key_held = true;
|
g_key_held = true;
|
||||||
|
APP_process_key(g_key_prev, true, g_key_held);
|
||||||
#ifdef ENABLE_AIRCOPY
|
g_update_status = true;
|
||||||
if (g_current_display_screen != DISPLAY_AIRCOPY)
|
|
||||||
APP_process_key(g_key_prev, true, g_key_held);
|
|
||||||
else
|
|
||||||
AIRCOPY_process_key(g_key_prev, true, g_key_held);
|
|
||||||
#else
|
|
||||||
APP_process_key(g_key_prev, true, g_key_held);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_update_status = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1449,22 +1425,13 @@ void APP_check_keys(void)
|
|||||||
{ // only the up and down keys are made repeatable
|
{ // only the up and down keys are made repeatable
|
||||||
|
|
||||||
// key repeat max 10ms speed if user is moving up/down in freq/channel
|
// key repeat max 10ms speed if user is moving up/down in freq/channel
|
||||||
const bool freq_chan = IS_FREQ_CHANNEL(g_eeprom.config.setting.indices.vfo[g_eeprom.config.setting.tx_vfo_num].screen);
|
const bool freq_chan = IS_FREQ_CHANNEL(g_eeprom.config.setting.indices.vfo[g_eeprom.config.setting.tx_vfo_num].screen);
|
||||||
const uint8_t repeat_10ms = (g_manual_scanning && g_monitor_enabled && freq_chan && g_current_display_screen == DISPLAY_MAIN) ? 2 : key_repeat_10ms;
|
const uint8_t repeat_ticks = (g_manual_scanning && g_monitor_enabled && freq_chan && g_current_display_screen == DISPLAY_MAIN) ? 2 : key_repeat_10ms;
|
||||||
|
|
||||||
if (++g_key_debounce_repeat >= (key_long_press_10ms + repeat_10ms))
|
if (++g_key_debounce_repeat >= (long_press_ticks + repeat_ticks))
|
||||||
{ // key repeat
|
{ // key repeat
|
||||||
|
g_key_debounce_repeat = long_press_ticks;
|
||||||
g_key_debounce_repeat = key_long_press_10ms;
|
APP_process_key(g_key_prev, true, g_key_held);
|
||||||
|
|
||||||
#ifdef ENABLE_AIRCOPY
|
|
||||||
if (g_current_display_screen != DISPLAY_AIRCOPY)
|
|
||||||
APP_process_key(g_key_prev, true, g_key_held);
|
|
||||||
else
|
|
||||||
AIRCOPY_process_key(g_key_prev, true, g_key_held);
|
|
||||||
#else
|
|
||||||
APP_process_key(g_key_prev, true, g_key_held);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2568,6 +2535,14 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
|||||||
{
|
{
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
|
|
||||||
|
#ifdef ENABLE_AIRCOPY
|
||||||
|
if (g_current_display_screen == DISPLAY_AIRCOPY)
|
||||||
|
{
|
||||||
|
AIRCOPY_process_key(key, key_pressed, key_held);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Key == KEY_INVALID && !key_pressed && !key_held)
|
if (Key == KEY_INVALID && !key_pressed && !key_held)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
1
misc.c
1
misc.c
@ -46,6 +46,7 @@ const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 sec
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint8_t key_debounce_10ms = 30 / 10; // 30ms
|
const uint8_t key_debounce_10ms = 30 / 10; // 30ms
|
||||||
|
const uint8_t key_side_long_press_10ms = 1000 / 10; // 1 second
|
||||||
const uint8_t key_long_press_10ms = 300 / 10; // 300ms
|
const uint8_t key_long_press_10ms = 300 / 10; // 300ms
|
||||||
const uint8_t key_repeat_10ms = 50 / 10; // 50ms
|
const uint8_t key_repeat_10ms = 50 / 10; // 50ms
|
||||||
|
|
||||||
|
1
misc.h
1
misc.h
@ -142,6 +142,7 @@ extern const uint8_t key_input_timeout_500ms;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const uint8_t key_debounce_10ms;
|
extern const uint8_t key_debounce_10ms;
|
||||||
|
extern const uint8_t key_side_long_press_10ms;
|
||||||
extern const uint8_t key_long_press_10ms;
|
extern const uint8_t key_long_press_10ms;
|
||||||
extern const uint8_t key_repeat_10ms;
|
extern const uint8_t key_repeat_10ms;
|
||||||
|
|
||||||
|
21
panadapter.c
21
panadapter.c
@ -19,15 +19,17 @@
|
|||||||
#include "ui/main.h"
|
#include "ui/main.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
bool g_panadapter_enabled;
|
bool g_panadapter_enabled;
|
||||||
#ifdef ENABLE_PANADAPTER_PEAK_FREQ
|
#ifdef ENABLE_PANADAPTER_PEAK_FREQ
|
||||||
uint32_t g_panadapter_peak_freq;
|
uint32_t g_panadapter_peak_freq;
|
||||||
#endif
|
#endif
|
||||||
int g_panadapter_vfo_mode; // > 0 if we're currently sampling the VFO
|
int g_panadapter_vfo_mode; // > 0 if we're currently sampling the VFO
|
||||||
uint8_t g_panadapter_rssi[PANADAPTER_BINS + 1 + PANADAPTER_BINS];
|
uint8_t g_panadapter_rssi[PANADAPTER_BINS + 1 + PANADAPTER_BINS];
|
||||||
uint8_t g_panadapter_max_rssi;
|
uint8_t g_panadapter_max_rssi;
|
||||||
uint8_t g_panadapter_min_rssi;
|
uint8_t g_panadapter_min_rssi;
|
||||||
unsigned int panadapter_rssi_index;
|
unsigned int panadapter_rssi_index;
|
||||||
|
|
||||||
|
const uint8_t panadapter_min_rssi = (-147 + 160) * 2; // min of -147dBm (S0)
|
||||||
|
|
||||||
bool PAN_scanning(void)
|
bool PAN_scanning(void)
|
||||||
{
|
{
|
||||||
@ -75,7 +77,6 @@ void PAN_process_10ms(void)
|
|||||||
g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
|
g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
|
||||||
g_dtmf_is_tx ||
|
g_dtmf_is_tx ||
|
||||||
g_dtmf_input_mode)
|
g_dtmf_input_mode)
|
||||||
// g_input_box_index > 0)
|
|
||||||
{
|
{
|
||||||
if (g_panadapter_enabled)
|
if (g_panadapter_enabled)
|
||||||
{ // disable the panadapter
|
{ // disable the panadapter
|
||||||
@ -119,7 +120,7 @@ void PAN_process_10ms(void)
|
|||||||
|
|
||||||
// save the current RSSI value .. center bin is the VFO frequency
|
// save the current RSSI value .. center bin is the VFO frequency
|
||||||
const int16_t rssi = g_current_rssi[g_eeprom.config.setting.tx_vfo_num];
|
const int16_t rssi = g_current_rssi[g_eeprom.config.setting.tx_vfo_num];
|
||||||
g_panadapter_rssi[PANADAPTER_BINS] = (rssi > 255) ? 255 : (rssi < 0) ? 0 : rssi;
|
g_panadapter_rssi[PANADAPTER_BINS] = (rssi > 255) ? 255 : (rssi < panadapter_min_rssi) ? panadapter_min_rssi : rssi;
|
||||||
|
|
||||||
g_panadapter_vfo_mode = 40; // pause scanning for at least another 400ms
|
g_panadapter_vfo_mode = 40; // pause scanning for at least another 400ms
|
||||||
return;
|
return;
|
||||||
@ -130,7 +131,7 @@ void PAN_process_10ms(void)
|
|||||||
|
|
||||||
// save the current RSSI value
|
// save the current RSSI value
|
||||||
const uint16_t rssi = BK4819_GetRSSI();
|
const uint16_t rssi = BK4819_GetRSSI();
|
||||||
g_panadapter_rssi[panadapter_rssi_index] = (rssi <= 255) ? rssi : 255;
|
g_panadapter_rssi[panadapter_rssi_index] = (rssi > 255) ? 255 : (rssi < panadapter_min_rssi) ? panadapter_min_rssi : rssi;
|
||||||
|
|
||||||
// next frequency
|
// next frequency
|
||||||
if (++panadapter_rssi_index >= ARRAY_SIZE(g_panadapter_rssi))
|
if (++panadapter_rssi_index >= ARRAY_SIZE(g_panadapter_rssi))
|
||||||
|
14
ui/main.c
14
ui/main.c
@ -421,19 +421,15 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
|
|||||||
!g_panadapter_enabled ||
|
!g_panadapter_enabled ||
|
||||||
single_vfo < 0 ||
|
single_vfo < 0 ||
|
||||||
g_current_display_screen != DISPLAY_MAIN ||
|
g_current_display_screen != DISPLAY_MAIN ||
|
||||||
// g_current_function == FUNCTION_TRANSMIT ||
|
|
||||||
g_current_function == FUNCTION_POWER_SAVE ||
|
g_current_function == FUNCTION_POWER_SAVE ||
|
||||||
g_monitor_enabled)
|
g_monitor_enabled ||
|
||||||
|
g_dtmf_call_state != DTMF_CALL_STATE_NONE ||
|
||||||
|
g_dtmf_is_tx ||
|
||||||
|
g_dtmf_input_mode)
|
||||||
{ // don't draw the panadapter
|
{ // don't draw the panadapter
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE || g_dtmf_is_tx || g_dtmf_input_mode)
|
|
||||||
return; // DTMF call
|
|
||||||
|
|
||||||
// if (g_input_box_index > 0)
|
|
||||||
// return; // user is entering a frequency
|
|
||||||
|
|
||||||
// auto vertical scale
|
// auto vertical scale
|
||||||
max_rssi = g_panadapter_max_rssi;
|
max_rssi = g_panadapter_max_rssi;
|
||||||
min_rssi = g_panadapter_min_rssi;
|
min_rssi = g_panadapter_min_rssi;
|
||||||
@ -462,7 +458,7 @@ void big_freq(const uint32_t frequency, const unsigned int x, const unsigned int
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// draw top center vertical marker (the VFO frequency)
|
// draw top center vertical marker (the VFO frequency)
|
||||||
base_line[PANADAPTER_BINS - (LCD_WIDTH * 2)] = 0x0F;
|
base_line[PANADAPTER_BINS - (LCD_WIDTH * 2)] = 0x1F;
|
||||||
|
|
||||||
// draw top horizontal dotted line
|
// draw top horizontal dotted line
|
||||||
for (i = 0; i < PANADAPTER_BINS; i += 4)
|
for (i = 0; i < PANADAPTER_BINS; i += 4)
|
||||||
|
Reference in New Issue
Block a user