diff options
| author | tmk <nobody@nowhere> | 2013-02-15 15:27:19 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-02-15 15:27:19 +0900 |
| commit | 2b811352a1497e28b946a49f9f31dc15dbda420b (patch) | |
| tree | 98b2502fd231d4916270b76632242a15bb27781d /common/command.c | |
| parent | 0c1d98bd3c0b0ea4f109d2515521f1fcbccf3d3f (diff) | |
| download | qmk_firmware-2b811352a1497e28b946a49f9f31dc15dbda420b.tar.gz qmk_firmware-2b811352a1497e28b946a49f9f31dc15dbda420b.zip | |
Fix switch_default_layer command
Diffstat (limited to 'common/command.c')
| -rw-r--r-- | common/command.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/common/command.c b/common/command.c index 4c874b109..c5b9f0431 100644 --- a/common/command.c +++ b/common/command.c | |||
| @@ -27,6 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 27 | #include "keyboard.h" | 27 | #include "keyboard.h" |
| 28 | #include "bootloader.h" | 28 | #include "bootloader.h" |
| 29 | #include "command.h" | 29 | #include "command.h" |
| 30 | #include "layer_stack.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 | ||
| 55 | static uint8_t numkey2num(uint8_t code); | 57 | static uint8_t numkey2num(uint8_t code); |
| 56 | static void switch_layer(uint8_t layer); | 58 | static void switch_default_layer(uint8_t layer); |
| 57 | 59 | ||
| 58 | 60 | ||
| 59 | typedef enum { ONESHOT, CONSOLE, MOUSEKEY } cmdstate_t; | 61 | typedef enum { ONESHOT, CONSOLE, MOUSEKEY } cmdstate_t; |
| @@ -264,16 +266,13 @@ static bool command_common(uint8_t code) | |||
| 264 | case KC_ESC: | 266 | case KC_ESC: |
| 265 | case KC_GRV: | 267 | case KC_GRV: |
| 266 | case KC_0: | 268 | case KC_0: |
| 267 | clear_keyboard(); | 269 | switch_default_layer(0); |
| 268 | switch_layer(0); | ||
| 269 | break; | 270 | break; |
| 270 | case KC_1 ... KC_9: | 271 | case KC_1 ... KC_9: |
| 271 | clear_keyboard(); | 272 | switch_default_layer((code - KC_1) + 1); |
| 272 | switch_layer((code - KC_1) + 1); | ||
| 273 | break; | 273 | break; |
| 274 | case KC_F1 ... KC_F12: | 274 | case KC_F1 ... KC_F12: |
| 275 | clear_keyboard(); | 275 | switch_default_layer((code - KC_F1) + 1); |
| 276 | switch_layer((code - KC_F1) + 1); | ||
| 277 | break; | 276 | break; |
| 278 | default: | 277 | default: |
| 279 | print("?"); | 278 | print("?"); |
| @@ -542,11 +541,14 @@ static uint8_t numkey2num(uint8_t code) | |||
| 542 | return 0; | 541 | return 0; |
| 543 | } | 542 | } |
| 544 | 543 | ||
| 545 | static void switch_layer(uint8_t layer) | 544 | static void switch_default_layer(uint8_t layer) |
| 546 | { | 545 | { |
| 547 | print_val_hex8(current_layer); | 546 | print_val_hex8(current_layer); |
| 548 | print_val_hex8(default_layer); | 547 | print_val_hex8(default_layer); |
| 549 | default_layer = layer; | ||
| 550 | current_layer = 0; | ||
| 551 | print("switch to "); print_val_hex8(layer); | 548 | print("switch to "); print_val_hex8(layer); |
| 549 | |||
| 550 | default_layer = layer; | ||
| 551 | current_layer = 0; /* 0 means default_layer */ | ||
| 552 | layer_stack_clear(); | ||
| 553 | clear_keyboard(); | ||
| 552 | } | 554 | } |
