Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 42 #56

Merged
merged 8 commits into from
Mar 2, 2023
Merged
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
13 changes: 7 additions & 6 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Python package

on: [push]
on: [push, pull_request]

jobs:
build:
Expand All @@ -9,14 +9,15 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.5, 3.6, 3.7]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
sudo apt install gcc libasound-dev
Expand All @@ -29,7 +30,7 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Test with pytest
# run: |
# pip install pytest
# pytest
- name: Test with pytest
run: |
pip install pytest
pytest
1 change: 1 addition & 0 deletions hifiberrydsp/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__ = "0.20"
_called_from_test = False
4 changes: 4 additions & 0 deletions hifiberrydsp/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

def pytest_configure(config):
import hifiberrydsp
hifiberrydsp._called_from_test = True
25 changes: 15 additions & 10 deletions hifiberrydsp/hardware/spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@
SOFTWARE.
'''
import logging


def init_spi():
import spidev
spi = spidev.SpiDev()
spi.open(0, 0)
spi.bits_per_word = 8
spi.max_speed_hz = 1000000
spi.mode = 0
logging.debug("spi initialized %s", spi)
import hifiberrydsp

def init_spi():
if not hifiberrydsp._called_from_test:
# only open the device when not running tests
import spidev
spi = spidev.SpiDev()
spi.open(0, 0)
spi.bits_per_word = 8
spi.max_speed_hz = 1000000
spi.mode = 0
logging.debug("spi initialized %s", spi)
else:
spi = None
logging.debug("spi not initialized since running tests")
return spi


Expand Down
4 changes: 2 additions & 2 deletions hifiberrydsp/parser/rew.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def readfilters(filename, fs=48000):
fc = float(parts[5])
gain = float(parts[8])
q = float(parts[11])
logging.info("Filter EQ fc=%s, q=%s, gaion=%s, fs=%s",
logging.info("Filter EQ fc=%s, q=%s, gain=%s, fs=%s",
fc, q, gain, fs)
filters.append(
Biquad.peaking_eq(fc, q, gain, fs))
Expand Down Expand Up @@ -109,7 +109,7 @@ def readfilters(filename, fs=48000):
parts[4] == "Fc" and parts[6] == "Hz":
fc = float(parts[5])
q = 0.707
logging.info("Filter NO fc=%s", fc, db)
logging.info("Filter NO fc=%s q=%s", fc, q)
filters.append(
Biquad.notch(fc, q, fs))

Expand Down