From 5f60ed35002b159c3a10d24150cc011d8f1c4fad Mon Sep 17 00:00:00 2001 From: Andrey Pohilko Date: Mon, 25 Sep 2017 16:13:22 +0300 Subject: [PATCH] Cosmetics --- README.md | 2 -- demo.py | 4 ++-- pylgbst/movehub.py | 3 +++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9e2338f..0f144be 100644 --- a/README.md +++ b/README.md @@ -287,8 +287,6 @@ Then push green button on MoveHub, so permanent BLE connection will be establish ## Roadmap & TODO -- work out completely synchronous command model - with either command error or confirmation -- organize requesting and printing device info on startup - firmware version at least - document all API methods - make sure unit tests cover all important code - make debug server to re-establish BLE connection on loss diff --git a/demo.py b/demo.py index ea822a0..f8415db 100644 --- a/demo.py +++ b/demo.py @@ -189,5 +189,5 @@ if __name__ == '__main__': connection = BLEConnection().connect() hub = MoveHub(connection) - - demo_all(hub) + sleep(10000) + #demo_all(hub) diff --git a/pylgbst/movehub.py b/pylgbst/movehub.py index 03f9abb..fd3142b 100644 --- a/pylgbst/movehub.py +++ b/pylgbst/movehub.py @@ -104,6 +104,8 @@ class MoveHub(object): self.devices[port].finished() elif msg_type == MSG_PORT_CMD_ERROR: log.warning("Command error: %s", str2hex(data[3:])) + port = usbyte(data, 3) + self.devices[port].finished() elif msg_type == MSG_DEVICE_SHUTDOWN: log.warning("Device reported shutdown: %s", str2hex(data)) raise KeyboardInterrupt("Device shutdown") @@ -141,6 +143,7 @@ class MoveHub(object): self.devices[port].finished() elif status == STATUS_CONFLICT: log.warning("Command conflict on port %s", PORTS[port]) + self.devices[port].finished() else: log.warning("Unhandled status value: 0x%x", status)