summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--quantum/action.c10
-rw-r--r--quantum/action_util.c15
-rw-r--r--quantum/eeconfig.c2
-rw-r--r--quantum/eeconfig.h2
-rw-r--r--quantum/keycode_config.h2
5 files changed, 15 insertions, 16 deletions
diff --git a/quantum/action.c b/quantum/action.c
index 60301fa606..ef059f0e2a 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -101,7 +101,7 @@ void action_exec(keyevent_t event) {
101 keyrecord_t record = {.event = event}; 101 keyrecord_t record = {.event = event};
102 102
103#ifndef NO_ACTION_ONESHOT 103#ifndef NO_ACTION_ONESHOT
104 if (!keymap_config.oneshot_disable) { 104 if (keymap_config.oneshot_enable) {
105# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) 105# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
106 if (has_oneshot_layer_timed_out()) { 106 if (has_oneshot_layer_timed_out()) {
107 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); 107 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
@@ -258,7 +258,7 @@ void process_record(keyrecord_t *record) {
258 258
259 if (!process_record_quantum(record)) { 259 if (!process_record_quantum(record)) {
260#ifndef NO_ACTION_ONESHOT 260#ifndef NO_ACTION_ONESHOT
261 if (is_oneshot_layer_active() && record->event.pressed && !keymap_config.oneshot_disable) { 261 if (is_oneshot_layer_active() && record->event.pressed && keymap_config.oneshot_enable) {
262 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); 262 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
263 } 263 }
264#endif 264#endif
@@ -323,7 +323,7 @@ void process_action(keyrecord_t *record, action_t action) {
323# ifdef SWAP_HANDS_ENABLE 323# ifdef SWAP_HANDS_ENABLE
324 && !(action.kind.id == ACT_SWAP_HANDS && action.swap.code == OP_SH_ONESHOT) 324 && !(action.kind.id == ACT_SWAP_HANDS && action.swap.code == OP_SH_ONESHOT)
325# endif 325# endif
326 && !keymap_config.oneshot_disable) { 326 && keymap_config.oneshot_enable) {
327 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); 327 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
328 do_release_oneshot = !is_oneshot_layer_active(); 328 do_release_oneshot = !is_oneshot_layer_active();
329 } 329 }
@@ -367,7 +367,7 @@ void process_action(keyrecord_t *record, action_t action) {
367# ifndef NO_ACTION_ONESHOT 367# ifndef NO_ACTION_ONESHOT
368 case MODS_ONESHOT: 368 case MODS_ONESHOT:
369 // Oneshot modifier 369 // Oneshot modifier
370 if (keymap_config.oneshot_disable) { 370 if (!keymap_config.oneshot_enable) {
371 if (event.pressed) { 371 if (event.pressed) {
372 if (mods) { 372 if (mods) {
373 if (IS_MOD(action.key.code) || action.key.code == KC_NO) { 373 if (IS_MOD(action.key.code) || action.key.code == KC_NO) {
@@ -613,7 +613,7 @@ void process_action(keyrecord_t *record, action_t action) {
613# ifndef NO_ACTION_ONESHOT 613# ifndef NO_ACTION_ONESHOT
614 case OP_ONESHOT: 614 case OP_ONESHOT:
615 // Oneshot modifier 615 // Oneshot modifier
616 if (keymap_config.oneshot_disable) { 616 if (!keymap_config.oneshot_enable) {
617 if (event.pressed) { 617 if (event.pressed) {
618 layer_on(action.layer_tap.val); 618 layer_on(action.layer_tap.val);
619 } else { 619 } else {
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) {
155 * FIXME: needs doc 155 * FIXME: needs doc
156 */ 156 */
157void set_oneshot_layer(uint8_t layer, uint8_t state) { 157void set_oneshot_layer(uint8_t layer, uint8_t state) {
158 if (!keymap_config.oneshot_disable) { 158 if (keymap_config.oneshot_enable) {
159 oneshot_layer_data = layer << 3 | state; 159 oneshot_layer_data = layer << 3 | state;
160 layer_on(layer); 160 layer_on(layer);
161# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) 161# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
@@ -184,7 +184,7 @@ void reset_oneshot_layer(void) {
184void clear_oneshot_layer_state(oneshot_fullfillment_t state) { 184void clear_oneshot_layer_state(oneshot_fullfillment_t state) {
185 uint8_t start_state = oneshot_layer_data; 185 uint8_t start_state = oneshot_layer_data;
186 oneshot_layer_data &= ~state; 186 oneshot_layer_data &= ~state;
187 if ((!get_oneshot_layer_state() && start_state != oneshot_layer_data) && !keymap_config.oneshot_disable) { 187 if ((!get_oneshot_layer_state() && start_state != oneshot_layer_data) && keymap_config.oneshot_enable) {
188 layer_off(get_oneshot_layer()); 188 layer_off(get_oneshot_layer());
189 reset_oneshot_layer(); 189 reset_oneshot_layer();
190 } 190 }
@@ -202,9 +202,8 @@ bool is_oneshot_layer_active(void) {
202 * FIXME: needs doc 202 * FIXME: needs doc
203 */ 203 */
204void oneshot_set(bool active) { 204void oneshot_set(bool active) {
205 const bool disable = !active; 205 if (keymap_config.oneshot_enable != active) {
206 if (keymap_config.oneshot_disable != disable) { 206 keymap_config.oneshot_enable = active;
207 keymap_config.oneshot_disable = disable;
208 eeconfig_update_keymap(keymap_config.raw); 207 eeconfig_update_keymap(keymap_config.raw);
209 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); 208 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
210 dprintf("Oneshot: active: %d\n", active); 209 dprintf("Oneshot: active: %d\n", active);
@@ -216,7 +215,7 @@ void oneshot_set(bool active) {
216 * FIXME: needs doc 215 * FIXME: needs doc
217 */ 216 */
218void oneshot_toggle(void) { 217void oneshot_toggle(void) {
219 oneshot_set(!keymap_config.oneshot_disable); 218 oneshot_set(!keymap_config.oneshot_enable);
220} 219}
221 220
222/** \brief enable oneshot 221/** \brief enable oneshot
@@ -236,7 +235,7 @@ void oneshot_disable(void) {
236} 235}
237 236
238bool is_oneshot_enabled(void) { 237bool is_oneshot_enabled(void) {
239 return !keymap_config.oneshot_disable; 238 return keymap_config.oneshot_enable;
240} 239}
241 240
242#endif 241#endif
@@ -414,7 +413,7 @@ void del_oneshot_mods(uint8_t mods) {
414 * FIXME: needs doc 413 * FIXME: needs doc
415 */ 414 */
416void set_oneshot_mods(uint8_t mods) { 415void set_oneshot_mods(uint8_t mods) {
417 if (!keymap_config.oneshot_disable) { 416 if (keymap_config.oneshot_enable) {
418 if (oneshot_mods != mods) { 417 if (oneshot_mods != mods) {
419# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) 418# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
420 oneshot_time = timer_read(); 419 oneshot_time = timer_read();
diff --git a/quantum/eeconfig.c b/quantum/eeconfig.c
index 14cd5887f4..0ff9996ca4 100644
--- a/quantum/eeconfig.c
+++ b/quantum/eeconfig.c
@@ -46,7 +46,7 @@ void eeconfig_init_quantum(void) {
46 eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0); 46 eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0);
47 default_layer_state = 0; 47 default_layer_state = 0;
48 eeprom_update_byte(EECONFIG_KEYMAP_LOWER_BYTE, 0); 48 eeprom_update_byte(EECONFIG_KEYMAP_LOWER_BYTE, 0);
49 eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, 0); 49 eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, 0x4);
50 eeprom_update_byte(EECONFIG_MOUSEKEY_ACCEL, 0); 50 eeprom_update_byte(EECONFIG_MOUSEKEY_ACCEL, 0);
51 eeprom_update_byte(EECONFIG_BACKLIGHT, 0); 51 eeprom_update_byte(EECONFIG_BACKLIGHT, 0);
52 eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default 52 eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default
diff --git a/quantum/eeconfig.h b/quantum/eeconfig.h
index f3cd1867ab..565a0dbe5b 100644
--- a/quantum/eeconfig.h
+++ b/quantum/eeconfig.h
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21#include <stdbool.h> 21#include <stdbool.h>
22 22
23#ifndef EECONFIG_MAGIC_NUMBER 23#ifndef EECONFIG_MAGIC_NUMBER
24# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE9 // When changing, decrement this value to avoid future re-init issues 24# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE8 // When changing, decrement this value to avoid future re-init issues
25#endif 25#endif
26#define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF 26#define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF
27 27
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h
index d7e334fdc8..a2cb025ed2 100644
--- a/quantum/keycode_config.h
+++ b/quantum/keycode_config.h
@@ -37,7 +37,7 @@ typedef union {
37 bool nkro : 1; 37 bool nkro : 1;
38 bool swap_lctl_lgui : 1; 38 bool swap_lctl_lgui : 1;
39 bool swap_rctl_rgui : 1; 39 bool swap_rctl_rgui : 1;
40 bool oneshot_disable : 1; 40 bool oneshot_enable : 1;
41 }; 41 };
42} keymap_config_t; 42} keymap_config_t;
43 43