X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=common%2Fcommand.c;h=202d531fd83363a0f9e08a6c6e38d55a366a7a31;hb=5d6b848a157a2e94859949961297d40da6a77527;hp=4c874b1092f75fee5962bb68d384080be1c05686;hpb=a4aae1c5055d24c400f78fd44618aef5916adc0c;p=max%2Ftmk_keyboard.git diff --git a/common/command.c b/common/command.c index 4c874b10..202d531f 100644 --- a/common/command.c +++ b/common/command.c @@ -26,7 +26,9 @@ along with this program. If not, see . #include "timer.h" #include "keyboard.h" #include "bootloader.h" +#include "layer_switch.h" #include "command.h" + #ifdef MOUSEKEY_ENABLE #include "mousekey.h" #endif @@ -53,7 +55,7 @@ static void mousekey_console_help(void); #endif static uint8_t numkey2num(uint8_t code); -static void switch_layer(uint8_t layer); +static void switch_default_layer(uint8_t layer); typedef enum { ONESHOT, CONSOLE, MOUSEKEY } cmdstate_t; @@ -264,16 +266,13 @@ static bool command_common(uint8_t code) case KC_ESC: case KC_GRV: case KC_0: - clear_keyboard(); - switch_layer(0); + switch_default_layer(0); break; case KC_1 ... KC_9: - clear_keyboard(); - switch_layer((code - KC_1) + 1); + switch_default_layer((code - KC_1) + 1); break; case KC_F1 ... KC_F12: - clear_keyboard(); - switch_layer((code - KC_F1) + 1); + switch_default_layer((code - KC_F1) + 1); break; default: print("?"); @@ -542,11 +541,10 @@ static uint8_t numkey2num(uint8_t code) return 0; } -static void switch_layer(uint8_t layer) +static void switch_default_layer(uint8_t layer) { - print_val_hex8(current_layer); - print_val_hex8(default_layer); - default_layer = layer; - current_layer = 0; - print("switch to "); print_val_hex8(layer); + print("switch_default_layer: "); print_dec(default_layer); print(" to "); print_dec(layer); print("\n"); + default_layer_set(layer); + overlay_clear(); + clear_keyboard(); }