-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api,hardware): update devices in bootloader (#12383)
Currently, if we have a device in its bootloader during our network probe, we probably don't update its firmware properly. That's for a couple reasons: - If it's a pipette, we don't actually know what pipette type it is, since it won't be in attached pipettes and the bootloader can't give us the type - Even if it's not, we might not handle the node id properly This commit fixes both problems. For pipettes, we take advantage of the device subidentifier recently introduced to the device info response payload. That subidentifier is device-specific; for the pipettes it will be the pipette type, and for others it isn't specified and is 0. That means that we can now find the right pipette type for a pipette that is stuck in its bootloader. It also means we can simplify the hardware interface by no longer requiring the attached pipettes dict, though we only want that once we're confident all pipettes have the new bootloader. As a fallback for everything else, we should now explicitly handle bootloader nodes at every stage. One problem this doesn't fix is that independent of firmware update, the robot server complains if it doesn't have a certain core set of node ids responding on the network. In that case, where for instance gantry x or y or the head are stuck in the bootloader, we'll still have a bad time. But it's separate enough to require a followup. Closes RQA-584
- Loading branch information
Showing
15 changed files
with
214 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,23 @@ | ||
"""Firmware update target.""" | ||
from dataclasses import dataclass, field | ||
from typing_extensions import Final | ||
from dataclasses import dataclass | ||
|
||
from opentrons_hardware.firmware_bindings import NodeId | ||
|
||
|
||
BootloaderNodeIdMap: Final = { | ||
NodeId.head: NodeId.head_bootloader, | ||
NodeId.pipette_left: NodeId.pipette_left_bootloader, | ||
NodeId.pipette_right: NodeId.pipette_right_bootloader, | ||
NodeId.gantry_x: NodeId.gantry_x_bootloader, | ||
NodeId.gantry_y: NodeId.gantry_y_bootloader, | ||
NodeId.gripper: NodeId.gripper_bootloader, | ||
} | ||
|
||
|
||
@dataclass | ||
class Target: | ||
"""Pair of a sub-system's node id with its bootloader's node id.""" | ||
|
||
system_node: NodeId | ||
bootloader_node: NodeId = field(init=False) | ||
bootloader_node: NodeId | ||
|
||
def __post_init__(self) -> None: | ||
"""Assign computed values.""" | ||
bn = BootloaderNodeIdMap.get(self.system_node) | ||
assert bn, f"'{self.system_node}' is not valid for firmware update." | ||
self.bootloader_node = bn | ||
@classmethod | ||
def from_single_node(cls, node: NodeId) -> "Target": | ||
"""Build a Target from just one of its node ids.""" | ||
assert node not in ( | ||
NodeId.broadcast, | ||
NodeId.host, | ||
), f"Invalid update target {node}" | ||
return cls( | ||
system_node=node.application_for(), bootloader_node=node.bootloader_for() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.