Update kmk/modules/encoder.py

Co-authored-by: Tonasz <27835465+Tonasz@users.noreply.github.com>
This commit is contained in:
René Giovanni Borella 2022-02-14 23:32:33 +01:00 committed by Kyle Brown
parent a34272dd18
commit 2096f1a950

@ -229,9 +229,11 @@ class EncoderHandler(Module):
new_encoder = GPIOEncoder(*gpio_pins)
# In our case, we need to define keybord and encoder_id for callbacks
new_encoder.on_move_do = lambda x: self.on_move_do(keyboard, idx, x)
new_encoder.on_button_do = lambda x: self.on_button_do(
keyboard, idx, x
new_encoder.on_move_do = lambda x, bound_idx=idx: self.on_move_do(
keyboard, bound_idx, x
)
new_encoder.on_button_do = lambda x, bound_idx=idx: self.on_button_do(
keyboard, bound_idx, x
)
self.encoders.append(new_encoder)
except Exception as e: