Why not find the LockLayer(NUMPAD) key in the onSetup function?

WRT this line in the NumPad plugin which finds out the location of the LockLayer(NUMPAD) key, why is this placed here to be executed at every cycle instead of in the onSetup function since the keymap isn’t going to change after compilation?

Because with EEPROMKeymap, the keymap can change, and because we want to search a LockLayer(NUMPAD) that is currently active. If we searched in onSetup(), we’d need to remember the coordinates and the layer of every LockLayer(NUMPAD), and also account for transparency. That’s a lot of bookkeeping, so we just search every cycle. Since we go over the whole active keymap anyway, pushing this to onSetup wouldn’t buy us all that much.

1 Like