Skip to content

Commit

Permalink
refactor(hardware): constants from firmware (#8995)
Browse files Browse the repository at this point in the history
* chore(hardware): add firmware python module as dep

Pipenv can add git repo dependencies, so we can add the
opentrons_ot3_firmware repo here.

If you want to switch branches you can edit the pipfile (there's not
really a better way to do this).

This will become a problem if we ever want to depend on this module and
get its transitive dependencies because that stuff only reads setup.py,
but we don't really do that yet.

* chore(hardware): rely on constants from firmware

This lets us take a bunch of code out how nice

* add pushing to ot3
  • Loading branch information
sfoster1 authored Dec 7, 2021
1 parent 885aadc commit 2205bfb
Show file tree
Hide file tree
Showing 30 changed files with 639 additions and 1,318 deletions.
10 changes: 7 additions & 3 deletions hardware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ format:
dev:
echo "Nothing here yet"

.PHONY: opentrons_ot3_firmware_dist
opentrons_ot3_firmware_dist: Pipfile.lock
mkdir -p dist
$(python) ../scripts/bundle_installed_package.py opentrons_ot3_firmware dist

.PHONY: push-no-restart
push-no-restart: wheel
Expand All @@ -109,11 +113,11 @@ push-no-restart: wheel
push: push-no-restart
$(call restart-service,$(host),$(br_ssh_key),$(ssh_opts),"jupyter-notebook opentrons-robot-server")


.PHONY: push-no-restart-ot3
push-no-restart-ot3: $(sdist_file)
echo $(sdist_file)
push-no-restart-ot3: $(sdist_file) Pipfile.lock
echo $(sdist_file) $(wildcard dist/opentrons_ot3_firmware-*.tar.gz)
$(call push-python-sdist,$(host),,$(ssh_opts),$(sdist_file),/opt/opentrons-robot-server,"opentrons_hardware")
$(call push-python-sdist,$(host),,$(ssh_opts),$(wildcard dist/opentrons_ot3_firmware-*.tar.gz),/opt/opentrons-robot-server,"opentrons_ot3_firmware")

.PHONY: push-ot3
push-ot3: push-no-restart-ot3
Expand Down
1 change: 1 addition & 0 deletions hardware/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name = "pypi"
python-can = "==3.3.4"
pyserial = "==3.5"
typing-extensions = "==3.10.0.0"
opentrons-ot3-firmware = {subdirectory = "python", git = "https://github.com/Opentrons/ot3-firmware.git", branch = "main"}

[dev-packages]
pytest = "==6.1.0"
Expand Down
792 changes: 538 additions & 254 deletions hardware/Pipfile.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions hardware/opentrons_hardware/drivers/can_bus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Can bus drivers package."""

from .driver import CanDriver
from .message import CanMessage
from .arbitration_id import (
from .can_messenger import CanMessenger
from opentrons_ot3_firmware.message import CanMessage
from opentrons_ot3_firmware.arbitration_id import (
ArbitrationId,
ArbitrationIdParts,
)
from .constants import NodeId, FunctionCode, MessageId
from .can_messenger import CanMessenger
from opentrons_ot3_firmware.constants import NodeId, FunctionCode, MessageId


__all__ = [
Expand Down
51 changes: 0 additions & 51 deletions hardware/opentrons_hardware/drivers/can_bus/arbitration_id.py

This file was deleted.

13 changes: 8 additions & 5 deletions hardware/opentrons_hardware/drivers/can_bus/can_messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@

from opentrons_hardware.drivers.can_bus import (
CanDriver,
NodeId,

)
from opentrons_ot3_firmware.arbitration_id import (
ArbitrationId,
ArbitrationIdParts,
CanMessage,
MessageId,

)
from opentrons_ot3_firmware.message import CanMessage
from opentrons_ot3_firmware.constants import NodeId, MessageId
from abc import ABC, abstractmethod

from opentrons_hardware.drivers.can_bus.messages.messages import (
from opentrons_ot3_firmware.messages.messages import (
MessageDefinition,
get_definition,
)
from opentrons_hardware.utils import BinarySerializableException
from opentrons_ot3_firmware.utils import BinarySerializableException

log = logging.getLogger(__name__)

Expand Down
64 changes: 0 additions & 64 deletions hardware/opentrons_hardware/drivers/can_bus/constants.py

This file was deleted.

4 changes: 2 additions & 2 deletions hardware/opentrons_hardware/drivers/can_bus/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from can import Notifier, Bus, AsyncBufferedReader, Message, util

from .arbitration_id import ArbitrationId
from .message import CanMessage
from opentrons_ot3_firmware.arbitration_id import ArbitrationId
from opentrons_ot3_firmware.message import CanMessage
from .errors import ErrorFrameCanError

log = logging.getLogger(__name__)
Expand Down
13 changes: 0 additions & 13 deletions hardware/opentrons_hardware/drivers/can_bus/message.py

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2205bfb

Please sign in to comment.