move the set_keymap conditional outside the set_keymap function

pull/18/head
Jesse Vincent 9 years ago
parent 9dfec10ecc
commit 91e256a913

@ -11,7 +11,6 @@ LEDControl BlinkyLights;
void set_keymap(Key keymapEntry, byte matrixStateEntry) { void set_keymap(Key keymapEntry, byte matrixStateEntry) {
if (keymapEntry.flags & SWITCH_TO_KEYMAP) {
// this logic sucks. there is a better way TODO this // this logic sucks. there is a better way TODO this
if (! (keymapEntry.flags ^ ( MOMENTARY | SWITCH_TO_KEYMAP))) { if (! (keymapEntry.flags ^ ( MOMENTARY | SWITCH_TO_KEYMAP))) {
if (key_toggled_on(matrixStateEntry)) { if (key_toggled_on(matrixStateEntry)) {
@ -34,7 +33,6 @@ void set_keymap(Key keymapEntry, byte matrixStateEntry) {
Storage.save_primary_keymap(primary_keymap); Storage.save_primary_keymap(primary_keymap);
} }
} }
}
} }
void scan_matrix() { void scan_matrix() {
@ -138,8 +136,9 @@ void handle_key_event(byte row, byte col) {
byte switchState = matrixState[row][col]; byte switchState = matrixState[row][col];
Key mappedKey = keymaps[temporary_keymap][row][col]; Key mappedKey = keymaps[temporary_keymap][row][col];
set_keymap(keymaps[primary_keymap][row][col], switchState); if (keymapEntry.flags & SWITCH_TO_KEYMAP) {
set_keymap(keymaps[primary_keymap][row][col], switchState);
}
if (mappedKey.flags & SYNTHETIC_KEY) { if (mappedKey.flags & SYNTHETIC_KEY) {
handle_synthetic_key_press(switchState, mappedKey); handle_synthetic_key_press(switchState, mappedKey);
} else { } else {

Loading…
Cancel
Save