From 7bcba47de5f94b36c1f6313ac3ebcdb3adc1dfdc Mon Sep 17 00:00:00 2001 From: Andrey Pohilko Date: Fri, 15 Sep 2017 17:56:17 +0300 Subject: [PATCH] Prepare to conflict --- README.md | 6 +++++- demo.py | 2 +- pylgbst/__init__.py | 3 --- vernie.py | 5 +++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a9e1ab2..f06823c 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,14 @@ for device in hub.devices: ## Debug Server -`sudo python -c "from pylgbst.comms import *; import logging; logging.basicConfig(level=logging.DEBUG); DebugServer(BLEConnection().connect()).start()"` +``` +sudo python -c "from pylgbst.comms import *; import logging; logging.basicConfig(level=logging.DEBUG); DebugServer(BLEConnection().connect()).start()" +``` ## Roadmap +- make notifications from pygattlib to quickly get into parallel thread, to avoid segfaults +- support working with push button - Give nice documentation examples, don't forget to mention logging - make angled motors to be synchronous by default => 3-state status - make sure unit tests cover all important code diff --git a/demo.py b/demo.py index 4984c14..9b7ab28 100644 --- a/demo.py +++ b/demo.py @@ -168,7 +168,7 @@ if __name__ == '__main__': hub = MoveHub(connection) - demo_motor_sensors(hub) + demo_motors_timed(hub) # demo_all(hub) log.info("Sleeping 60s") diff --git a/pylgbst/__init__.py b/pylgbst/__init__.py index b9ee15f..a73e26d 100644 --- a/pylgbst/__init__.py +++ b/pylgbst/__init__.py @@ -62,9 +62,6 @@ class MoveHub(object): return self.connection.read(DEVICE_NAME) def _notify(self, handle, data): - """ - Using https://github.com/JorgePe/BOOSTreveng/blob/master/Notifications.md - """ orig = data if handle != MOVE_HUB_HARDWARE_HANDLE: diff --git a/vernie.py b/vernie.py index acde3ea..c7d14cc 100644 --- a/vernie.py +++ b/vernie.py @@ -30,8 +30,9 @@ class Vernie(MoveHub): def _color_distance_data(self, color, distance): log.debug("Color & Distance data: %s %s", COLORS[color], distance) self._sensor_distance = distance - self._color_detected = color - self.led.set_color(self._color_detected if self._color_detected != COLOR_NONE else COLOR_BLACK) + if self._color_detected != color: + self._color_detected = color + self.led.set_color(self._color_detected if self._color_detected != COLOR_NONE else COLOR_BLACK) def head_to(self, direction=RIGHT, speed=0.25, angle=25): if direction == STRAIGHT: