"borrow your laptop?"

It finally happened yesterday. One of my partners wanted to use my keyboardio “for a minute” and I had to rattle off a list of customizations that made it more or less impossible for them to use. It was too intimidating for them to even try. I got a “nevermind,” and this comic was dredged up to tease me:

So I want to figure out a way to reversibly put the keyboard back to the factory keymaps to cover this case. I want to be able to evangelize the Model 01 when friends come to visit and when I’m out and about with it, and “Yeah it’s pretty, but you don’t want to touch it” isn’t a good start towards that.

As a first step I think I’ll make a new layer “FACTORY” and map the PROG key to ShiftToLayer(FACTORY), but having a weird chord that would set up all three layers in a factory state and then unset them when chorded again would be even better. I guess I could make FN-PROG enable an FN_FACTORY layer too, and since I’m not really using NUMPAD, that would do the trick. hmm. Assuming I’m correct in my understanding of how layers work.

6 Likes

This is a great idea; I’ve had the same problem before with just a normal keyboard + tons of weird mappings, so I imagine the keyboardio will be even worse. Being able to easier switch layout would definitely be handy (although I’m planning on using Linear A keycaps, so maybe not :p)

I know @algernon has used MagicCombos to make ways of switching to other layers by mashing a bunch of keys (https://github.com/algernon/Model01-sketch/blob/master/src/MagicCombo.cpp); that might be something to look into.

3 Likes

I can envision a number of ways to trigger switching layer combinations, from a dedicated keys, through MagicCombos, to sending a command through Focus. But the more interesting part is how to switch all layers? You don’t want to replace the existing ones (so that the operation remains reversible). You don’t want to over-complicate the keymap, either.

So here’s an easy thing to do: take the factory keymap, paste it after your own, and adjust the layers in the factory keymap, then you can create a macro that toggles your layers off, and enables FACTORY (or does the opposite).

In other words:

enum { DVORAK, FN, FACTORY_QWERTY, FACTORY_FN, FACTORY_NUMPAD };
const Key keymaps[][ROWS][COLS] PROGMEM = {
  [DVORAK] = KEYMAP_STACKED(...),
  [FN] = KEYMAP_STACKED(...),
  [FACTORY_QWERTY] = ...,
  ...
};

On the FACTORY_* layers you’d just use ShiftToLayer(FACTORY_FN) instead of ShiftToLayer(FN), and so on, and you’d have a macro on - say, Prog - that does something along these lines:

static void toggleFactoryLayout(uint8_t keyState) {
  if (!keyToggledOn(keyState))
    return;

  if (Layer.isOn(DVORAK)) {
    Layer.move(FACTORY_QWERTY);
  } else {
    Layer.move(DVORAK);
  }
}

Adapting this to use MagicCombos, TapDance, or any other method is left as an exercise for the reader.

The downside of this is that this increases the firmware size considerably (128 bytes / layer, for a total of 384 bytes for the factory layers), so if you have a lot of stuff in your firmware, this isn’t an option. One could also play tricks with having the factory firmware in PROGMEM, and your own in EEPROM, and a macro that toggles where keys are looked up from. The downside of that would be that it is slightly more complicated, but uses less PROGMEM, at the cost of EEPROM, but if you ever want to use Chrysalis or similar tools, you’ll need your keymap in EEPROM anyway.

Right. Lots of words, little sense. Let me know if further explanation is helpful. I’ll go and get some caffeine into my system.

3 Likes

(Myself, I’d put the trigger on PALMS + QWERTY, because that’s easy to explain)

1 Like

This is another case where I feel like I’d like us to have a function that runs as a layer is toggled on or off. It’d let us set up nice keymap-specific LED effects, so folks know they’re on the factory maps.

4 Likes

Somewhat off-topic (maybe we could fork this to a new thread), is there documentation about moving things to EEPROM? Looking at your keyboard layout repo, I kind of see how you’ve done it, but I’m not completely clear (and if people want to use the nice GUI, presumably that is something they’ll need to do?)

There are some docs about the various EEPROM plugins, but no comprehensive documentation that would be useful for people less familiar with the firmware. :frowning:

If anyone goes through and takes notes I would love to incorporate them! Eventually I want layman’s docs for all the included functions, plugins, etc. Probably will take me a couple months realtime, but I’ll get there!

2 Likes