Skip to content

Commit

Permalink
disable for mk1 devices (#5)
Browse files Browse the repository at this point in the history
* disable for mk1 devices

* 📝 Add docstrings to `fix/mk1` (#6)

Docstrings generation was requested by @JarbasAl.

* #5 (comment)

The following files were modified:

* `ovos_PHAL_plugin_dotstar/__init__.py`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
builderjer and coderabbitai[bot] authored Jan 11, 2025
1 parent 9534635 commit b5c7695
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion ovos_PHAL_plugin_dotstar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ovos_utils.log import LOG
from ovos_config.config import Configuration

from ovos_i2c_detection import is_wm8960, is_respeaker_4mic, is_respeaker_6mic
from ovos_i2c_detection import is_wm8960, is_respeaker_4mic, is_respeaker_6mic, is_mark_1

from lingua_franca.util.colors import Color
from lingua_franca.internal import load_language
Expand Down Expand Up @@ -50,11 +50,32 @@ class DotStarLedControlPluginValidator(PHALValidator):
@staticmethod
def validate(config=None):
# If the user enabled the plugin no need to go further
"""
Validate the configuration for the DotStar LED control plugin.
Determines whether the plugin should be activated based on configuration and hardware detection.
Parameters:
config (dict, optional): Plugin configuration dictionary. Defaults to None.
Returns:
bool: True if the plugin should be enabled, False otherwise.
Conditions for validation:
1. If plugin is explicitly enabled in configuration
2. If specific audio hardware is detected (WM8960, ReSpeaker 4-mic, ReSpeaker 6-mic)
3. Excludes Mark 1 hardware configuration
Logs debug information about validation process.
"""
if config.get("enabled"):
LOG.debug("user enabled")
return True
# Try a direct hardware check
if is_wm8960() or is_respeaker_4mic() or is_respeaker_6mic():
if is_mark_1():
LOG.debug("Mark 1 detected. Dotstar is not needed")
return False
LOG.debug("direct hardware check")
return True
LOG.debug("no validation")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
adafruit-circuitpython-dotstar
ovos-plugin-manager>=0.0.1
ovos-lingua-franca>=0.4.8a8
ovos-i2c-detection>=0.0.0a5
ovos-i2c-detection>=0.0.5
gpiozero
rpi-lgpio

0 comments on commit b5c7695

Please sign in to comment.