Skip to content
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

Encoder scroll not working after switching branch #2670

Closed
eerraa opened this issue Nov 25, 2024 · 1 comment
Closed

Encoder scroll not working after switching branch #2670

eerraa opened this issue Nov 25, 2024 · 1 comment

Comments

@eerraa
Copy link

eerraa commented Nov 25, 2024

I've been using my keyboard with the following keymap code compiled on the petejohanson/zmk/tree/feat/pointers-move-scroll branch:

#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/mouse.h>
#include <dt-bindings/zmk/outputs.h>
#include <dt-bindings/zmk/rgb.h>

#define ZMK_MOUSE_DEFAULT_MOVE_VAL 1200  // 600
#define ZMK_MOUSE_DEFAULT_SCRL_VAL 100   // 10

/ {
    behaviors {
        mmv {
            acceleration-exponent = <1>;      // 1
            time-to-max-speed-ms = <1000>;    // 500
            delay-ms = <0>;                   // 0
        };

        msc {
            acceleration-exponent = <1>;      // 0
            time-to-max-speed-ms = <400>;     // 300
            delay-ms = <0>;                   // 10
        };
        
        scroll_encoder: scroll_encoder {
            compatible = "zmk,behavior-sensor-rotate";
            #sensor-binding-cells = <0>;
            bindings = <&msc SCRL_DOWN>, <&msc SCRL_UP>;
            tap-ms = <30>;
        };
    };
    
    keymap {
        compatible = "zmk,keymap";

        layer0 {
            bindings = <
&kp ESC         &kp N1     &kp N2    &kp N3    &kp N4     &kp N5   &kp UP_ARROW     &kp N6     &kp N7     &kp N8      &kp N9     &kp N0      &kp BACKSPACE
&kp TAB         &kp Q      &kp W     &kp E     &kp R      &kp T    &kp DOWN_ARROW   &kp Y      &kp U      &kp I       &kp O      &kp P       &kp BSLH
&mt LCTRL CAPS  &kp A      &kp S     &kp D     &kp F      &kp G    &kp LEFT_ARROW   &kp H      &kp J      &kp K       &kp L      &kp SEMI    &kp APOS
&kp LSHFT       &kp Z      &kp X     &kp C     &kp V      &kp B    &kp RIGHT_ARROW  &kp N      &kp M      &kp COMMA   &kp DOT    &kp FSLH    &kp RSHFT
&kp C_MUTE      &kp LCTRL  &kp LGUI  &kp LALT  &kp SPACE  &mo 2    &kp ENTER        &kp ENTER  &kp SPACE  &lt 1 RALT  &kp RGUI   &kp RCTRL
            >;

            sensor-bindings = <&scroll_encoder>;
            display-name = "LAYER0";
        };

        layer_1 {
            bindings = <
&kp GRAVE   &kp F1     &kp F2     &kp F3     &kp F4     &kp F5    &mmv MOVE_UP     &kp F6     &kp F7    &kp F8      &kp F9     &kp F10   &kp DELETE
&trans      &kp GRAVE  &mkp LCLK  &mkp MCLK  &mkp RCLK  &mkp MB4  &mmv MOVE_DOWN   &kp PG_UP  &kp END   &kp UP      &kp HOME   &kp F11   &kp F12
&trans      &trans     &trans     &trans     &trans     &mkp MB5  &mmv MOVE_LEFT   &kp PG_DN  &kp LEFT  &kp DOWN    &kp RIGHT  &kp LBKT  &kp RBKT
&trans      &trans     &trans     &trans     &trans     &trans    &mmv MOVE_RIGHT  &trans     &trans    &kp INSERT  &trans     &trans    &trans
&kp C_MUTE  &trans     &trans     &trans     &trans     &trans    &mkp LCLK        &trans     &trans    &trans      &trans     &trans
            >;

            sensor-bindings = <&scroll_encoder>;
            display-name = "LAYER1";
        };

        layer_2 {
            bindings = <
&kp TILDE  &bt BT_SEL 0  &bt BT_SEL 1    &bt BT_SEL 2  &bt BT_SEL 3  &bt BT_SEL 4  &mmv MOVE_UP     &trans  &trans  &trans  &trans  &trans     &trans
&trans     &bt BT_CLR    &bt BT_CLR_ALL  &trans        &trans        &trans        &mmv MOVE_DOWN   &trans  &trans  &trans  &trans  &kp UNDER  &kp PLUS
&trans     &out OUT_USB  &out OUT_BLE    &trans        &trans        &trans        &mmv MOVE_LEFT   &trans  &trans  &trans  &trans  &kp LBRC   &kp RBRC
&trans     &trans        &trans          &trans        &trans        &trans        &mmv MOVE_RIGHT  &trans  &trans  &trans  &trans  &trans     &trans
&trans     &trans        &trans          &trans        &trans        &trans        &mkp LCLK        &trans  &trans  &trans  &trans  &trans
            >;

            sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOL_DN>;
            display-name = "LAYER2";
        };
        
        extra1 {
            status = "reserved";
        };
        
        extra2 {
            status = "reserved";
        };
        
        extra3 {
            status = "reserved";
        };
    };
};

Recently, I switched to the petejohanson/zmk/tree/feat/pointers-with-input-processors branch to use ZMK STUDIO. However, after switching, the encoder's scroll up and scroll down functions stopped working.

I've spent some time trying to figure out what changes might have caused this issue, but I haven't been able to identify the reason. Could someone help me understand why this is happening and how to fix it?

My ZMK config repository is available at: https://github.com/eerraa/zmk-config-sofle

Thank you in advance for your help!

(Note: I apologize if my question seems basic - I'm new to programming and English isn't my first language.)

@eerraa eerraa changed the title Encoder scroll not working after switching to pointers-with-input-processors branch Encoder scroll not working after switching branch Nov 25, 2024
@caksoylar
Copy link
Contributor

caksoylar commented Nov 25, 2024

To override the speed, you need to #define ZMK_MOUSE_DEFAULT_SCRL_VAL etc. before #include <dt-bindings/zmk/mouse.h>, since they affect how SCRL_DOWN etc. are defined in the header.

Maybe in the previous branch the speed adjustment wasn't needed, but in this one the scale of scroll values are different so it is needed, not sure.

I also don't think your mmv or msc overrides do anything, because the node names are different: https://github.com/zmkfirmware/zmk/pull/2477/files#diff-1a97e7069fcda9561fe5cdda2b476644bbba071fa6d4c286777a50f90a3269fcR12. You'd be better off using the usual &msc {...}; approach to override values.

As an aside, please keep questions for features not in main branch either in ZMK Discord (#pointing-devices channel is good for this), or at least in the PR itself (#2477).

@caksoylar caksoylar closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants