From 4a597e031fb2b4e9129f4e719bc20f2e72b0bbdf Mon Sep 17 00:00:00 2001 From: stanrc85 <47038504+stanrc85@users.noreply.github.com> Date: Thu, 7 Mar 2019 20:13:02 -0500 Subject: [PATCH] [Keymap] Smarter KC_MAKE code and removed duplicate MOD_MASK entries (#5331) * Change to predefined MOD_MASK codes * Remove duplicate predefined codes * Better reset keybaord logic * Cleaned up code as requested --- users/stanrc85/stanrc85.c | 18 ++++++++---------- users/stanrc85/stanrc85.h | 3 --- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/users/stanrc85/stanrc85.c b/users/stanrc85/stanrc85.c index ecf3641172..bddc14d7e2 100644 --- a/users/stanrc85/stanrc85.c +++ b/users/stanrc85/stanrc85.c @@ -9,30 +9,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_MAKE: if (!record->event.pressed) { - uint8_t temp_mod = get_mods(); - uint8_t temp_osm = get_oneshot_mods(); + uint8_t mods = get_mods(); clear_mods(); - clear_oneshot_mods(); send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), 10); - if (temp_mod & MODS_SHIFT_MASK || temp_osm & MODS_SHIFT_MASK ) { + if (mods & MOD_MASK_SHIFT) { //RESET board for flashing if SHIFT held or tapped with KC_MAKE #if defined(__arm__) send_string_with_delay_P(PSTR(":dfu-util"), 10); - wait_ms(100); - reset_keyboard(); #elif defined(BOOTLOADER_DFU) send_string_with_delay_P(PSTR(":dfu"), 10); #elif defined(BOOTLOADER_HALFKAY) send_string_with_delay_P(PSTR(":teensy"), 10); #elif defined(BOOTLOADER_CATERINA) send_string_with_delay_P(PSTR(":avrdude"), 10); - #else - reset_keyboard(); #endif // bootloader options + send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 10); + reset_keyboard(); + } + if (mods & MOD_MASK_CTRL) { + send_string_with_delay_P(PSTR(" -j8 --output-sync"), 10); } - if (temp_mod & MODS_CTRL_MASK || temp_osm & MODS_CTRL_MASK) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), 10); } send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 10); - set_mods(temp_mod); + set_mods(mods); } return false; break; diff --git a/users/stanrc85/stanrc85.h b/users/stanrc85/stanrc85.h index 091c810707..1d9602a05e 100644 --- a/users/stanrc85/stanrc85.h +++ b/users/stanrc85/stanrc85.h @@ -13,9 +13,6 @@ enum custom_keycodes { NEW_SAFE_RANGE //use "NEW_SAFE_RANGE" for keymap specific codes }; -#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) -#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL)) - //Aliases for longer keycodes #define KC_CAD LALT(LCTL(KC_DEL)) #define KC_LOCK LGUI(KC_L)