]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
oneshot timeout would only timeout after an event.
authorSjB <steve@sagacity.ca>
Mon, 16 Jan 2017 04:12:42 +0000 (23:12 -0500)
committerSjB <steve@sagacity.ca>
Mon, 16 Jan 2017 04:29:24 +0000 (23:29 -0500)
After setting a ONESHOT_TIMEOUT value, the oneshot layer state would
not expire without an event being triggered (key pressed). The reason
was that in the process_record function we would return priort to
execute the process_action function if it detected a NOEVENT cycle. The
process_action contained the codes to timeout the oneshot layer state.
The codes to clear the oneshot layer state have been move just in
front of where we check for the NOEVENT cycle in the process_record
function.

tmk_core/common/action.c

index d485b46c77cf83f81967d9af2060cd0f42fd3a66..a77177240badd889ffa2f264996b31c9dbc93dcd 100644 (file)
@@ -102,6 +102,13 @@ bool process_record_quantum(keyrecord_t *record) {
 
 void process_record(keyrecord_t *record) 
 {
+#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
+    if (has_oneshot_layer_timed_out()) {
+        dprintf("Oneshot layer: timeout\n");
+        clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
+    }
+#endif
+
     if (IS_NOEVENT(record->event)) { return; }
 
     if(!process_record_quantum(record))
@@ -126,13 +133,6 @@ void process_action(keyrecord_t *record, action_t action)
     uint8_t tap_count = record->tap.count;
 #endif
 
-#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
-    if (has_oneshot_layer_timed_out()) {
-        dprintf("Oneshot layer: timeout\n");
-        clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
-    }
-#endif
-
     if (event.pressed) {
         // clear the potential weak mods left by previously pressed keys
         clear_weak_mods();