Skip to content
Draft
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
10 changes: 5 additions & 5 deletions pylabrobot/bmg_labtech/clariostar/driver/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

INIT_REPLY_TYPE = 0x13

# The firmware whose replies are decoded, as (lowest, highest) firmware number x 1000: the 1.x line.
# Older firmware is untested; 2.x (the line with native USB) lays its replies out unseen.
DECODED_FIRMWARE = (1300, 1999)
# The 1.x firmware whose replies are read, as (lowest, highest) firmware number x 1000. Older
# firmware is untested; 2.x (the line with native USB) lays its replies out differently.
FIRMWARE_1_RANGE = (1300, 1999)

_BARCODE_READER_TYPES = {0: "SE 923", 1: "CSE 600", 2: "SE 955", 3: "SE 965"}
BARCODE_READER_POSITIONS = ("front", "right", "optional 1", "optional 2")
Expand Down Expand Up @@ -218,7 +218,7 @@ def update_from_init_reply(self, payload: bytes) -> None:

Raises:
ValueError: if the payload is not a whole INIT reply, or comes from firmware outside
`DECODED_FIRMWARE`; the main board fields are filled either way.
`FIRMWARE_1_RANGE`; the main board fields are filled either way.
"""
blocks = dict(_blocks(payload))
main_board = _block(blocks, 0x01, 5)
Expand All @@ -227,7 +227,7 @@ def update_from_init_reply(self, payload: bytes) -> None:
self.firmware_build = main_board[2]
self.mainboard_revision = main_board[4]
self.model = "CLARIOstarPlus" if main_board[4] >= 2 else "CLARIOstar"
if not DECODED_FIRMWARE[0] <= firmware <= DECODED_FIRMWARE[1]:
if not FIRMWARE_1_RANGE[0] <= firmware <= FIRMWARE_1_RANGE[1]:
raise ValueError(f"INIT reply of firmware {self.firmware_version} is not decoded here")
for update in (
self._update_from_detectors,
Expand Down
8 changes: 4 additions & 4 deletions pylabrobot/bmg_labtech/clariostar/driver/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from .configuration import (
BARCODE_READER_POSITIONS,
DECODED_FIRMWARE,
FIRMWARE_1_RANGE,
FITTED_FIELDS,
DeviceConfiguration,
configuration_to_json,
Expand Down Expand Up @@ -563,7 +563,7 @@ def _decode_parameters(payload: bytes) -> Dict[str, int]:
"""A stored parameters reply's values, by key (see ``PARAMETER_TABLE``).

Raises:
ValueError: if the reply comes from firmware outside ``DECODED_FIRMWARE``.
ValueError: if the reply comes from firmware outside ``FIRMWARE_1_RANGE``.
"""
parameters = {
name: int.from_bytes(
Expand All @@ -573,7 +573,7 @@ def _decode_parameters(payload: bytes) -> Dict[str, int]:
)
for name, address, size in PARAMETER_TABLE
}
if not DECODED_FIRMWARE[0] <= parameters["firmware_version"] <= DECODED_FIRMWARE[1]:
if not FIRMWARE_1_RANGE[0] <= parameters["firmware_version"] <= FIRMWARE_1_RANGE[1]:
raise ValueError(
f"stored parameters of firmware {parameters['firmware_version']} are not decoded"
)
Expand Down Expand Up @@ -604,7 +604,7 @@ async def request_parameters(self) -> Dict[str, int]:

Raises:
ValueError: if the reply is not a whole stored parameters reply, or comes from firmware
outside ``DECODED_FIRMWARE``.
outside ``FIRMWARE_1_RANGE``.
"""
return self._decode_parameters(await self._request_parameters_reply())

Expand Down
Loading