|
@@ -18,10 +18,9 @@
|
|
#include "process_combo.h"
|
|
#include "process_combo.h"
|
|
#include "action_tapping.h"
|
|
#include "action_tapping.h"
|
|
|
|
|
|
-
|
|
|
|
#ifdef COMBO_COUNT
|
|
#ifdef COMBO_COUNT
|
|
-__attribute__((weak)) combo_t key_combos[COMBO_COUNT];
|
|
+__attribute__((weak)) combo_t key_combos[COMBO_COUNT];
|
|
-uint16_t COMBO_LEN = COMBO_COUNT;
|
|
+uint16_t COMBO_LEN = COMBO_COUNT;
|
|
#else
|
|
#else
|
|
extern combo_t key_combos[];
|
|
extern combo_t key_combos[];
|
|
extern uint16_t COMBO_LEN;
|
|
extern uint16_t COMBO_LEN;
|
|
@@ -46,64 +45,86 @@ __attribute__((weak)) bool process_combo_key_release(uint16_t combo_index, combo
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifndef COMBO_NO_TIMER
|
|
#ifndef COMBO_NO_TIMER
|
|
-static uint16_t timer = 0;
|
|
+static uint16_t timer = 0;
|
|
#endif
|
|
#endif
|
|
-static bool b_combo_enable = true;
|
|
+static bool b_combo_enable = true;
|
|
-static uint16_t longest_term = 0;
|
|
+static uint16_t longest_term = 0;
|
|
|
|
|
|
typedef struct {
|
|
typedef struct {
|
|
keyrecord_t record;
|
|
keyrecord_t record;
|
|
- uint16_t combo_index;
|
|
+ uint16_t combo_index;
|
|
- uint16_t keycode;
|
|
+ uint16_t keycode;
|
|
} queued_record_t;
|
|
} queued_record_t;
|
|
-static uint8_t key_buffer_size = 0;
|
|
+static uint8_t key_buffer_size = 0;
|
|
static queued_record_t key_buffer[COMBO_KEY_BUFFER_LENGTH];
|
|
static queued_record_t key_buffer[COMBO_KEY_BUFFER_LENGTH];
|
|
|
|
|
|
typedef struct {
|
|
typedef struct {
|
|
uint16_t combo_index;
|
|
uint16_t combo_index;
|
|
} queued_combo_t;
|
|
} queued_combo_t;
|
|
-static uint8_t combo_buffer_write= 0;
|
|
+static uint8_t combo_buffer_write = 0;
|
|
-static uint8_t combo_buffer_read = 0;
|
|
+static uint8_t combo_buffer_read = 0;
|
|
static queued_combo_t combo_buffer[COMBO_BUFFER_LENGTH];
|
|
static queued_combo_t combo_buffer[COMBO_BUFFER_LENGTH];
|
|
|
|
|
|
#define INCREMENT_MOD(i) i = (i + 1) % COMBO_BUFFER_LENGTH
|
|
#define INCREMENT_MOD(i) i = (i + 1) % COMBO_BUFFER_LENGTH
|
|
|
|
|
|
-#define COMBO_KEY_POS ((keypos_t){.col=254, .row=254})
|
|
+#define COMBO_KEY_POS ((keypos_t){.col = 254, .row = 254})
|
|
-
|
|
|
|
|
|
|
|
#ifndef EXTRA_SHORT_COMBOS
|
|
#ifndef EXTRA_SHORT_COMBOS
|
|
|
|
|
|
-# define COMBO_ACTIVE(combo) (combo->active)
|
|
+# define COMBO_ACTIVE(combo) (combo->active)
|
|
# define COMBO_DISABLED(combo) (combo->disabled)
|
|
# define COMBO_DISABLED(combo) (combo->disabled)
|
|
-# define COMBO_STATE(combo) (combo->state)
|
|
+# define COMBO_STATE(combo) (combo->state)
|
|
-
|
|
+
|
|
-# define ACTIVATE_COMBO(combo) do {combo->active = true;}while(0)
|
|
+# define ACTIVATE_COMBO(combo) \
|
|
-# define DEACTIVATE_COMBO(combo) do {combo->active = false;}while(0)
|
|
+ do { \
|
|
-# define DISABLE_COMBO(combo) do {combo->disabled = true;}while(0)
|
|
+ combo->active = true; \
|
|
-# define RESET_COMBO_STATE(combo) do { \
|
|
+ } while (0)
|
|
- combo->disabled = false; \
|
|
+# define DEACTIVATE_COMBO(combo) \
|
|
- combo->state = 0; \
|
|
+ do { \
|
|
-}while(0)
|
|
+ combo->active = false; \
|
|
|
|
+ } while (0)
|
|
|
|
+# define DISABLE_COMBO(combo) \
|
|
|
|
+ do { \
|
|
|
|
+ combo->disabled = true; \
|
|
|
|
+ } while (0)
|
|
|
|
+# define RESET_COMBO_STATE(combo) \
|
|
|
|
+ do { \
|
|
|
|
+ combo->disabled = false; \
|
|
|
|
+ combo->state = 0; \
|
|
|
|
+ } while (0)
|
|
#else
|
|
#else
|
|
|
|
|
|
-# define COMBO_ACTIVE(combo) (combo->state & 0x80)
|
|
+# define COMBO_ACTIVE(combo) (combo->state & 0x80)
|
|
# define COMBO_DISABLED(combo) (combo->state & 0x40)
|
|
# define COMBO_DISABLED(combo) (combo->state & 0x40)
|
|
-# define COMBO_STATE(combo) (combo->state & 0x3F)
|
|
+# define COMBO_STATE(combo) (combo->state & 0x3F)
|
|
-
|
|
+
|
|
-# define ACTIVATE_COMBO(combo) do {combo->state |= 0x80;}while(0)
|
|
+# define ACTIVATE_COMBO(combo) \
|
|
-# define DEACTIVATE_COMBO(combo) do {combo->state &= ~0x80;}while(0)
|
|
+ do { \
|
|
-# define DISABLE_COMBO(combo) do {combo->state |= 0x40;}while(0)
|
|
+ combo->state |= 0x80; \
|
|
-# define RESET_COMBO_STATE(combo) do {combo->state &= ~0x7F;}while(0)
|
|
+ } while (0)
|
|
|
|
+# define DEACTIVATE_COMBO(combo) \
|
|
|
|
+ do { \
|
|
|
|
+ combo->state &= ~0x80; \
|
|
|
|
+ } while (0)
|
|
|
|
+# define DISABLE_COMBO(combo) \
|
|
|
|
+ do { \
|
|
|
|
+ combo->state |= 0x40; \
|
|
|
|
+ } while (0)
|
|
|
|
+# define RESET_COMBO_STATE(combo) \
|
|
|
|
+ do { \
|
|
|
|
+ combo->state &= ~0x7F; \
|
|
|
|
+ } while (0)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
static inline void release_combo(uint16_t combo_index, combo_t *combo) {
|
|
static inline void release_combo(uint16_t combo_index, combo_t *combo) {
|
|
if (combo->keycode) {
|
|
if (combo->keycode) {
|
|
keyrecord_t record = {
|
|
keyrecord_t record = {
|
|
- .event = {
|
|
+ .event =
|
|
- .key = COMBO_KEY_POS,
|
|
+ {
|
|
- .time = timer_read()|1,
|
|
+ .key = COMBO_KEY_POS,
|
|
- .pressed = false,
|
|
+ .time = timer_read() | 1,
|
|
- },
|
|
+ .pressed = false,
|
|
|
|
+ },
|
|
.keycode = combo->keycode,
|
|
.keycode = combo->keycode,
|
|
};
|
|
};
|
|
#ifndef NO_ACTION_TAPPING
|
|
#ifndef NO_ACTION_TAPPING
|
|
@@ -123,18 +144,17 @@ static inline bool _get_combo_must_hold(uint16_t combo_index, combo_t *combo) {
|
|
#elif defined(COMBO_MUST_HOLD_PER_COMBO)
|
|
#elif defined(COMBO_MUST_HOLD_PER_COMBO)
|
|
return get_combo_must_hold(combo_index, combo);
|
|
return get_combo_must_hold(combo_index, combo);
|
|
#elif defined(COMBO_MUST_HOLD_MODS)
|
|
#elif defined(COMBO_MUST_HOLD_MODS)
|
|
- return (KEYCODE_IS_MOD(combo->keycode) ||
|
|
+ return (KEYCODE_IS_MOD(combo->keycode) || (combo->keycode >= QK_MOMENTARY && combo->keycode <= QK_MOMENTARY_MAX));
|
|
- (combo->keycode >= QK_MOMENTARY && combo->keycode <= QK_MOMENTARY_MAX));
|
|
|
|
#endif
|
|
#endif
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
-static inline uint16_t _get_wait_time(uint16_t combo_index, combo_t *combo ) {
|
|
+static inline uint16_t _get_wait_time(uint16_t combo_index, combo_t *combo) {
|
|
if (_get_combo_must_hold(combo_index, combo)
|
|
if (_get_combo_must_hold(combo_index, combo)
|
|
#ifdef COMBO_MUST_TAP_PER_COMBO
|
|
#ifdef COMBO_MUST_TAP_PER_COMBO
|
|
- || get_combo_must_tap(combo_index, combo)
|
|
+ || get_combo_must_tap(combo_index, combo)
|
|
#endif
|
|
#endif
|
|
- ) {
|
|
+ ) {
|
|
if (longest_term < COMBO_HOLD_TERM) {
|
|
if (longest_term < COMBO_HOLD_TERM) {
|
|
return COMBO_HOLD_TERM;
|
|
return COMBO_HOLD_TERM;
|
|
}
|
|
}
|
|
@@ -144,9 +164,8 @@ static inline uint16_t _get_wait_time(uint16_t combo_index, combo_t *combo ) {
|
|
}
|
|
}
|
|
|
|
|
|
static inline uint16_t _get_combo_term(uint16_t combo_index, combo_t *combo) {
|
|
static inline uint16_t _get_combo_term(uint16_t combo_index, combo_t *combo) {
|
|
-
|
|
|
|
#if defined(COMBO_TERM_PER_COMBO)
|
|
#if defined(COMBO_TERM_PER_COMBO)
|
|
- return get_combo_term(combo_index, combo);
|
|
+ return get_combo_term(combo_index, combo);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
return COMBO_TERM;
|
|
return COMBO_TERM;
|
|
@@ -154,7 +173,7 @@ static inline uint16_t _get_combo_term(uint16_t combo_index, combo_t *combo) {
|
|
|
|
|
|
void clear_combos(void) {
|
|
void clear_combos(void) {
|
|
uint16_t index = 0;
|
|
uint16_t index = 0;
|
|
- longest_term = 0;
|
|
+ longest_term = 0;
|
|
for (index = 0; index < COMBO_LEN; ++index) {
|
|
for (index = 0; index < COMBO_LEN; ++index) {
|
|
combo_t *combo = &key_combos[index];
|
|
combo_t *combo = &key_combos[index];
|
|
if (!COMBO_ACTIVE(combo)) {
|
|
if (!COMBO_ACTIVE(combo)) {
|
|
@@ -175,7 +194,7 @@ static inline void dump_key_buffer(void) {
|
|
key_buffer_next = key_buffer_i + 1;
|
|
key_buffer_next = key_buffer_i + 1;
|
|
|
|
|
|
queued_record_t *qrecord = &key_buffer[key_buffer_i];
|
|
queued_record_t *qrecord = &key_buffer[key_buffer_i];
|
|
- keyrecord_t *record = &qrecord->record;
|
|
+ keyrecord_t * record = &qrecord->record;
|
|
|
|
|
|
if (IS_NOEVENT(record->event)) {
|
|
if (IS_NOEVENT(record->event)) {
|
|
continue;
|
|
continue;
|
|
@@ -185,9 +204,9 @@ static inline void dump_key_buffer(void) {
|
|
process_combo_event(qrecord->combo_index, true);
|
|
process_combo_event(qrecord->combo_index, true);
|
|
} else {
|
|
} else {
|
|
#ifndef NO_ACTION_TAPPING
|
|
#ifndef NO_ACTION_TAPPING
|
|
- action_tapping_process(*record);
|
|
+ action_tapping_process(*record);
|
|
#else
|
|
#else
|
|
- process_record(record);
|
|
+ process_record(record);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
record->event.time = 0;
|
|
record->event.time = 0;
|
|
@@ -242,7 +261,9 @@ void apply_combo(uint16_t combo_index, combo_t *combo) {
|
|
|
|
|
|
* disable the other keys. */
|
|
* disable the other keys. */
|
|
|
|
|
|
- if (COMBO_DISABLED(combo)) { return; }
|
|
+ if (COMBO_DISABLED(combo)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
#if defined(EXTRA_EXTRA_LONG_COMBOS)
|
|
#if defined(EXTRA_EXTRA_LONG_COMBOS)
|
|
@@ -254,12 +275,11 @@ void apply_combo(uint16_t combo_index, combo_t *combo) {
|
|
#endif
|
|
#endif
|
|
|
|
|
|
for (uint8_t key_buffer_i = 0; key_buffer_i < key_buffer_size; key_buffer_i++) {
|
|
for (uint8_t key_buffer_i = 0; key_buffer_i < key_buffer_size; key_buffer_i++) {
|
|
-
|
|
|
|
queued_record_t *qrecord = &key_buffer[key_buffer_i];
|
|
queued_record_t *qrecord = &key_buffer[key_buffer_i];
|
|
- keyrecord_t *record = &qrecord->record;
|
|
+ keyrecord_t * record = &qrecord->record;
|
|
- uint16_t keycode = qrecord->keycode;
|
|
+ uint16_t keycode = qrecord->keycode;
|
|
|
|
|
|
- uint8_t key_count = 0;
|
|
+ uint8_t key_count = 0;
|
|
uint16_t key_index = -1;
|
|
uint16_t key_index = -1;
|
|
_find_key_index_and_count(combo->keys, keycode, &key_index, &key_count);
|
|
_find_key_index_and_count(combo->keys, keycode, &key_index, &key_count);
|
|
|
|
|
|
@@ -271,7 +291,7 @@ void apply_combo(uint16_t combo_index, combo_t *combo) {
|
|
KEY_STATE_DOWN(state, key_index);
|
|
KEY_STATE_DOWN(state, key_index);
|
|
if (ALL_COMBO_KEYS_ARE_DOWN(state, key_count)) {
|
|
if (ALL_COMBO_KEYS_ARE_DOWN(state, key_count)) {
|
|
|
|
|
|
- record->keycode = combo->keycode;
|
|
+ record->keycode = combo->keycode;
|
|
record->event.key = COMBO_KEY_POS;
|
|
record->event.key = COMBO_KEY_POS;
|
|
|
|
|
|
qrecord->combo_index = combo_index;
|
|
qrecord->combo_index = combo_index;
|
|
@@ -283,19 +303,15 @@ void apply_combo(uint16_t combo_index, combo_t *combo) {
|
|
|
|
|
|
record->event.time = 0;
|
|
record->event.time = 0;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
drop_combo_from_buffer(combo_index);
|
|
drop_combo_from_buffer(combo_index);
|
|
}
|
|
}
|
|
|
|
|
|
static inline void apply_combos(void) {
|
|
static inline void apply_combos(void) {
|
|
|
|
|
|
- for (uint8_t i = combo_buffer_read;
|
|
+ for (uint8_t i = combo_buffer_read; i != combo_buffer_write; INCREMENT_MOD(i)) {
|
|
- i != combo_buffer_write;
|
|
|
|
- INCREMENT_MOD(i)) {
|
|
|
|
-
|
|
|
|
queued_combo_t *buffered_combo = &combo_buffer[i];
|
|
queued_combo_t *buffered_combo = &combo_buffer[i];
|
|
- combo_t *combo = &key_combos[buffered_combo->combo_index];
|
|
+ combo_t * combo = &key_combos[buffered_combo->combo_index];
|
|
|
|
|
|
#ifdef COMBO_MUST_TAP_PER_COMBO
|
|
#ifdef COMBO_MUST_TAP_PER_COMBO
|
|
if (get_combo_must_tap(buffered_combo->combo_index, combo)) {
|
|
if (get_combo_must_tap(buffered_combo->combo_index, combo)) {
|
|
@@ -310,15 +326,15 @@ static inline void apply_combos(void) {
|
|
clear_combos();
|
|
clear_combos();
|
|
}
|
|
}
|
|
|
|
|
|
-combo_t* overlaps(combo_t *combo1, combo_t *combo2) {
|
|
+combo_t *overlaps(combo_t *combo1, combo_t *combo2) {
|
|
|
|
|
|
* dropped from the combo buffer.
|
|
* dropped from the combo buffer.
|
|
* The combo that has less keys will be dropped. If they have the same
|
|
* The combo that has less keys will be dropped. If they have the same
|
|
* amount of keys, drop combo1. */
|
|
* amount of keys, drop combo1. */
|
|
|
|
|
|
- uint8_t idx1 = 0, idx2 = 0;
|
|
+ uint8_t idx1 = 0, idx2 = 0;
|
|
uint16_t key1, key2;
|
|
uint16_t key1, key2;
|
|
- bool overlaps = false;
|
|
+ bool overlaps = false;
|
|
|
|
|
|
while ((key1 = pgm_read_word(&combo1->keys[idx1])) != COMBO_END) {
|
|
while ((key1 = pgm_read_word(&combo1->keys[idx1])) != COMBO_END) {
|
|
idx2 = 0;
|
|
idx2 = 0;
|
|
@@ -335,7 +351,7 @@ combo_t* overlaps(combo_t *combo1, combo_t *combo2) {
|
|
}
|
|
}
|
|
|
|
|
|
static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record, uint16_t combo_index) {
|
|
static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record, uint16_t combo_index) {
|
|
- uint8_t key_count = 0;
|
|
+ uint8_t key_count = 0;
|
|
uint16_t key_index = -1;
|
|
uint16_t key_index = -1;
|
|
_find_key_index_and_count(combo->keys, keycode, &key_index, &key_count);
|
|
_find_key_index_and_count(combo->keys, keycode, &key_index, &key_count);
|
|
|
|
|
|
@@ -369,12 +385,9 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
|
|
|
|
|
|
|
|
|
|
combo_t *drop = NULL;
|
|
combo_t *drop = NULL;
|
|
- for (uint8_t combo_buffer_i = combo_buffer_read;
|
|
+ for (uint8_t combo_buffer_i = combo_buffer_read; combo_buffer_i != combo_buffer_write; INCREMENT_MOD(combo_buffer_i)) {
|
|
- combo_buffer_i != combo_buffer_write;
|
|
+ queued_combo_t *qcombo = &combo_buffer[combo_buffer_i];
|
|
- INCREMENT_MOD(combo_buffer_i)) {
|
|
+ combo_t * buffered_combo = &key_combos[qcombo->combo_index];
|
|
-
|
|
|
|
- queued_combo_t *qcombo = &combo_buffer[combo_buffer_i];
|
|
|
|
- combo_t *buffered_combo = &key_combos[qcombo->combo_index];
|
|
|
|
|
|
|
|
if ((drop = overlaps(buffered_combo, combo))) {
|
|
if ((drop = overlaps(buffered_combo, combo))) {
|
|
DISABLE_COMBO(drop);
|
|
DISABLE_COMBO(drop);
|
|
@@ -387,21 +400,19 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
|
|
INCREMENT_MOD(combo_buffer_read);
|
|
INCREMENT_MOD(combo_buffer_read);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (drop != combo) {
|
|
if (drop != combo) {
|
|
|
|
|
|
combo_buffer[combo_buffer_write] = (queued_combo_t){
|
|
combo_buffer[combo_buffer_write] = (queued_combo_t){
|
|
- .combo_index=combo_index,
|
|
+ .combo_index = combo_index,
|
|
};
|
|
};
|
|
INCREMENT_MOD(combo_buffer_write);
|
|
INCREMENT_MOD(combo_buffer_write);
|
|
|
|
|
|
|
|
|
|
longest_term = _get_wait_time(combo_index, combo);
|
|
longest_term = _get_wait_time(combo_index, combo);
|
|
}
|
|
}
|
|
- }
|
|
+ }
|
|
-
|
|
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
|
|
@@ -416,7 +427,7 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
|
|
else if (get_combo_must_tap(combo_index, combo)) {
|
|
else if (get_combo_must_tap(combo_index, combo)) {
|
|
|
|
|
|
apply_combo(combo_index, combo);
|
|
apply_combo(combo_index, combo);
|
|
- apply_combos();
|
|
+ apply_combos();
|
|
# ifdef COMBO_PROCESS_KEY_RELEASE
|
|
# ifdef COMBO_PROCESS_KEY_RELEASE
|
|
if (process_combo_key_release(combo_index, combo, key_index, keycode)) {
|
|
if (process_combo_key_release(combo_index, combo, key_index, keycode)) {
|
|
release_combo(combo_index, combo);
|
|
release_combo(combo_index, combo);
|
|
@@ -424,10 +435,7 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
|
|
# endif
|
|
# endif
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
- } else if (COMBO_ACTIVE(combo)
|
|
+ } else if (COMBO_ACTIVE(combo) && ONLY_ONE_KEY_IS_DOWN(COMBO_STATE(combo)) && KEY_NOT_YET_RELEASED(COMBO_STATE(combo), key_index)) {
|
|
- && ONLY_ONE_KEY_IS_DOWN(COMBO_STATE(combo))
|
|
|
|
- && KEY_NOT_YET_RELEASED(COMBO_STATE(combo), key_index)
|
|
|
|
- ) {
|
|
|
|
|
|
|
|
release_combo(combo_index, combo);
|
|
release_combo(combo_index, combo);
|
|
key_is_part_of_combo = true;
|
|
key_is_part_of_combo = true;
|
|
@@ -435,9 +443,7 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
|
|
#ifdef COMBO_PROCESS_KEY_RELEASE
|
|
#ifdef COMBO_PROCESS_KEY_RELEASE
|
|
process_combo_key_release(combo_index, combo, key_index, keycode);
|
|
process_combo_key_release(combo_index, combo, key_index, keycode);
|
|
#endif
|
|
#endif
|
|
- } else if (COMBO_ACTIVE(combo)
|
|
+ } else if (COMBO_ACTIVE(combo) && KEY_NOT_YET_RELEASED(COMBO_STATE(combo), key_index)) {
|
|
- && KEY_NOT_YET_RELEASED(COMBO_STATE(combo), key_index)
|
|
|
|
- ) {
|
|
|
|
|
|
|
|
key_is_part_of_combo = true;
|
|
key_is_part_of_combo = true;
|
|
|
|
|
|
@@ -489,21 +495,21 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
|
|
if (record->event.pressed && is_combo_key) {
|
|
if (record->event.pressed && is_combo_key) {
|
|
#ifndef COMBO_NO_TIMER
|
|
#ifndef COMBO_NO_TIMER
|
|
-# ifdef COMBO_STRICT_TIMER
|
|
+# ifdef COMBO_STRICT_TIMER
|
|
if (!timer) {
|
|
if (!timer) {
|
|
|
|
|
|
timer = timer_read();
|
|
timer = timer_read();
|
|
}
|
|
}
|
|
-# else
|
|
+# else
|
|
timer = timer_read();
|
|
timer = timer_read();
|
|
-# endif
|
|
+# endif
|
|
#endif
|
|
#endif
|
|
|
|
|
|
if (key_buffer_size < COMBO_KEY_BUFFER_LENGTH) {
|
|
if (key_buffer_size < COMBO_KEY_BUFFER_LENGTH) {
|
|
key_buffer[key_buffer_size++] = (queued_record_t){
|
|
key_buffer[key_buffer_size++] = (queued_record_t){
|
|
- .record = *record,
|
|
+ .record = *record,
|
|
- .keycode = keycode,
|
|
+ .keycode = keycode,
|
|
- .combo_index = -1,
|
|
+ .combo_index = -1,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -532,7 +538,7 @@ void combo_task(void) {
|
|
if (combo_buffer_read != combo_buffer_write) {
|
|
if (combo_buffer_read != combo_buffer_write) {
|
|
apply_combos();
|
|
apply_combos();
|
|
longest_term = 0;
|
|
longest_term = 0;
|
|
- timer = 0;
|
|
+ timer = 0;
|
|
} else {
|
|
} else {
|
|
dump_key_buffer();
|
|
dump_key_buffer();
|
|
timer = 0;
|
|
timer = 0;
|
|
@@ -546,9 +552,9 @@ void combo_enable(void) { b_combo_enable = true; }
|
|
|
|
|
|
void combo_disable(void) {
|
|
void combo_disable(void) {
|
|
#ifndef COMBO_NO_TIMER
|
|
#ifndef COMBO_NO_TIMER
|
|
- timer = 0;
|
|
+ timer = 0;
|
|
#endif
|
|
#endif
|
|
- b_combo_enable = false;
|
|
+ b_combo_enable = false;
|
|
combo_buffer_read = combo_buffer_write;
|
|
combo_buffer_read = combo_buffer_write;
|
|
clear_combos();
|
|
clear_combos();
|
|
dump_key_buffer();
|
|
dump_key_buffer();
|