#[Solved] Encoder rotation debugging

1 messages · Page 1 of 1 (latest)

hollow copper
#

I have a sofle that I've built with ec11 encoders on it. Everything is working except for encoder rotation. The default toggle light / mute behaviors on the encoder presses are working, but the rotation is not. I have some logs that suggest that the device can tell that the encoder is rotating, but I can't tell if it's messed up or not.

(This is from the left hand of the split)

00:00:47.150,360] <dbg> zmk: zmk_keymap_sensor_event: layer idx: 3, layer id: 3 sensor_index: 0, binding name:
[00:00:47.150,390] <dbg> zmk: zmk_keymap_sensor_event: No behavior assigned to 0 on layer 3
[00:00:47.150,451] <dbg> zmk: zmk_keymap_sensor_event: layer idx: 2, layer id: 2 sensor_index: 0, binding name: enc_key_press
[00:00:47.150,482] <dbg> zmk: zmk_behavior_sensor_rotate_common_accept_data: val1: 0, val2: 0, remainder: 0/0 triggers: 0 inc keycode 0xC00E9 dec keycode 0xC00EA
[00:00:47.150,665] <dbg> zmk: zmk_keymap_sensor_event: layer idx: 1, layer id: 1 sensor_index: 0, binding name: enc_key_press
[00:00:47.150,817] <dbg> zmk: zmk_behavior_sensor_rotate_common_accept_data: val1: 0, val2: 0, remainder: 0/0 triggers: 0 inc keycode 0xC00E9 dec keycode 0xC00EA
[00:00:47.150,878] <dbg> zmk: zmk_keymap_sensor_event: layer idx: 0, layer id: 0 sensor_index: 0, binding name: enc_key_press
[00:00:47.150,909] <dbg> zmk: zmk_behavior_sensor_rotate_common_accept_data: val1: 0, val2: 0, remainder: 0/0 triggers: 0 inc keycode 0xC00E9 dec keycode 0xC00EA

It looks weird to me that val1 and val2 are 0 for the entire rotation.

#

Relevant snippet of the DTSI

    left_encoder: encoder_left {
        compatible = "alps,ec11";
        a-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
        b-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
        steps = <80>;
        status = "disabled";
    };

    right_encoder: encoder_right {
        compatible = "alps,ec11";
        a-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
        b-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
        steps = <80>;
        status = "disabled";
    };

    sensors: sensors {
        compatible = "zmk,keymap-sensors";
        sensors = <&left_encoder &right_encoder>;
        triggers-per-rotation = <20>;
    };
};
#

and on the layers:
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;

hollow copper
#

huh. for posterity, this was caused by the top plate of the keyboard shorting two of the encoder pins, which caused one leg to float weirdly at 0.2v instead of 3.2v and which caused the controller to read no change most of the time. adjusting the plate so it doesn't touch the encoder seems to have fixed this.

#

this also explains why my batteries were draining in like 1 day