Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

enhancement/updated validator #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
12 changes: 9 additions & 3 deletions ovos_PHAL_plugin_respeaker_2mic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
from ovos_bus_client.message import Message
from ovos_PHAL.detection import is_respeaker_2mic
from ovos_plugin_manager.phal import PHALPlugin
from ovos_PHAL_plugin_respeaker_2mic.drivers import get_led, get_button


class Respeaker2MicValidator:
@staticmethod
def validate(config=None):
# TODO does it work for 2 and 6 mic ?
return is_respeaker_2mic()
if exists('/home/ovos/.config/mycroft/i2c_platform'):
builderjer marked this conversation as resolved.
Show resolved Hide resolved
with open('/home/ovos/.config/mycroft/i2c_platform', 'r') as f:
platform = f.readline()
LOG.debug(f"2mic platform {platform}")
if platform == 'wm8960':
return True
return False


class Respeaker2MicControlPlugin(PHALPlugin):
validator = Respeaker2MicValidator

def __init__(self, bus=None, config=None):
super().__init__(bus=bus, name="ovos-PHAL-plugin-respeaker-2mic", config=config)
self.button = get_button()
Expand Down