fix formatting, run test

This commit is contained in:
Rene Giovanni Borella 2022-02-15 09:24:18 +01:00 committed by Kyle Brown
parent 2096f1a950
commit fb783c302c

View File

@ -107,6 +107,7 @@ class GPIOEncoder(BaseEncoder):
) )
self._state = (self.pin_a.get_value(), self.pin_b.get_value()) self._state = (self.pin_a.get_value(), self.pin_b.get_value())
def button_event(self): def button_event(self):
if self.pin_button: if self.pin_button:
new_button_state = self.pin_button.get_value() new_button_state = self.pin_button.get_value()
@ -115,6 +116,7 @@ class GPIOEncoder(BaseEncoder):
if self.on_button_do is not None: if self.on_button_do is not None:
self.on_button_do(self.get_state()) self.on_button_do(self.get_state())
class EncoderPin: class EncoderPin:
def __init__(self, pin, button_type=False): def __init__(self, pin, button_type=False):
self.pin = pin self.pin = pin
@ -232,9 +234,11 @@ class EncoderHandler(Module):
new_encoder.on_move_do = lambda x, bound_idx=idx: self.on_move_do( new_encoder.on_move_do = lambda x, bound_idx=idx: self.on_move_do(
keyboard, bound_idx, x keyboard, bound_idx, x
) )
new_encoder.on_button_do = lambda x, bound_idx=idx: self.on_button_do( new_encoder.on_button_do = (
lambda x, bound_idx=idx: self.on_button_do(
keyboard, bound_idx, x keyboard, bound_idx, x
) )
)
self.encoders.append(new_encoder) self.encoders.append(new_encoder)
except Exception as e: except Exception as e:
print(e) print(e)