Merge pull request #1172 from gedankenexperimenter/dynamic-macros-fixes

DynamicMacros fixes
pull/1174/head
Gergely Nagy 3 years ago committed by GitHub
commit be385e62c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -188,7 +188,7 @@ void DynamicMacros::play(uint8_t macro_id) {
case MACRO_ACTION_STEP_TAP_SEQUENCE: {
while (true) {
key.setFlags(0);
key.setFlags(Runtime.storage().read(pos++));
key.setKeyCode(Runtime.storage().read(pos++));
if (key == Key_NoKey)
break;
@ -240,6 +240,17 @@ EventHandlerResult DynamicMacros::onKeyEvent(KeyEvent &event) {
return EventHandlerResult::EVENT_CONSUMED;
}
EventHandlerResult DynamicMacros::beforeReportingState(const KeyEvent &event) {
// Here we add keycodes to the HID report for keys held in a macro sequence.
// This is necessary because Kaleidoscope doesn't know about the supplemental
// `active_macro_keys_[]` array.
for (Key key : active_macro_keys_) {
if (key != Key_NoKey)
Runtime.addToReport(key);
}
return EventHandlerResult::OK;
}
EventHandlerResult DynamicMacros::onNameQuery() {
return ::Focus.sendName(F("DynamicMacros"));
}

@ -39,6 +39,7 @@ class DynamicMacros : public kaleidoscope::Plugin {
public:
EventHandlerResult onNameQuery();
EventHandlerResult onKeyEvent(KeyEvent &event);
EventHandlerResult beforeReportingState(const KeyEvent &event);
EventHandlerResult onFocusEvent(const char *command);
static void reserve_storage(uint16_t size);

@ -154,7 +154,7 @@ void Macros::play(const macro_t *macro_p) {
case MACRO_ACTION_STEP_TAP_SEQUENCE: {
while (true) {
key.setFlags(0);
key.setFlags(pgm_read_byte(macro_p++));
key.setKeyCode(pgm_read_byte(macro_p++));
if (key == Key_NoKey)
break;

Loading…
Cancel
Save