From 5cb713148dbc319167517df370ca9dd774ceb31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 18 Feb 2019 07:23:32 +0100 Subject: Change Command keycode defaults to match corresponding Bootmagic codes (#5078) * Change Command keycode defaults to match corresponding Bootmagic codes * Make alternate magic key keycodes consistent * Reflect changes from previous commit in tmk_core/common/command.c * Remove unnecessary MAGIC_KEY_* definitions from keymaps compatible with these changes * Swap E and BSPACE for MAGIC_KEY_EEPROM * Add MAGIC_KEY_EEPROM_CLEAR instead of MAGIC_KEY_EEPROM_ALT * Remove BOOTMAGIC_ENABLE checks around EECONFIG stuff * Update Command descriptions --- tmk_core/common/command.c | 31 ++++++++++++++++--------------- tmk_core/common/command.h | 34 +++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 30 deletions(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index aab99290d2..d3884d9fa9 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -151,17 +151,17 @@ static void command_common_help(void) "0-9: Switch to Layer 0-9\n" #endif - STR(MAGIC_KEY_LAYER0_ALT1 ) ": Switch to Layer 0 (alternate key 1)\n" - STR(MAGIC_KEY_LAYER0_ALT2 ) ": Switch to Layer 0 (alternate key 2)\n" - STR(MAGIC_KEY_BOOTLOADER ) ": Jump to Bootloader (Reset)\n" + STR(MAGIC_KEY_LAYER0_ALT ) ": Switch to Layer 0 (alternate)\n" + + STR(MAGIC_KEY_BOOTLOADER ) ": Jump to Bootloader\n" + STR(MAGIC_KEY_BOOTLOADER_ALT) ": Jump to Bootloader (alternate)\n" #ifdef KEYBOARD_LOCK_ENABLE - STR(MAGIC_KEY_LOCK ) ": Lock\n" + STR(MAGIC_KEY_LOCK ) ": Lock Keyboard\n" #endif -#ifdef BOOTMAGIC_ENABLE STR(MAGIC_KEY_EEPROM ) ": Print EEPROM Settings\n" -#endif + STR(MAGIC_KEY_EEPROM_CLEAR) ": Clear EEPROM\n" #ifdef NKRO_ENABLE STR(MAGIC_KEY_NKRO ) ": NKRO Toggle\n" @@ -265,7 +265,6 @@ static void print_status(void) return; } -#ifdef BOOTMAGIC_ENABLE static void print_eeconfig(void) { @@ -305,7 +304,6 @@ static void print_eeconfig(void) #endif /* !NO_PRINT */ } -#endif /* BOOTMAGIC_ENABLE */ static bool command_common(uint8_t code) { @@ -326,14 +324,17 @@ static bool command_common(uint8_t code) break; #endif -#ifdef BOOTMAGIC_ENABLE - // print stored eeprom config case MAGIC_KC(MAGIC_KEY_EEPROM): print("eeconfig:\n"); print_eeconfig(); break; -#endif + + // clear eeprom + case MAGIC_KC(MAGIC_KEY_EEPROM_CLEAR): + print("Clearing EEPROM\n"); + eeconfig_init(); + break; #ifdef KEYBOARD_LOCK_ENABLE @@ -352,8 +353,8 @@ static bool command_common(uint8_t code) #endif // print help - case MAGIC_KC(MAGIC_KEY_HELP1): - case MAGIC_KC(MAGIC_KEY_HELP2): + case MAGIC_KC(MAGIC_KEY_HELP): + case MAGIC_KC(MAGIC_KEY_HELP_ALT): command_common_help(); break; @@ -370,6 +371,7 @@ static bool command_common(uint8_t code) // jump to bootloader case MAGIC_KC(MAGIC_KEY_BOOTLOADER): + case MAGIC_KC(MAGIC_KEY_BOOTLOADER_ALT): clear_keyboard(); // clear to prevent stuck keys print("\n\nJumping to bootloader... "); #ifdef AUDIO_ENABLE @@ -453,8 +455,7 @@ static bool command_common(uint8_t code) // switch layers - case MAGIC_KC(MAGIC_KEY_LAYER0_ALT1): - case MAGIC_KC(MAGIC_KEY_LAYER0_ALT2): + case MAGIC_KC(MAGIC_KEY_LAYER0_ALT): switch_default_layer(0); break; diff --git a/tmk_core/common/command.h b/tmk_core/common/command.h index 052e251843..e7c7b0ea1d 100644 --- a/tmk_core/common/command.h +++ b/tmk_core/common/command.h @@ -50,12 +50,12 @@ bool command_proc(uint8_t code); #define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false #endif -#ifndef MAGIC_KEY_HELP1 -#define MAGIC_KEY_HELP1 H +#ifndef MAGIC_KEY_HELP +#define MAGIC_KEY_HELP H #endif -#ifndef MAGIC_KEY_HELP2 -#define MAGIC_KEY_HELP2 SLASH +#ifndef MAGIC_KEY_HELP_ALT +#define MAGIC_KEY_HELP_ALT SLASH #endif #ifndef MAGIC_KEY_DEBUG @@ -86,18 +86,14 @@ bool command_proc(uint8_t code); #define MAGIC_KEY_CONSOLE C #endif -#ifndef MAGIC_KEY_LAYER0_ALT1 -#define MAGIC_KEY_LAYER0_ALT1 ESC -#endif - -#ifndef MAGIC_KEY_LAYER0_ALT2 -#define MAGIC_KEY_LAYER0_ALT2 GRAVE -#endif - #ifndef MAGIC_KEY_LAYER0 #define MAGIC_KEY_LAYER0 0 #endif +#ifndef MAGIC_KEY_LAYER0_ALT +#define MAGIC_KEY_LAYER0_ALT GRAVE +#endif + #ifndef MAGIC_KEY_LAYER1 #define MAGIC_KEY_LAYER1 1 #endif @@ -135,7 +131,11 @@ bool command_proc(uint8_t code); #endif #ifndef MAGIC_KEY_BOOTLOADER -#define MAGIC_KEY_BOOTLOADER PAUSE +#define MAGIC_KEY_BOOTLOADER B +#endif + +#ifndef MAGIC_KEY_BOOTLOADER_ALT +#define MAGIC_KEY_BOOTLOADER_ALT ESC #endif #ifndef MAGIC_KEY_LOCK @@ -146,6 +146,10 @@ bool command_proc(uint8_t code); #define MAGIC_KEY_EEPROM E #endif +#ifndef MAGIC_KEY_EEPROM_CLEAR +#define MAGIC_KEY_EEPROM_CLEAR BSPACE +#endif + #ifndef MAGIC_KEY_NKRO #define MAGIC_KEY_NKRO N #endif @@ -155,5 +159,5 @@ bool command_proc(uint8_t code); #endif -#define XMAGIC_KC(key) KC_##key -#define MAGIC_KC(key) XMAGIC_KC(key) +#define XMAGIC_KC(key) KC_ ## key +#define MAGIC_KC(key) XMAGIC_KC(key) -- cgit v1.2.3