summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quantum/action_code.h1
-rw-r--r--quantum/keymap_common.c8
-rw-r--r--quantum/quantum_keycodes.h11
3 files changed, 6 insertions, 14 deletions
diff --git a/quantum/action_code.h b/quantum/action_code.h
index 20b3e459d2..e107f0a740 100644
--- a/quantum/action_code.h
+++ b/quantum/action_code.h
@@ -234,6 +234,7 @@ enum layer_param_tap_op {
#define ACTION_LAYER_INVERT(layer, on) ACTION_LAYER_BIT_XOR((layer) / 4, 1 << ((layer) % 4), (on))
#define ACTION_LAYER_ON(layer, on) ACTION_LAYER_BIT_OR((layer) / 4, 1 << ((layer) % 4), (on))
#define ACTION_LAYER_OFF(layer, on) ACTION_LAYER_BIT_AND((layer) / 4, ~(1 << ((layer) % 4)), (on))
+#define ACTION_LAYER_GOTO(layer) ACTION_LAYER_SET(layer, ON_PRESS)
#define ACTION_LAYER_SET(layer, on) ACTION_LAYER_BIT_SET((layer) / 4, 1 << ((layer) % 4), (on))
#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF)
#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON)
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index c1940f0fd3..8d7a8bda9a 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -47,10 +47,9 @@ action_t action_for_keycode(uint16_t keycode) {
keycode = keycode_config(keycode);
action_t action = {};
- uint8_t action_layer, when, mod;
+ uint8_t action_layer, mod;
(void)action_layer;
- (void)when;
(void)mod;
switch (keycode) {
@@ -85,9 +84,8 @@ action_t action_for_keycode(uint16_t keycode) {
break;
case QK_TO ... QK_TO_MAX:;
// Layer set "GOTO"
- when = (keycode >> 0x4) & 0x3;
- action_layer = keycode & 0xF;
- action.code = ACTION_LAYER_SET(action_layer, when);
+ action_layer = keycode & 0xFF;
+ action.code = ACTION_LAYER_GOTO(action_layer);
break;
case QK_MOMENTARY ... QK_MOMENTARY_MAX:;
// Momentary action_layer
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 456fad6f1b..7228ee9e08 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -797,15 +797,8 @@ enum quantum_keycodes {
#define EH_LEFT MAGIC_EE_HANDS_LEFT
#define EH_RGHT MAGIC_EE_HANDS_RIGHT
-// GOTO layer - 16 layers max
-// when:
-// ON_PRESS = 1
-// ON_RELEASE = 2
-// Unless you have a good reason not to do so, prefer ON_PRESS (1) as your default.
-// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own
-// keycode modeled after the old version, kept below for this.
-/* #define TO(layer, when) (QK_TO | (when << 0x4) | (layer & 0xFF)) */
-#define TO(layer) (QK_TO | (ON_PRESS << 0x4) | ((layer)&0xFF))
+// GOTO layer - 256 layer max
+#define TO(layer) (QK_TO | ((layer)&0xFF))
// Momentary switch layer - 256 layer max
#define MO(layer) (QK_MOMENTARY | ((layer)&0xFF))