diff --git a/app/app.c b/app/app.c index 8930367..9cdd3df 100644 --- a/app/app.c +++ b/app/app.c @@ -1277,7 +1277,8 @@ void APP_end_tx(void) } #endif -uint32_t key_repeat_ticks = SQR(100 / 10); +int key_repeat_speedup_ticks = 2500 / 10; // 2.5 seconds +uint8_t key_repeat_ticks = 300 / 10; // 300ms // called every 10ms void APP_check_keys(void) @@ -1371,8 +1372,9 @@ void APP_check_keys(void) if (key == KEY_INVALID || (g_key_prev != KEY_INVALID && key != g_key_prev)) { // key not pressed or different key pressed - // reset the key repeat speed - key_repeat_ticks = SQR(key_repeat_10ms); + // reset the key repeat speed-up settings + key_repeat_speedup_ticks = 2500 / 10; // speed-up once every 2.5 seconds + key_repeat_ticks = key_repeat_initial_10ms; if (g_key_debounce_press > 0) { @@ -1430,20 +1432,25 @@ void APP_check_keys(void) if (key == KEY_UP || key == KEY_DOWN) { // only the up and down keys are made repeatable + // speed up key repeat the longer it's held down + if (key_repeat_ticks > key_repeat_fastest_10ms) + { + if (--key_repeat_speedup_ticks <= 0) + { + key_repeat_speedup_ticks = 2500 / 10; // speed-up once every 2.5 seconds + key_repeat_ticks = (key_repeat_ticks > (60 / 10)) ? key_repeat_ticks >> 1 : key_repeat_ticks - 1; + } + } + key_repeat_ticks = (key_repeat_ticks < key_repeat_fastest_10ms) ? key_repeat_fastest_10ms : key_repeat_ticks; + // 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 uint8_t repeat_ticks = (g_manual_scanning && g_monitor_enabled && freq_chan && g_current_display_screen == DISPLAY_MAIN) ? 2 : NUMBER_isqrt(key_repeat_ticks); - const uint8_t repeat_ticks = NUMBER_isqrt(key_repeat_ticks); +// const uint8_t repeat_ticks = (g_manual_scanning && g_monitor_enabled && freq_chan && g_current_display_screen == DISPLAY_MAIN) ? 2 : key_repeat_ticks; + const uint8_t repeat_ticks = key_repeat_ticks; if (++g_key_debounce_repeat >= (long_press_ticks + repeat_ticks)) { // key repeat - // speed up the key repeat the longer the key is help down - if (key_repeat_ticks >= (SQR(2) + 8)) - key_repeat_ticks -= 8; - else - key_repeat_ticks = SQR(2); - #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) // UART_printf("rp %u\n", key_repeat_ticks); #endif diff --git a/firmware.bin b/firmware.bin index 554e099..7a0aff3 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 80f489a..64d4b7b 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/misc.c b/misc.c index 1203c02..5682a08 100644 --- a/misc.c +++ b/misc.c @@ -48,8 +48,8 @@ const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 sec 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_repeat_10ms = 50 / 10; // 50ms -const uint8_t key_repeat_10ms = 200 / 10; // 200ms +const uint8_t key_repeat_initial_10ms = 300 / 10; // 300ms +const uint8_t key_repeat_fastest_10ms = 10 / 10; // 10ms const uint16_t search_freq_css_10ms = 10000 / 10; // 10 seconds const uint16_t search_10ms = 210 / 10; // 210ms .. don't reduce this diff --git a/misc.h b/misc.h index c0c5527..6b61ad7 100644 --- a/misc.h +++ b/misc.h @@ -148,7 +148,8 @@ extern const uint8_t key_input_timeout_500ms; 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_repeat_10ms; +extern const uint8_t key_repeat_initial_10ms; +extern const uint8_t key_repeat_fastest_10ms; extern const uint16_t search_freq_css_10ms; extern const uint16_t search_10ms;