summaryrefslogtreecommitdiff
path: root/quantum/action_util.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-03-13 18:11:42 -0700
committerGitHub <noreply@github.com>2022-03-14 01:11:42 +0000
commitb8574efcd67a394c423ac29ce280ee09517a1aee (patch)
tree1b8b4e6250fbcac53dff50acadb403a7d2199e1f /quantum/action_util.c
parent42d084d1c0816366a68b8614b395062fc6e47ec0 (diff)
Fix oneshot toggle logic (#16630)
* Fix oneshot toggle logic * Enable oneshots by default * Decrement eeconfig magic number due to eeconfig changes
Diffstat (limited to 'quantum/action_util.c')
-rw-r--r--quantum/action_util.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/quantum/action_util.c b/quantum/action_util.c
index cf81370d4a..738410a4ac 100644
--- a/quantum/action_util.c
+++ b/quantum/action_util.c
@@ -155,7 +155,7 @@ void clear_oneshot_swaphands(void) {
* FIXME: needs doc
*/
void set_oneshot_layer(uint8_t layer, uint8_t state) {
- if (!keymap_config.oneshot_disable) {
+ if (keymap_config.oneshot_enable) {
oneshot_layer_data = layer << 3 | state;
layer_on(layer);
# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
@@ -184,7 +184,7 @@ void reset_oneshot_layer(void) {
void clear_oneshot_layer_state(oneshot_fullfillment_t state) {
uint8_t start_state = oneshot_layer_data;
oneshot_layer_data &= ~state;
- if ((!get_oneshot_layer_state() && start_state != oneshot_layer_data) && !keymap_config.oneshot_disable) {
+ if ((!get_oneshot_layer_state() && start_state != oneshot_layer_data) && keymap_config.oneshot_enable) {
layer_off(get_oneshot_layer());
reset_oneshot_layer();
}
@@ -202,9 +202,8 @@ bool is_oneshot_layer_active(void) {
* FIXME: needs doc
*/
void oneshot_set(bool active) {
- const bool disable = !active;
- if (keymap_config.oneshot_disable != disable) {
- keymap_config.oneshot_disable = disable;
+ if (keymap_config.oneshot_enable != active) {
+ keymap_config.oneshot_enable = active;
eeconfig_update_keymap(keymap_config.raw);
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
dprintf("Oneshot: active: %d\n", active);
@@ -216,7 +215,7 @@ void oneshot_set(bool active) {
* FIXME: needs doc
*/
void oneshot_toggle(void) {
- oneshot_set(!keymap_config.oneshot_disable);
+ oneshot_set(!keymap_config.oneshot_enable);
}
/** \brief enable oneshot
@@ -236,7 +235,7 @@ void oneshot_disable(void) {
}
bool is_oneshot_enabled(void) {
- return !keymap_config.oneshot_disable;
+ return keymap_config.oneshot_enable;
}
#endif
@@ -414,7 +413,7 @@ void del_oneshot_mods(uint8_t mods) {
* FIXME: needs doc
*/
void set_oneshot_mods(uint8_t mods) {
- if (!keymap_config.oneshot_disable) {
+ if (keymap_config.oneshot_enable) {
if (oneshot_mods != mods) {
# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
oneshot_time = timer_read();