Skip to content

Commit

Permalink
Merge branch 'master' into images
Browse files Browse the repository at this point in the history
  • Loading branch information
pguyot committed Nov 22, 2018
2 parents d430f53 + 8d5d07d commit c34b41c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions nabd/nabd.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,11 @@ async def _ears_moved(self):
if self.state != 'asleep':
self.broadcast_event('ears', {'type':'ears_event', 'left': left, 'right': right})

async def setup(self):
self.nabio.set_leds(None, None, None, None, None)
await self.nabio.setup_ears(self.ears['left'], self.ears['right'])

def run(self):
self.loop = asyncio.get_event_loop()
self.nabio.bind_button_event(self.loop, self.button_callback)
self.nabio.bind_ears_event(self.loop, self.ears_callback)
setup_task = self.loop.create_task(self.setup())
setup_task = self.loop.create_task(self.idle_setup())
idle_task = self.loop.create_task(self.idle_worker_loop())
server_task = self.loop.create_task(asyncio.start_server(self.service_loop, 'localhost', Nabd.PORT_NUMBER))
try:
Expand Down
4 changes: 2 additions & 2 deletions nabd/nabio_hw.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ async def detect_ears_positions(self):
return await self.ears.detect_positions()

def set_leds(self, nose, left, center, right, bottom):
for led in [nose, left, center, right, bottom]:
for (led_ix, led) in [(Leds.LED_NOSE, nose), (Leds.LED_LEFT, left), (Leds.LED_CENTER, center), (Leds.LED_RIGHT, right), (Leds.LED_BOTTOM, bottom)]:
if led == None:
(r, g, b) = (0, 0, 0)
else:
(r, g, b) = led
self.leds.set1(led, r, g, b)
self.leds.set1(led_ix, r, g, b)

def bind_button_event(self, loop, callback):
self.button.on_event(loop, callback)
Expand Down

0 comments on commit c34b41c

Please sign in to comment.