simplify a bit of logic

pull/30/head
Jesse Vincent 8 years ago
parent 785ada3559
commit 597d2acae5

@ -69,8 +69,8 @@ bool handle_key_event_default(byte row, byte col, uint8_t currentState, uint8_t
Key mappedKey = lookup_key(temporary_keymap, row, col); Key mappedKey = lookup_key(temporary_keymap, row, col);
Key baseKey = lookup_key(primary_keymap, row, col); Key baseKey = lookup_key(primary_keymap, row, col);
if ((baseKey.flags == (SYNTHETIC | SWITCH_TO_KEYMAP)) if ((baseKey.flags & SWITCH_TO_KEYMAP
|| (baseKey.flags == (SYNTHETIC | SWITCH_TO_KEYMAP_MOMENTARY))) { || baseKey.flags & SWITCH_TO_KEYMAP_MOMENTARY)) {
handle_keymap_key_event(baseKey, currentState, previousState); handle_keymap_key_event(baseKey, currentState, previousState);
} else if (mappedKey.flags & SYNTHETIC) { } else if (mappedKey.flags & SYNTHETIC) {
handle_synthetic_key_event( mappedKey, currentState, previousState); handle_synthetic_key_event( mappedKey, currentState, previousState);
@ -101,7 +101,7 @@ void press_key(Key mappedKey) {
void handle_keymap_key_event(Key keymapEntry, uint8_t currentState, uint8_t previousState) { void handle_keymap_key_event(Key keymapEntry, uint8_t currentState, uint8_t previousState) {
if (keymapEntry.flags == (SYNTHETIC| SWITCH_TO_KEYMAP_MOMENTARY )) { if (keymapEntry.flags & SWITCH_TO_KEYMAP_MOMENTARY ) {
if (key_toggled_on(currentState, previousState)) { if (key_toggled_on(currentState, previousState)) {
if ( keymapEntry.rawKey == KEYMAP_NEXT) { if ( keymapEntry.rawKey == KEYMAP_NEXT) {
temporary_keymap++; temporary_keymap++;

Loading…
Cancel
Save