Open penrods opened 4 years ago
Thanks for this! I just tested it on my RPi4 + Respeaker 2-mic HAT and it works fine... just needed two tiny fixes. I guess the easiest option is to just paste them here:
diff --git a/opt/mycroft/enclosure/lib/gpio_button.py b/opt/mycroft/enclosure/lib/gpio_button.py
index 17764b6..2db0c15 100644
--- a/opt/mycroft/enclosure/lib/gpio_button.py
+++ b/opt/mycroft/enclosure/lib/gpio_button.py
@@ -42,7 +42,7 @@ class GPIO_Button:
GPIO.setmode(GPIO.BCM)
GPIO.setup(self.button_bcm, GPIO.IN, pull_up_down=GPIO.PUD_UP)
- GPIO.add_event_detect(23, GPIO.BOTH, self._on_gpio_button)
+ GPIO.add_event_detect(self.button_bcm, GPIO.BOTH, self._on_gpio_button)
self.__timer = None
self.__timer2 = None
self.__last_press = 0
diff --git a/opt/mycroft/enclosure/lib/picroft_enclosure.py b/opt/mycroft/enclosure/lib/picroft_enclosure.py
index 7d214bb..ddb240a 100644
--- a/opt/mycroft/enclosure/lib/picroft_enclosure.py
+++ b/opt/mycroft/enclosure/lib/picroft_enclosure.py
@@ -63,7 +63,7 @@ class Picroft_Enclosure(EnclosureGeneric):
self.bus.on("mycroft.skill.handler.complete", self.indicate_thinking_done)
# Visual indication that system is booting
- self.bus.on("mycroft.skills.initialized", self.on_ready)
+ self.bus.on("mycroft.skills.initialized", self.indicate_booting)
# Setup to support a button on a GPIO -- default is GPIO23
if button_gpio_bcm:
Now a my_enclosure.py gets installed as part of the setup. Specific supported hardware includes a custom enclosure (e..g AIY, ReSpeaker Mic Array and Matrix) or a generic enclosure is installed with support for specific GPIOs. All support at least a generic button and some LED indicators.
The code is in /opt/mycroft/enclosure/my_enclosure.py and auto-launches from auto_run.sh as a root process. A soft link is created from the home directory, as ~/my_enclosure.py. Changes
The basic hierarchy is: EnclosureGeneric Picroft_Enclosure AIY_Enclosure Generic_Enclosure Matrix_Enclosure ReSpeaker_Enclosure
The Picroft_Enclosure contains most of the heavy lifting, with just a little in the subclasses to tie to the special cases.
The GPIO_Button and GPIO_LED also implement must of the Raspberry Pi behavior. The Button generates actions for Press, Release, Hold and Double Click. The GPIO_LED is a very simple LED which can turn on, off or flash automatically.
Also fixes the typo mentioned in Issue #125 to the enclosure will also be automatically reloaded.
Additionally, logging in to TTY sessions automatically enters the venv now.