Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified nabclockd/sounds/fr_FR/nabclockd/12/1.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/12/2.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/12/3.mp3
Binary file not shown.
Binary file added nabclockd/sounds/fr_FR/nabclockd/12/4.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/12/5.mp3
Binary file not shown.
Binary file removed nabclockd/sounds/fr_FR/nabclockd/12/6.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/20/1.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/20/2.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/20/3.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/20/4.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/20/5.mp3
Binary file not shown.
Binary file removed nabclockd/sounds/fr_FR/nabclockd/20/6.mp3
Binary file not shown.
Binary file removed nabclockd/sounds/fr_FR/nabclockd/20/7.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/8/1.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/8/2.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/8/3.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/8/4.mp3
Binary file not shown.
Binary file added nabclockd/sounds/fr_FR/nabclockd/8/5.mp3
Binary file not shown.
Binary file modified nabclockd/sounds/fr_FR/nabclockd/8/6.mp3
Binary file not shown.
36 changes: 10 additions & 26 deletions nabd/leds.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from enum import Enum, unique
from threading import Condition, Lock, Thread


@unique
class Led(Enum):
BOTTOM = 4
Expand All @@ -12,44 +11,31 @@ class Led(Enum):
LEFT = 1
NOSE = 0


class Leds(object, metaclass=abc.ABCMeta):
"""Interface for leds"""

@abc.abstractmethod
def set1(self, led, red, green, blue):
"""
Set the color of a given led.
"""
raise NotImplementedError("Should have implemented")
raise NotImplementedError("Subclasses must implement set1")

@abc.abstractmethod
def pulse(self, led, red, green, blue):
"""
Set a given led to pulse to a given color.
"""
raise NotImplementedError("Should have implemented")
raise NotImplementedError("Subclasses must implement pulse")

@abc.abstractmethod
def setall(self, red, green, blue):
"""
Set the color of every led.
"""
raise NotImplementedError("Should have implemented")
raise NotImplementedError("Subclasses must implement setall")

def stop(self):
"""
Stop the leds thread, if any.
"""

"""Stop the leds thread, if any."""

class LedsSoft(Leds, metaclass=abc.ABCMeta):
"""
Base implementation with software pulsing.
"""

PULSING_RATE = 0.200 # every 200ms
PULSING_STEPS = 10 # number of steps to reach target color
PULSING_RATE = 0.05 # faster: every 50ms
PULSING_STEPS = 30 # smoother gradient

def __init__(self):
self.condition = Condition()
Expand Down Expand Up @@ -176,12 +162,10 @@ def stop(self):

@abc.abstractmethod
def do_set(self, led, red, green, blue):
"""
Actually set a led.
"""
"""Actually set a led."""
raise NotImplementedError("Subclasses must implement do_set")

@abc.abstractmethod
def do_show(self):
"""
Show all leds at once.
"""
"""Show all leds at once."""
raise NotImplementedError("Subclasses must implement do_show")
Binary file added nabd/sounds/asr/acquired.wav
Binary file not shown.
File renamed without changes.
Binary file added nabd/sounds/asr/listen.wav
Binary file not shown.
File renamed without changes.
Binary file modified nabd/sounds/nabd/abort.wav
Binary file not shown.
Binary file added nabd/sounds/nabd/abort_old.wav
Binary file not shown.
Binary file modified nabd/sounds/rfid/rfid.wav
Binary file not shown.
Binary file added nabd/sounds/rfid/rfid_old.wav
Binary file not shown.