qmk_settings: wrap COMBO_TERM

This commit is contained in:
Ilya Zhuravlev 2021-07-04 19:04:46 -04:00
parent c9492cef89
commit 7d23ffe1bc
3 changed files with 14 additions and 2 deletions

View File

@ -16,6 +16,7 @@
#include "print.h" #include "print.h"
#include "process_combo.h" #include "process_combo.h"
#include "qmk_settings.h"
#ifdef VIAL_COMBO_ENABLE #ifdef VIAL_COMBO_ENABLE
#include "dynamic_keymap.h" #include "dynamic_keymap.h"
@ -222,7 +223,7 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
} }
void matrix_scan_combo(void) { void matrix_scan_combo(void) {
if (b_combo_enable && timer && timer_elapsed(timer) > COMBO_TERM) { if (b_combo_enable && timer && timer_elapsed(timer) > QS_combo_term) {
/* This disables the combo, meaning key events for this /* This disables the combo, meaning key events for this
* combo will be handled by the next processors in the chain * combo will be handled by the next processors in the chain
*/ */

View File

@ -7,6 +7,7 @@
#include "dynamic_keymap.h" #include "dynamic_keymap.h"
#include "process_auto_shift.h" #include "process_auto_shift.h"
#include "mousekey.h" #include "mousekey.h"
#include "process_combo.h"
qmk_settings_t QS; qmk_settings_t QS;
@ -30,6 +31,7 @@ static void mousekey_apply(void) {
static const qmk_settings_proto_t protos[] PROGMEM = { static const qmk_settings_proto_t protos[] PROGMEM = {
DECLARE_SETTING(1, grave_esc_override), DECLARE_SETTING(1, grave_esc_override),
DECLARE_SETTING(2, combo_term),
DECLARE_SETTING(3, auto_shift), DECLARE_SETTING(3, auto_shift),
DECLARE_SETTING_CB(4, auto_shift_timeout, auto_shift_timeout_apply), DECLARE_SETTING_CB(4, auto_shift_timeout, auto_shift_timeout_apply),
DECLARE_SETTING(5, osk_tap_toggle), DECLARE_SETTING(5, osk_tap_toggle),
@ -98,6 +100,8 @@ void qmk_settings_reset(void) {
QS.mousekey_wheel_max_speed = MOUSEKEY_WHEEL_MAX_SPEED; QS.mousekey_wheel_max_speed = MOUSEKEY_WHEEL_MAX_SPEED;
QS.mousekey_wheel_time_to_max = MOUSEKEY_WHEEL_TIME_TO_MAX; QS.mousekey_wheel_time_to_max = MOUSEKEY_WHEEL_TIME_TO_MAX;
QS.combo_term = COMBO_TERM;
save_settings(); save_settings();
/* to trigger all callbacks */ /* to trigger all callbacks */
qmk_settings_init(); qmk_settings_init();

View File

@ -94,12 +94,13 @@ typedef struct {
uint16_t mousekey_wheel_interval; uint16_t mousekey_wheel_interval;
uint16_t mousekey_wheel_max_speed; uint16_t mousekey_wheel_max_speed;
uint16_t mousekey_wheel_time_to_max; uint16_t mousekey_wheel_time_to_max;
uint16_t combo_term;
uint8_t grave_esc_override; uint8_t grave_esc_override;
uint8_t auto_shift; uint8_t auto_shift;
uint8_t osk_tap_toggle; uint8_t osk_tap_toggle;
uint8_t padding0; uint8_t padding0;
} qmk_settings_t; } qmk_settings_t;
_Static_assert(sizeof(qmk_settings_t) == 26, "unexpected size of the qmk_settings_t structure"); _Static_assert(sizeof(qmk_settings_t) == 28, "unexpected size of the qmk_settings_t structure");
typedef void (*qmk_setting_callback_t)(void); typedef void (*qmk_setting_callback_t)(void);
@ -141,6 +142,9 @@ extern qmk_settings_t QS;
/* Mouse keys */ /* Mouse keys */
#define QS_mousekey_move_delta (QS.mousekey_move_delta) #define QS_mousekey_move_delta (QS.mousekey_move_delta)
/* Combo */
#define QS_combo_term (QS.combo_term)
#else #else
/* dynamic settings framework is disabled => hardcode the settings and let the compiler optimize extra branches out */ /* dynamic settings framework is disabled => hardcode the settings and let the compiler optimize extra branches out */
@ -166,4 +170,7 @@ extern qmk_settings_t QS;
/* Mouse keys */ /* Mouse keys */
#define QS_mousekey_move_delta MOUSEKEY_MOVE_DELTA #define QS_mousekey_move_delta MOUSEKEY_MOVE_DELTA
/* Combo */
#define QS_combo_term COMBO_TERM
#endif #endif