Skip to content

Commit

Permalink
Merge pull request #1 from OpenVoiceOS/feat/mark1
Browse files Browse the repository at this point in the history
feat/mk1_support
  • Loading branch information
builderjer authored Jan 6, 2025
2 parents c6198a1 + 90ccac0 commit 9215fb8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: [3.9, "3.10", "3.11"]
- name: Install Build Tools
run: |
python -m pip install build wheel
Expand All @@ -39,4 +39,4 @@ jobs:
python setup.py bdist_wheel
- name: Install package
run: |
pip install .
pip install .
19 changes: 18 additions & 1 deletion ovos_i2c_detection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess

import serial
from time import sleep

def is_texas_tas5806():
cmd = 'i2cdetect -y -a 1 0x2f 0x2f | egrep "(2f|UU)" | awk \'{print $2}\''
Expand Down Expand Up @@ -53,3 +54,19 @@ def is_adafruit_amp():
if out == b"4b" or out == b"UU":
return True
return False

def is_mark_1():
if is_wm8960():
try:
ser = serial.Serial("/dev/serial0", 9600, timeout=3)
ser.write(b'system.version')
while True:
is_mk1 = ser.readline().decode().rstrip()
if is_mk1 and "Command" in is_mk1:
# This is a Mark 1
return True
break
return False
except:
return False

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyserial
12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ def get_version():
version += f"post{post}"
return version

def required(requirements_file):
""" Read requirements file and remove comments and empty lines. """
with open(os.path.join(BASEDIR, requirements_file), 'r') as f:
requirements = f.read().splitlines()
if 'MYCROFT_LOOSE_REQUIREMENTS' in os.environ:
print('USING LOOSE REQUIREMENTS!')
requirements = [r.replace('==', '>=').replace('~=', '>=') for r in requirements]
return [pkg for pkg in requirements
if pkg.strip() and not pkg.startswith("#")

with open("README.md", "r") as f:
long_description = f.read()
Expand All @@ -46,5 +55,6 @@ def get_version():
description='i2c detection for some devices',
long_description=long_description,
long_description_content_type="text/markdown",
install_requires=required("requirements/requirements.txt"),
packages=['ovos_i2c_detection'],
)
)

0 comments on commit 9215fb8

Please sign in to comment.