我得到这个错误时,我试图使用我的旋转编码器像这样修改键。
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
if (clockwise) {
tap_code(QK_LCTL | KC_F24);
} else {
tap_code(QK_LCTL | KC_F23);
}
}
return false;
}这就是错误
Compiling: keyboards/planck/keymaps/dawz/keymap.c keyboards/planck/keymaps/dawz/keymap.c: In function 'encoder_update_user':
keyboards/planck/keymaps/dawz/keymap.c:68:22: error: unsigned conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '371' to '115' [-Werror=overflow]
68 | tap_code(QK_LCTL | KC_F24);
| ^~~~~~~~~~~~~~~~
keyboards/planck/keymaps/dawz/keymap.c:70:22: error: unsigned conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '370' to '114' [-Werror=overflow]
70 | tap_code(QK_LCTL | KC_F23);
| ^~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
[ERRORS]
|
|
|
make[1]: *** [tmk_core/rules.mk:443: .build/obj_planck_rev6_drop_dawz/keyboards/planck/keymaps/dawz/keymap.o] Error 1
Make finished with errors
make: *** [Makefile:539: planck/rev6_drop:dawz] Error 1当我输入像KC_VOLUP或KC_VOLDOWN这样的常规键码时,编码器可以工作,但我尝试使用CTRL + F23,F24,这样我就可以使用旋钮作为语音计宏按钮控制器。
发布于 2021-09-24 11:55:37
如果要在此处对编码器使用修饰符键,则应尝试使用tap_code16而不是tap_code
试着这样做:
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
if (clockwise) {
tap_code16(QK_LCTL | KC_F24);
} else {
tap_code16(QK_LCTL | KC_F23);
}
}
return false;
}发布于 2021-10-16 13:58:59
看看我在https://github.com/qmk/qmk_firmware/tree/master/keyboards/keebio/iris/keymaps/sq5rix上的快捷键映射,那里有可用的编码器。看看rules.mk、config.h和keymap.c --到处都是更改
发布于 2021-11-08 07:46:49
您可以分解组合键的按下方式:
按住修饰键并按下某个键(通常是字母或number)
然后,您可以表示整个过程:
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
if (clockwise) {
register_code(QK_LCTL); // Press and keep holding down
tap_code(KC_F24); // Press and release
unregister_code(QK_LCTL); // Release
} else {
register_code(QK_LCTL);
tap_code(KC_F23);
unregister_code(QK_LCTL);
}
}
return false;
}这种方法看起来很愚蠢,但您可以实现更复杂的情况,例如Ctrl+Alt+Shift+A或几乎无法使用键码执行的操作。
我为我的一台self-made keyboard这样做了,它工作得很好。
https://stackoverflow.com/questions/69307910
复制相似问题