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(api): fix APIv1 GPIO ctl for cmdline and jupyter protocol execution #6091

Merged
merged 1 commit into from
Jul 13, 2020
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
12 changes: 12 additions & 0 deletions api/src/opentrons/drivers/rpi_drivers/gpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ async def setup(self):
self.set_reset_pin(True)
await asyncio.sleep(0.25)

def setup_v1(self):
# TODO: AA 07-08-2020 remove when legacy API is deprecated
MODULE_LOG.info("Setting up GPIOs for APIv1")
self.set_audio_enable(True)
# smoothieware programming pins, must be in a known state (HIGH)
self.set_halt_pin(True)
self.set_isp_pin(True)
self.set_reset_pin(False)
time.sleep(0.25)
self.set_reset_pin(True)
time.sleep(0.25)

def set_high(self, output_pin: GPIOPin):
self.lines[output_pin.name].set_value(1)

Expand Down
14 changes: 13 additions & 1 deletion api/src/opentrons/legacy_api/robot/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from opentrons.data_storage import database, old_container_loading,\
database_migration
from opentrons.drivers.rpi_drivers import build_gpio_chardev
from opentrons.drivers.rpi_drivers.gpio_simulator import SimulatingGPIOCharDev
from opentrons.drivers.smoothie_drivers import driver_3_0
from opentrons.drivers.types import MoveSplit
from opentrons.trackers import pose_tracker
Expand Down Expand Up @@ -530,7 +532,17 @@ def connect(self, port=None, options=None):
>>> from opentrons import robot # doctest: +SKIP
>>> robot.connect() # doctest: +SKIP
"""

log.info(
'Setting up GPIOs for APIv1, expected to fail if opentrons-'
'robot-server is already running. This should not affect the '
'robot lights behavior in the protocol if it is running using '
'the Opentrons App.')
gpio_chardev = build_gpio_chardev('gpiochip0')
# setup gpio chardev if built successfully
if not isinstance(gpio_chardev, SimulatingGPIOCharDev):
gpio_chardev.config_by_board_rev()
gpio_chardev.setup_v1()
self._driver.gpio_chardev = gpio_chardev
self._driver.connect(port=port)
self.fw_version = self._driver.get_fw_version()

Expand Down