Skip to content

Commit

Permalink
Merge pull request #211 from auto-pi-lot/fix-dtoverlay-location
Browse files Browse the repository at this point in the history
update location of /boot/firmware/config.txt and bugfixing enough to get the thing running
  • Loading branch information
sneakers-the-rat authored Jul 9, 2024
2 parents d7b3f7f + 17d668f commit 2f6de57
Show file tree
Hide file tree
Showing 24 changed files with 1,172 additions and 1,241 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Tests

on:
push:
pull_request:
branches:
- main
- dev

jobs:
test:
env:
# https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html?highlight=travis#xvfb-assertionerror-timeouterror-when-using-waituntil-waitexposed-and-ui-events
DISPLAY: ":99.0"
QT_DEBUG_PLUGINS: 1
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

# see:
# - https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions
# - https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#xvfb-assertionerror-timeouterror-when-using-waituntil-waitexposed-and-ui-events
- name: Install system dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: x11-utils libxkbcommon-x11-0 xvfb herbstluftwm qt5-default qttools5-dev-tools libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
version: "0.5.1"

- name: Install package dependencies
run: pip install -e ".[tests]"

- name: Run Tests
run: |
herbstluftwm &
sleep 1
mkdir -p $HOME/autopilot
mkdir -p $HOME/autopilot/logs
pytest --cov=autopilot --cov-config=.coveragerc --cov-report term-missing tests
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
flag-name: run-${{ join(matrix.*, '-') }}
parallel: true

coverage:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
8 changes: 4 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ version: 2
sphinx:
configuration: docs/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml
build:
os: ubuntu-22.04
tools:
python: "3.9"

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- method: pip
path: .
Expand Down
71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion autopilot/data/interfaces/datajoint.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""
Prototype interface to datajoint models using ``datajoint-babel``
This module was not completed and is left as a reference :)
"""
raise NotImplementedError('The datajoint interface is not complete, it is left here for reference')

# import typing
# from typing import Optional
Expand Down
10 changes: 5 additions & 5 deletions autopilot/setup/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
'text': 'Setup Hifiberry DAC/AMP?',
'commands': [
{'command': 'sudo adduser pi i2c', 'optional': True},
'sudo sed -i \'s/^dtparam=audio=on/#dtparam=audio=on/g\' /boot/config.txt',
'sudo sed -i \'$s/$/\\ndtoverlay=hifiberry-dacplus\\ndtoverlay=i2s-mmap\\ndtoverlay=i2c-mmap\\ndtparam=i2c1=on\\ndtparam=i2c_arm=on/\' /boot/config.txt',
'sudo sed -i \'s/^dtparam=audio=on/#dtparam=audio=on/g\' /boot/firmware/config.txt',
'sudo sed -i \'$s/$/\\ndtoverlay=hifiberry-dacplus\\ndtoverlay=i2s-mmap\\ndtoverlay=i2c-mmap\\ndtparam=i2c1=on\\ndtparam=i2c_arm=on/\' /boot/firmware/config.txt',
'echo -e \'pcm.!default {\\n type hw card 0\\n}\\nctl.!default {\\n type hw card 0\\n}\' | sudo tee /etc/asound.conf'
]
},
Expand All @@ -107,7 +107,7 @@
'type': 'bool',
'text': 'Disable Bluetooth? (recommended unless you\'re using it <3',
'commands': [
'sudo sed - i \'$s/$/\ndtoverlay=pi3-disable-bt/\' /boot/config.txt',
'sudo sed - i \'$s/$/\ndtoverlay=pi3-disable-bt/\' /boot/firmware/config.txt',
'sudo systemctl disable hciuart.service',
'sudo systemctl disable bluealsa.service',
'sudo systemctl disable bluetooth.service'
Expand Down Expand Up @@ -223,8 +223,8 @@
'type': 'bool',
'text': 'Enable i2c and set baudrate to 100kHz',
'commands': [
'sudo sed -i \'s/^#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g\' /boot/config.txt',
'sudo sed -i \'$s/$/\ni2c_arm_baudrate=100000/\' /boot/config.txt',
'sudo sed -i \'s/^#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g\' /boot/firmware/config.txt',
'sudo sed -i \'$s/$/\ni2c_arm_baudrate=100000/\' /boot/firmware/config.txt',
'sudo sed -i \'$s/$/\ni2c-dev/\' /etc/modules',
'sudo dtparam i2c_arm=on',
'sudo modprobe i2c-dev'
Expand Down
4 changes: 2 additions & 2 deletions autopilot/setup/setup_mlx90640.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ sudo apt-get update
sudo apt-get install -y libi2c-dev swig

# enable i2c module
sudo sed -i 's/^#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt
sudo sed -i 's/^#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/firmware/config.txt

# increase baudrate
sudo sed -i '$s/$/\ndtparam=i2c_arm_baudrate=1000000/' /boot/config.txt
sudo sed -i '$s/$/\ndtparam=i2c_arm_baudrate=1000000/' /boot/firmware/config.txt

#cd ~/git
# clone submodules if we haven't already
Expand Down
4 changes: 2 additions & 2 deletions autopilot/transform/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,8 @@ def _maxlinedev(self, x, y):
# all credit to http://ieeexplore.ieee.org/document/6166585/
# adapted from MATLAB scripts here: https://docs.google.com/open?id=0B10RxHxW3I92dG9SU0pNMV84alk

x = x.astype(np.float)
y = y.astype(np.float)
x = x.astype(float)
y = y.astype(float)

results = {}

Expand Down
2 changes: 1 addition & 1 deletion autopilot/utils/wiki.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Utility functions for dealing with the wiki (https://wiki.auto-pi-lot.com).
See the docstrings of the :func:`.ask` function, as well as the :ref:`guide_wiki_plugins` section
See the docstrings of the :func:`.ask` function, as well as the :ref:`guide_plugins_wiki` section
in the user guide for use.
"""
from typing import Union, Optional, List
Expand Down
22 changes: 22 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pytest
import os
import sys

