diff --git a/docs/MoveHub.md b/docs/MoveHub.md index 3047d9e..ed855a5 100644 --- a/docs/MoveHub.md +++ b/docs/MoveHub.md @@ -33,4 +33,11 @@ def callback(is_pressed): hub = MoveHub() hub.button.subscribe(callback) -``` \ No newline at end of file +``` + +The state for button has 3 possible values: +- `0` - not released +- `1` - pressed +- `2` - pressed + +It is for now unknown why Hub always issues notification with `1` and immediately with `2`, after button is pressed. \ No newline at end of file diff --git a/pylgbst/peripherals.py b/pylgbst/peripherals.py index 834adda..db80808 100644 --- a/pylgbst/peripherals.py +++ b/pylgbst/peripherals.py @@ -660,4 +660,4 @@ class Button(Peripheral): :type msg: MsgHubProperties """ if msg.property == MsgHubProperties.BUTTON and msg.operation == MsgHubProperties.UPSTREAM_UPDATE: - self._notify_subscribers(bool(usbyte(msg.parameters, 0))) + self._notify_subscribers(usbyte(msg.parameters, 0))