Compilation errors with complaints about keymap_stacked?

I’m trying to remap my keys and it keeps saying unterminated argument invoking argument keymap stacked. What does that mean?

Can you paste in (or upload as an attachment) the .ino sketch file you’re working with? (Also, if you can paste the exact text of the error, we may be able to figure out what’s up quicker.

Maybe I’ll wait till we get the drivers sorted out. I remapped a fair number of keys because there are some I don’t use and some that didn’t work, for me. I may just start over but with all this typing I’m starting to get used to some of them. My fingers aren’t long enough to reach the shift keys.

Sure thing. My guess is a missing quotation mark, bracket or paren.

(For what it’s worth, I frequently use the “other hand” for shift and a little wrist motion is, as I understand it, better for you than keeping your wrists locked.)

I’ve also encountered this error by having an extra comma before the ) closing the KEYMAP_STACKED macro.


I can see this being a common complaint, particularly since most people are likely to use cut and paste a lot in the layer definitions - which is a highly efficient way to get spurious trailing separators…

Is there any way that the KEYMAP_STACKED macro could be trained to be permissive of trailing separators? Some languages have it out of the box and it is a godsend. I can’t think of a way myself but I’m far from a macro programming expert…

1 Like

It is possible, but… at the cost of potentially hiding errors. For example, if we make the macro ignore extra arguments (which is how we can ignore the trailing comma), it will also succeed when we have a comma at the beginning, and then the whole keymap will be shifted by one key.

So I’m leaning towards keeping the macro as-is, and adding documentation. In the longer term, Chrysalis will also be an option for remapping keys, and that’ll make the whole experience a lot smoother.


The only problem I have is I’m a transcriptionist and the thumb keys are presently designed more for programming. The more reaching and twisting I do the more it will slow me down and I’ll be more prone to strain. For me, a better layout for the thumb keys would be something like shift, space, bkspace, instead of cntrl, bckspace, cmd as I don’t use ctrl or command. Unfortunately I got a bit overambitious. It would be useful to have a cntrl key somewhere, but I don’t need two of them. I do, however, need two space bars.

What about the following (abreviated example)?

#include <iostream>
#include <algorithm>

   static_assert(0 == sizeof((int[]){__VA_ARGS__}), \
      "Error: Strange arguments in call to KEYMAP_STACKED. Make sure the number of arguments matches the required number and there are no dangling commas at the end of the argument list.") 
#define KEYMAP_STACKED(r0c0, r0c1, ...) \
  {r0c0, ([]{ASSERT_VA_ARGS_COUNT_ZERO(__VA_ARGS__);}, r0c1) }
int main()
   int a[] = KEYMAP_STACKED(1, 2);
   int b[] = KEYMAP_STACKED(1, 2,);
   int c[] = KEYMAP_STACKED(1, 2, 3);
   int d[] = KEYMAP_STACKED(, 2, 3);  
   std::cout << "keymap: ";
   std::for_each(a, a + sizeof(a)/sizeof(int), 
                 [](int val) { std::cout << val << " "; });
   std::cout << std::endl;
1 Like

Yes, I also find the default position of the thumb modifiers odd. I rolled around the modifiers so that cmd and alt became shift keys, the shift keys became alt and altgr, and the butterfly key became cmd.

Ctrl Bksp Shift Alt - Altgr Shift Space Ctrl

This makes it a lot easier to touch type with altgr as a level 3 shift, as required by many non-us layouts.

I use right-ctrl as compose, so I need two ctrl keys, but I understand those who don’t. If you need a homed space on both thumbs, perhaps left-ctrl would be a good place for backspace?

Something like that but I definitely have to have the shift key closer. I know you can’t please everybody because we all have our own use for the computer and that’s the joy of a programmable keyboard. I know how to program the board, I just need to get this driver thing sorted out so that it talks to the programmer.


That is 100% on me. I thought I’d make progress yesterday, but between a very cute and slightly demanding infant, and four hours working by phone and email with the factory, I didn’t get there. It’s still my top engineering priority and I desperately hope to get there today.

All things considered, you’ve an amazing job with this whole thing. This is just fine tuning now.