Macros are executed twice

Hello. The following is my macro handler:

const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
  switch (macroIndex) {
  case MACRO_TEST:
    if (keyToggledOn(keyState)) {
      return Macros.type(PSTR("Hello "), PSTR("world!"));
    }
    break;

but I’m getting the text output twice. I have the macro mapped on Fn + V. Please help! :bouquet::bouquet:

What’s the return value of the function in the other cases?

Sorry about that. Here’s the full function:

const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
  switch (macroIndex) {
  case MACRO_PWD:
    if (keyToggledOn(keyState)) {
      return Macros.type(PSTR("Hello "), PSTR("world!"));
    }
    break;
  case MACRO_CONTEXT_MENU:
    if (keyToggledOn(keyState)) {
      return MACRODOWN(T(PcApplication), Tr(LockLayer(NAVIGATION)));
    }
    break;
  case MACRO_LED_OFF:
    if (keyToggledOn(keyState)) {
      LEDOff.activate();
    }
    break;
  }
  return MACRO_NONE;
}

I tried using verbose MACRODOWN instead of Macros.type and find that any macro is being executed twice.

I’ll be looking into this soon. You are using the latest master branch of the plugins from git, right? Along with KALEIDOSCOPE_INIT_PLUGINS?

Yes I’m up to date on all the plugins ie pointing at master.

Do you perhaps have both Kaleidoscope.use() and KALEIDOSCOPE_INIT_PLUGINS in your sketch?

I don’t see any Kaleidoscope.use() in my sketch. I’ve uploaded it here. Please check.

I’m having the same problem. I’ve been using Keyboardio for a few months and I had several plugins and a sloppy unorganized sketch. I redid everything from scratch and now macros are being executed twice. I don’t have a “Kaleidoscope.use()” and git pull replied “Already up to date.”

I just tried the standard sketch. same problem. Keyboardio Model 01 - Kaleidoscope locally builtKeyboardio Model 01 - Kaleidoscope locally built

So the problem cannot be the .ini file; Right?

This sounds like a genuine bug, indeed. Looking into it!

Can’t reproduce this at the moment… Out of curiosity, what OS are you lot on? It shouldn’t matter, but… one never knows.

MacOSX 10.13.5

It’s new.

I have a Windows partition, I’ll try that.

Mhm, I’ve been trying to reproduce under Linux so far, will try MacOS too.

.ino

.ini is the plural form.

1 Like

Hello I’m using Kubuntu latest Bionic LTS.

I wonder if I’m using

I followed the Windows installation instructions and the firmware would not compile because the Arduino IDE apparently couldn’t remember where it had put all the files it needed.

I wonder if I’m using the right up-to-date instructions. I just went back to MacOSX (I don’t like Windows anyway), deleted the Arduino sketch folder, browsed to here: https://github.com/keyboardio/Model01-Firmware , followed the command line instructions starting with “Create and navigate to the Arduino Sketchbook directory” and the keyboard still double macros.

Am I using the right instructions? Would it make sense to try to re-install the IDE (on the MacOSX partition of my hard drive, I’m really a Mac person)?

It turns out I, too, have this same bug. I’m on macOS High Sierra 10.13.5, and I’m using Kaleidoscope 1.23 (or so I think I should be, though I was going to make a separate post asking how to verify.

My sketch is here:

Here’s perhaps a relevant datum: I re-installed Arduino and tried flashing the firmware again, this time from command line. I got this warning:


The legacy plugin API based on hook registration is deprecated.

Consider upgrading your plugins, or implementing the new interface
described by kaleidoscope::Plugin. In particular, instead of using
Kaleidoscope.useLoopHook, implement .beforeEachCycle,
.beforeReportingState(), or .afterEachCycle() instead.

If your plugins are up-to-date, and you are not a developer, it is
usually safe to ignore this message. Especally if the full error
points to a line containing legacyLoopHook or legacyEventHandler.

[-Wdeprecated-declarations]
Kaleidoscope.useLoopHook(legacyLoopHook);