aboutsummaryrefslogtreecommitdiff
path: root/common/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/command.c')
-rw-r--r--common/command.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/common/command.c b/common/command.c
index 7bb2a23f1..202d531fd 100644
--- a/common/command.c
+++ b/common/command.c
@@ -26,7 +26,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
26#include "timer.h" 26#include "timer.h"
27#include "keyboard.h" 27#include "keyboard.h"
28#include "bootloader.h" 28#include "bootloader.h"
29#include "layer_switch.h"
29#include "command.h" 30#include "command.h"
31
30#ifdef MOUSEKEY_ENABLE 32#ifdef MOUSEKEY_ENABLE
31#include "mousekey.h" 33#include "mousekey.h"
32#endif 34#endif
@@ -53,7 +55,7 @@ static void mousekey_console_help(void);
53#endif 55#endif
54 56
55static uint8_t numkey2num(uint8_t code); 57static uint8_t numkey2num(uint8_t code);
56static void switch_layer(uint8_t layer); 58static void switch_default_layer(uint8_t layer);
57 59
58 60
59typedef enum { ONESHOT, CONSOLE, MOUSEKEY } cmdstate_t; 61typedef enum { ONESHOT, CONSOLE, MOUSEKEY } cmdstate_t;
@@ -261,18 +263,16 @@ static bool command_common(uint8_t code)
261#endif 263#endif
262 break; 264 break;
263#endif 265#endif
266 case KC_ESC:
267 case KC_GRV:
264 case KC_0: 268 case KC_0:
265 case KC_F10: 269 switch_default_layer(0);
266 clear_keyboard();
267 switch_layer(0);
268 break; 270 break;
269 case KC_1 ... KC_9: 271 case KC_1 ... KC_9:
270 clear_keyboard(); 272 switch_default_layer((code - KC_1) + 1);
271 switch_layer((code - KC_1) + 1);
272 break; 273 break;
273 case KC_F1 ... KC_F9: 274 case KC_F1 ... KC_F12:
274 clear_keyboard(); 275 switch_default_layer((code - KC_F1) + 1);
275 switch_layer((code - KC_F1) + 1);
276 break; 276 break;
277 default: 277 default:
278 print("?"); 278 print("?");
@@ -541,11 +541,10 @@ static uint8_t numkey2num(uint8_t code)
541 return 0; 541 return 0;
542} 542}
543 543
544static void switch_layer(uint8_t layer) 544static void switch_default_layer(uint8_t layer)
545{ 545{
546 print_val_hex8(current_layer); 546 print("switch_default_layer: "); print_dec(default_layer); print(" to "); print_dec(layer); print("\n");
547 print_val_hex8(default_layer); 547 default_layer_set(layer);
548 current_layer = layer; 548 overlay_clear();
549 default_layer = layer; 549 clear_keyboard();
550 print("switch to "); print_val_hex8(layer);
551} 550}