def on_gh_actions() -> bool:
return "CI" in os.environ or os.environ["CI"] or "GITHUB_RUN_ID" in os.environ

# patch cpuinfo which doesn't work on github actions
# (and actually isn't needed by blosc2 or pytables, but they
# call it at the module level so their imports fail and we need
# to monkeypatch in this janky way
module = type(sys)('cpuinfo')
module.get_cpu_info = lambda: {}
sys.modules['cpuinfo'] = module

def pytest_collection_modifyitems(config, items):

skip_gui = pytest.mark.skip('GUI is not working with pyside6 atm')
for item in items:
if item.get_closest_marker('gui'):
item.add_marker(skip_gui)

4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
autodoc_member_order = "bysource"
#autodoc_default_flags = ['members']
#autodoc_mock_imports = ['tables', 'PySide', 'pyo', 'jack', 'pyqtgraph']
autodoc_mock_imports = ['pytestqt']
autodata_content = "both"

autodoc_default_options = {
Expand Down Expand Up @@ -142,6 +143,7 @@
# pydantic_autodoc
# --------------------------------------------------
autodoc_pydantic_field_doc_policy = "both"
autodoc_pydantic_model_show_json_error_strategy = 'coerce'



Expand All @@ -163,7 +165,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
Empty file removed docs/examples.rst
Empty file.
2 changes: 1 addition & 1 deletion docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Also see the ``examples`` folder in the repository for jupyter notebooks we have
```{toctree}
:maxdepth: 1
:caption: Tasks
-----------------
blink
gonogo
```
Expand Down
43 changes: 0 additions & 43 deletions docs/gui/plots.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/gui/widgets.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/gui/widgets/protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
protocol
---------

.. automodule:: autopilot.gui.widgets.model
.. automodule:: autopilot.gui.widgets.protocol
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ After configuration, all the files you'll interact with will be in the user dire

An example user directory might look like this:

```
```text
./autopilot
├── calibration
├── data
Expand Down
4 changes: 3 additions & 1 deletion docs/guide/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ Using plugins is simple! Anything inside of the directory indicated by ``prefs.g
provide objects that inherit from Autopilot classes supported by an entry in :data:`.registry.REGISTRIES` .

For example, we want to write a task that uses some special hardware that we need. We could start by making a directory
within ``'PLUGINDIR'`` like this::
within ``'PLUGINDIR'`` like this:

.. code-block:: text
plugins
├── my-autopilot-plugin
Expand Down
Empty file removed docs/guide/userdir.md
Empty file.
2 changes: 1 addition & 1 deletion docs/tests/test_transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ Transforms
===========


.. automodule:: tests.test_transform_geometry
.. automodule:: tests.test_transforms_geometry
:members:
Loading

0 comments on commit 2f6de57

Please sign in to comment.