Set auto start layer for keyboard


(Andreas Jacobsen) #1

Hello! After trying our Crysalis I found that I could not (yet) be lazy and costumize my keyboard without code. But it’s starting to look real good!

When trying to get my old firmware back I decided to clean it up a bit by downloading the newest firmware file and trying to get that to work with old code, and cleaning up some things.

For my old code (when I say my I mean code basically written by this community for me, thanks for that!) I had a modifier key to open up my Norwegian layer. When holding this modifier key down I had access to my Norwegian keys. This is the same way as I want the new setup to work, I also made a gaming layer.

But whenever I start the keyboard it auto starts in Norwegian layer mode, NOT primary. When shifting to GAMING layer I cannot get out of it, even though the gaming layer should have a way back to the PRIMARY layer

 [GAMING] =  KEYMAP_STACKED
  (ShiftToLayer(PRIMARY), ___, ___, ___, ___, ___,   ___,
   ___, ___, ___, ___, ___, ___, ___,
   Key_Tab, ___, ___, ___, ___, ___,
   Key_LeftShift, ___, ___, ___, ___, ___, ___,
   ___, Key_Spacebar, Key_Backspace, ___,
   ___,

   ___, ___, ___, ___, ___,           ___,           ___,
   ___,               ___, ___, ___, ___,           ___, ___,
                  ___, ___, ___,  ___, ___, ___,
   ___,               ___, ___, ___, ___,           ___,           ___,
   ___, ___, Key_Backspace, ___,
   ___),

So if I open the gaming layer, I`m locked inn there. Keyboard auto starts in Norwegian mode. its almost like the PRIMARY mode is not accessible? I couldn’t figure out where the bug in my code is, maybe one of you guys can! Full code at https://github.com/AndreasJacobsen/Model01-Firmware/blob/master/Model01-Firmware.ino

PS: If anyone knows of a better way than Compose to show Norwegian letters do tell.


(Gergely Nagy) #2

Regarding starting up in Norwegian: you can use Chrysalis to set the default layer, that should fix it.

Getting back to Primary from GAMING: ShiftToLayer will not work there, because PRIMARY is a lower layer than GAMING, and layers stack. When you press ShiftToLayer(PRIMARY) it does activate it, but GAMING keeps being active too, and since that’s higher, it shadows PRIMARY. For now, the best way would be to have a macro that moves you back to the Primary layer: Layer.move(PRIMARY).


(Andreas Jacobsen) #3

Thank you for the quick reply, setting default layer in Chrysalis did fix the issue! It seems that I can shift between the gaming layer and primary layer just fine now as well. Not sure why it works, but it does work.

Now for some sleep before I try my hands on the LED effects tomorrow.