Skip to content

Commit 88cc4c4

Browse files
authored
fix(app): more heater-shaker max limits stuff (#19083)
We need a couple more places: - an engine max limit - the app module card max limit (oopsy didn't test the other one good) ## Actual device testing - [x] control to 32C (well, "control") from the module card - [x] do that in a protocol
1 parent fc09053 commit 88cc4c4

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

api/src/opentrons/protocol_api/module_validation_and_errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class InvalidTargetSpeedError(ValueError):
1919

2020

2121
def _validate_hs_temp_nomin(celsius: float) -> float:
22-
if celsius <= HEATER_SHAKER_TEMPERATURE_MAX:
22+
if 0 <= celsius <= HEATER_SHAKER_TEMPERATURE_MAX:
2323
return celsius
2424
else:
2525
raise InvalidTargetTemperatureError(
2626
f"Cannot set Heater-Shaker to {celsius} °C."
2727
f" The maximum temperature for the Heater-Shaker is"
28-
f"{HEATER_SHAKER_TEMPERATURE_MAX} °C."
28+
f"{HEATER_SHAKER_TEMPERATURE_MAX} °C, and the temperature must be positive."
2929
)
3030

3131

api/src/opentrons/protocol_engine/state/module_substates/heater_shaker_module_substate.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Heater-Shaker Module sub-state."""
2+
23
from dataclasses import dataclass
34
from typing import NewType, Optional
45

@@ -18,8 +19,7 @@
1819
HeaterShakerModuleId = NewType("HeaterShakerModuleId", str)
1920

2021

21-
# TODO (spp, 2022-03-22): Move these values to heater-shaker module definition.
22-
HEATER_SHAKER_TEMPERATURE_RANGE = TemperatureRange(min=37, max=95)
22+
HEATER_SHAKER_TEMPERATURE_RANGE = TemperatureRange(min=0, max=95)
2323
HEATER_SHAKER_SPEED_RANGE = SpeedRange(min=200, max=3000)
2424

2525

@@ -99,9 +99,11 @@ def from_live_data(
9999
if ModuleDataValidator.is_heater_shaker_data(data):
100100
return cls(
101101
module_id=module_id,
102-
labware_latch_status=HeaterShakerLatchStatus.CLOSED
103-
if data["labwareLatchStatus"] == "idle_closed"
104-
else HeaterShakerLatchStatus.OPEN,
102+
labware_latch_status=(
103+
HeaterShakerLatchStatus.CLOSED
104+
if data["labwareLatchStatus"] == "idle_closed"
105+
else HeaterShakerLatchStatus.OPEN
106+
),
105107
is_plate_shaking=data["targetSpeed"] is not None,
106108
plate_target_temperature=data["targetTemp"],
107109
)

api/tests/opentrons/protocol_api_old/test_module_validation_and_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_validate_heater_shaker_temperature_raises_under_api_225(
2929
)
3030

3131

32-
@pytest.mark.parametrize("invalid_celsius_value", [95.01])
32+
@pytest.mark.parametrize("invalid_celsius_value", [-1, 95.01])
3333
def test_validate_heater_shaker_temperature_raises_over_api_225(
3434
invalid_celsius_value: float,
3535
) -> None:

api/tests/opentrons/protocol_engine/state/test_module_view_old.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Try to add new tests to test_module_state.py, where they can be tested together,
55
treating ModuleState as a private implementation detail.
66
"""
7+
78
import pytest
89
from math import isclose
910
from pytest_lazy_fixtures import lf as lazy_fixture
@@ -1159,7 +1160,7 @@ def test_magnetic_module_view_calculate_magnet_hardware_height(
11591160
assert result == expected_result
11601161

11611162

1162-
@pytest.mark.parametrize("target_temp", [36.8, 95.1])
1163+
@pytest.mark.parametrize("target_temp", [-1, 95.1])
11631164
def test_validate_heater_shaker_target_temperature_raises(
11641165
heater_shaker_v1_def: ModuleDefinition,
11651166
target_temp: float,

app/src/organisms/ModuleCard/HeaterShakerSlideout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
CELSIUS,
1616
getModuleDisplayName,
1717
HS_TEMP_MAX,
18-
HS_TEMP_MIN,
1918
} from '@opentrons/shared-data'
2019

2120
import { SubmitPrimaryButton } from '/app/atoms/buttons'
@@ -91,14 +90,14 @@ export const HeaterShakerSlideout = (
9190
onCloseClick()
9291
}
9392
}
94-
const errorMessage =
95-
hsValue != null && (hsValue < HS_TEMP_MIN || hsValue > HS_TEMP_MAX)
96-
? t('input_out_of_range')
97-
: null
9893

9994
const inputMax = HS_TEMP_MAX
100-
const inputMin = HS_TEMP_MIN
95+
const inputMin = 20
10196
const unit = CELSIUS
97+
const errorMessage =
98+
hsValue != null && (hsValue < inputMin || hsValue > HS_TEMP_MAX)
99+
? t('input_out_of_range')
100+
: null
102101

103102
const handleCloseSlideout = (): void => {
104103
setHsValue(null)

0 commit comments

Comments
 (0)