Leader doesn't work, macros execute twice

I’m adapting my old model 01 sketch to my new model 100. Ironed out the major issues (mostly just changes with the times) and am using the new keyboard to type this, but 3 things:

  1. I get the problem another person posted earlier, where LEDcontrol has no headers files (but it still compiles and I still appear to be able to control LED effects.

  2. I have a leader key that would start sequences like Leader - A would result in full stop, spacebar, Capital A. This doesn’t work, nothing is output. I thought that may be broken because I use it as the tapped part of a qukey, but it worked that way previously and all my other qukey combinations seem to be fine. Instead of doing what I expect, the leader key and the following key (like the A in my example) are swallowed, and the next key I press is executed normally.

static void leaderFSA(uint8_t seq_index) {
serial_port.println(F(“. A”));
}

static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary PROGMEM =
LEADER_DICT({LEADER_SEQ(LEAD(0), Key_A), leaderFSA});

  1. All of my macros execute twice. I have no idea why that might be. Version Info works as normal, the Any macro seems to work fine. All the ones that are repeating are of this form:
case MACRO_SWAP:
  return MACRO(I(25), D(LeftShift), T(LeftArrow), U(LeftShift), D(LeftControl), T(X), U(LeftControl), T(RightArrow), D(LeftControl), T(V), U(LeftControl));
  break;

(in this case, just to swap two letters around to fix typos quickly)

So I’m a bit stuck on this. Any help would be much appreciated! Am happy to post my sketch if that would be useful.

Posting the entire sketch would make it easier for me to review and reproduce the problem.

Thanks, algernon. Keyboardio/model100refit.ino at master · Llamalland/Keyboardio · GitHub

I think this thread might be the source of my double macro problem, at least. Will implement that tomorrow when I’m home.

Can confirm this fixed macros, so it’s only leader which is being problematic still.

I found that the documentation for leader gave this:

static void leaderTX(uint8_t seq_index) {
Kaleidoscope.serialPort().println(“leaderTX”);
}

Where the examples on arduino for leader said this:

static void leaderTestAA(uint8_t seq_index) {
serial_port.println(F(“leaderTestAA”));
}

(after “auto &serial_port = Kaleidoscope.serialPort();”, that is).

Is the F() part still relevant/needed? I’ve taken it out from my code anyway (I had it in before, since I went from Arduino’s example initially) and it still doesn’t function, still swallows the leader sequence keys. Either way, that should probably be made consistent across the docs.

Either works. F() is pretty much a no-op on the Model100 as far as I recall, it’s mostly an optimization for AVR, that tells the compiler to put the string in PROGMEM, without a copy in RAM. That’s not very relevant on the Model100.

I’ll try to look into the Leader issue tomorrow.

1 Like

Cool, thanks again. I’ve changed that key back to a macro that does a similar thing for now, it does more or less what I want it to do.