fix(api): fix APIv1 GPIO ctl for cmdline and jupyter protocol execution #6091
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
When the robot server is running, protocols executed in Jupyter or using
opentrons_execute
would not have control over the GPIOs. Currently, a warning with a workaround is shown if the protocol is in APIv2. However, there is no indication given to the user of why GPIO controls are not working when they are running a v1 protocol.This PR fixes the issue by surfacing the same warning as v2 and actually implementing the workaround for v1 protocols.
closes #6045
Changelog
info
message right before GPIO chardev is being built in APIv1robot.connect
this automatically surfaces the following warning when a v1 protocol is executed in Jupyter or via opentrons_execute:
Failed to initialize character device, will not be able to control gpios (lights, button, smoothie kill, smoothie reset). If you need to control gpios, first stop the robot server with systemctl stop opentrons-robot-server. Until you restart the server with systemctl start opentrons-robot-server, you will be unable to control the robot using the Opentrons app.
if the GPIOs are not held by the robot server, the resulting
GPIOCharDev
(not the simulator) will be set as therobot._driver.gpio_chardev
setup_v1
function in gpio.py so robot can setup GPIO pins without being asyncReview requests
Not sure if adding
GPIOCharDev.setup_v1
is the best way to tackle the problem, any suggestions?Test this PR by executing
robot.turn_on_rail_lights()
in Jupyter and usingopentrons_execute
:Risk assessment
Low - this PR only affects APIv1 protocols when the robot server is stopped