Merge remote-tracking branch 'qmk/master' into merge-2024-04-15
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
|
||||
#include "process_caps_word.h"
|
||||
#include "process_auto_shift.h"
|
||||
#include "process_space_cadet.h"
|
||||
#include "caps_word.h"
|
||||
#include "keycodes.h"
|
||||
#include "quantum_keycodes.h"
|
||||
@ -110,6 +111,9 @@ bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
|
||||
# endif // COMMAND_ENABLE
|
||||
) {
|
||||
caps_word_on();
|
||||
# ifdef SPACE_CADET_ENABLE
|
||||
reset_space_cadet();
|
||||
# endif // SPACE_CADET_ENABLE
|
||||
}
|
||||
# endif // defined(COMMAND_ENABLE) && !defined(IS_COMMAND)
|
||||
#endif // BOTH_SHIFTS_TURNS_ON_CAPS_WORD
|
||||
|
@ -133,9 +133,8 @@ void dynamic_macro_record_key(keyrecord_t *macro_buffer, keyrecord_t **macro_poi
|
||||
if (*macro_pointer - direction != macro2_end) {
|
||||
**macro_pointer = *record;
|
||||
*macro_pointer += direction;
|
||||
} else {
|
||||
dynamic_macro_record_key_user(direction, record);
|
||||
}
|
||||
dynamic_macro_record_key_user(direction, record);
|
||||
|
||||
dprintf("dynamic macro: slot %d length: %d/%d\n", DYNAMIC_MACRO_CURRENT_SLOT(), DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, *macro_pointer), DYNAMIC_MACRO_CURRENT_CAPACITY(macro_buffer, macro2_end));
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ void process_midi_all_notes_off(void) {
|
||||
#endif // MIDI_BASIC
|
||||
|
||||
#ifdef MIDI_ADVANCED
|
||||
static uint8_t tone_status[2][MIDI_TONE_COUNT];
|
||||
static uint8_t tone_status[MIDI_TONE_COUNT];
|
||||
|
||||
static uint8_t midi_modulation;
|
||||
static int8_t midi_modulation_step;
|
||||
@ -57,8 +57,7 @@ void midi_init(void) {
|
||||
midi_config.modulation_interval = 8;
|
||||
|
||||
for (uint8_t i = 0; i < MIDI_TONE_COUNT; i++) {
|
||||
tone_status[0][i] = MIDI_INVALID_NOTE;
|
||||
tone_status[1][i] = 0;
|
||||
tone_status[i] = MIDI_INVALID_NOTE;
|
||||
}
|
||||
|
||||
midi_modulation = 0;
|
||||
@ -77,21 +76,19 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
|
||||
uint8_t tone = keycode - MIDI_TONE_MIN;
|
||||
uint8_t velocity = midi_config.velocity;
|
||||
if (record->event.pressed) {
|
||||
uint8_t note = midi_compute_note(keycode);
|
||||
midi_send_noteon(&midi_device, channel, note, velocity);
|
||||
dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
||||
tone_status[1][tone] += 1;
|
||||
if (tone_status[0][tone] == MIDI_INVALID_NOTE) {
|
||||
tone_status[0][tone] = note;
|
||||
if (tone_status[tone] == MIDI_INVALID_NOTE) {
|
||||
uint8_t note = midi_compute_note(keycode);
|
||||
midi_send_noteon(&midi_device, channel, note, velocity);
|
||||
dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
||||
tone_status[tone] = note;
|
||||
}
|
||||
} else {
|
||||
uint8_t note = tone_status[0][tone];
|
||||
tone_status[1][tone] -= 1;
|
||||
if (tone_status[1][tone] == 0) {
|
||||
uint8_t note = tone_status[tone];
|
||||
if (note != MIDI_INVALID_NOTE) {
|
||||
midi_send_noteoff(&midi_device, channel, note, velocity);
|
||||
dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
||||
tone_status[0][tone] = MIDI_INVALID_NOTE;
|
||||
}
|
||||
tone_status[tone] = MIDI_INVALID_NOTE;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -157,10 +157,14 @@ bool process_space_cadet(uint16_t keycode, keyrecord_t *record) {
|
||||
}
|
||||
default: {
|
||||
if (record->event.pressed) {
|
||||
sc_last = 0;
|
||||
reset_space_cadet();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void reset_space_cadet() {
|
||||
sc_last = 0;
|
||||
}
|
||||
|
@ -21,3 +21,4 @@
|
||||
|
||||
void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode);
|
||||
bool process_space_cadet(uint16_t keycode, keyrecord_t *record);
|
||||
void reset_space_cadet(void);
|
||||
|
@ -128,9 +128,6 @@ static const uint16_t combinedmap_second[] PROGMEM = {STN_S2, STN_KL, STN_WL, ST
|
||||
|
||||
#ifdef STENO_ENABLE_ALL
|
||||
void steno_init(void) {
|
||||
if (!eeconfig_is_enabled()) {
|
||||
eeconfig_init();
|
||||
}
|
||||
mode = eeprom_read_byte(EECONFIG_STENOMODE);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
if (!active_td || keycode == active_td) return false;
|
||||
|
||||
action = &tap_dance_actions[TD_INDEX(active_td)];
|
||||
action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(active_td)];
|
||||
action->state.interrupted = true;
|
||||
action->state.interrupting_keycode = keycode;
|
||||
process_tap_dance_action_on_dance_finished(action);
|
||||
@ -154,7 +154,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
switch (keycode) {
|
||||
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX:
|
||||
action = &tap_dance_actions[TD_INDEX(keycode)];
|
||||
action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(keycode)];
|
||||
|
||||
action->state.pressed = record->event.pressed;
|
||||
if (record->event.pressed) {
|
||||
@ -182,7 +182,7 @@ void tap_dance_task(void) {
|
||||
|
||||
if (!active_td || timer_elapsed(last_tap_time) <= GET_TAPPING_TERM(active_td, &(keyrecord_t){})) return;
|
||||
|
||||
action = &tap_dance_actions[TD_INDEX(active_td)];
|
||||
action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(active_td)];
|
||||
if (!action->state.interrupted) {
|
||||
process_tap_dance_action_on_dance_finished(action);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "action.h"
|
||||
#include "quantum_keycodes.h"
|
||||
|
||||
typedef struct {
|
||||
uint16_t interrupting_keycode;
|
||||
@ -74,8 +75,7 @@ typedef struct {
|
||||
#define ACTION_TAP_DANCE_FN_ADVANCED_WITH_RELEASE(user_fn_on_each_tap, user_fn_on_each_release, user_fn_on_dance_finished, user_fn_on_dance_reset) \
|
||||
{ .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, user_fn_on_each_release}, .user_data = NULL, }
|
||||
|
||||
#define TD(n) (QK_TAP_DANCE | TD_INDEX(n))
|
||||
#define TD_INDEX(code) ((code)&0xFF)
|
||||
#define TD_INDEX(code) QK_TAP_DANCE_GET_INDEX(code)
|
||||
#define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions)
|
||||
|
||||
extern tap_dance_action_t tap_dance_actions[];
|
||||
|
Reference in New Issue
Block a user