-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature: DYNAMIC_TAPPING_TERM_ENABLE
#11036
Conversation
The errors that happen related to the |
492df44
to
9bf3fd7
Compare
e4bfe17
to
23cd912
Compare
The |
Sorry about that, GitHub decided to delete the |
This has some merge conflicts. |
23cd912
to
4a7fe01
Compare
Solved |
qmk/qmk_firmware#11036 Adds new quantum keys that makes it easier to adjust the tapping term on the fly without having to recompile.
a469e51
to
befc6de
Compare
What about renaming the feature "TAP_TERM_CHANGE_ENABLE" and renaming the keys to |
4cfba16
to
55de86f
Compare
Thank you for your contribution! |
This suggestion might be too close to the breaking change schedule, but |
TAP_TERM_KEYS_ENABLE
DYNAMIC_TAPPING_TERM_ENABLE
In a sense, I also prefer However, you did inspired me to rename it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with no anomalies on existing TAPPING_TERM
use cases.
ccb1e02
to
2287c8c
Compare
I rebased on top of latest develop and squashed my commits. |
I get 1.3kb back with the following diff, but it types out the padding spaces in front of the tapping term when pressing --- a/quantum/process_keycode/process_dynamic_tapping_term.c
+++ b/quantum/process_keycode/process_dynamic_tapping_term.c
@@ -14,7 +14,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdio.h>
#include "quantum.h"
#include "process_dynamic_tapping_term.h"
@@ -23,11 +22,7 @@
#endif
static void tapping_term_report(void) {
- char display[8];
-
- snprintf(display, sizeof(display), "%d", g_tapping_term);
-
- send_string((const char *)display);
+ send_string(get_u16_str(g_tapping_term, ' '));
}
bool process_dynamic_tapping_term(uint16_t keycode, keyrecord_t *record) { EDIT: tzarc pointed out that I could simply increment the char pointer returned by |
48ca3b7
to
2548936
Compare
3 new quantum keys to configure the tapping term on the fly.
15434f8
to
62ae36b
Compare
Solved a small conflict in quantum/action_tapping.c |
Missed opportunity to merge the PR on its 1 year birthday :p |
* qmk/develop: More headroom. (qmk#15302) More headroom. (qmk#15301) Documentation typo fix (qmk#15298) New feature: `DYNAMIC_TAPPING_TERM_ENABLE` (qmk#11036) Tidy up adjustable ws2812 timing (qmk#15299) Add ifndef to WS2812 timing constraints (qmk#14678) Add Retro Shift (Auto Shift for Tap Hold via Retro Tapping) and Custom Auto Shifts (qmk#11059)
Description
Taking inspiration from Auto Shift's special setup keys, I've created three new quantum keys:
DT_PRNT
DT_UP
DT_DOWN
(Ideally, I would have used
KC_TAPRP
,KC_TAPUP
,KC_TAPDN
like the auto shift keys but those names are unfortunately longer than 7 characters)To use them, all the user needs to do is to enable
DYNAMIC_TAPPING_TERM_ENABLE
in theirrules.mk
(I wasn't sure whether to make it aconfig.h
option or arules.mk
option).In order for this feature to be effective for people who use per-key tapping terms, a few changes to the syntax of the
get_tapping_term
function are needed. All they need to do is replace every occurrence ofTAPPING_TERM
in theget_tapping_term
function by lowercaseg_tapping_term
. I want to emphasize that nothing breaks if someone keeps the classic syntax and enables the new feature.The reason for the necessity of that change is that
TAPPING_TERM
is a macro that expands to a constant integer and thus cannot be changed at runtime whereastapping_term
is a variable whose value can be changed at runtime.The intended use is to temporarily enable
DYNAMIC_TAPPING_TERM_ENABLE
to find a suitable tapping term value and then disable that feature and revert back to using the classic syntax for per-key tapping term settings. In fact, if someone no longer needs the tap term keys and decide to disable the feature, they will have to revert back to usingTAPPING_TERM
because the variableg_tapping_term
is only accessible at keymap-level ifDYNAMIC_TAPPING_TERM_ENABLE
is set toyes
.Exposing the
tapping_term
variable at a keymap level can also be used to do things like change the tapping term using a rotary encoder and display its value on an OLED screen.As you probably know, subtracting 5 from a unsigned integer whose value is 0, will cycle and produce
UINT16_MAX-5
. It is entirely possible to go down in the quote-unquote "negative numbers" for the tapping term if you tapTK_DOWN
enough times. While I could add aif (tapping_term >= 5)
in the case ofTK_DOWN
in thequantum/process_keycode/process_dynamic_tapping_term.c
file, it wouldn't help with per-key tapping term settings. If a user has set a per key tapping term oftapping_term - 60
for keyX
inuint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record)
, the if-condition ofTK_DOWN
won't help. Regardless, I don't think it is so bad if it cycles through 0, 5, 10, ..., UINT16_MAX-5, 0, 5 so I just let it be.On yet another note, can someone tell me where in the list of
process_*
functions indocs/understanding_qmk.md
should I place myprocess_dynamic_tapping_term
? I placed it after the auto shift one because that's what my PR is heavily based on.Types of Changes
Issues Fixed or Closed by This PR
Checklist