Skip to content

Commit

Permalink
chore: prevent using pipette settings on flex (#14395)
Browse files Browse the repository at this point in the history
They are fundamentally not necessary or really functional on flex
pipettes, and the settings don't really work on the 96 anyway.
  • Loading branch information
sfoster1 authored Feb 2, 2024
1 parent 74e8c82 commit 10c68ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions robot-server/robot_server/service/legacy/routers/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from opentrons.hardware_control import (
HardwareControlAPI,
dev_types as hardware_dev_types,
API,
)
from opentrons.hardware_control.types import HardwareFeatureFlags
from opentrons_shared_data.pipette import (
Expand All @@ -29,7 +30,12 @@
from robot_server.deck_configuration.store import DeckConfigurationStore

from robot_server.errors import LegacyErrorResponse
from robot_server.hardware import get_hardware, get_robot_type, get_robot_type_enum
from robot_server.hardware import (
get_hardware,
get_robot_type,
get_robot_type_enum,
get_ot2_hardware,
)
from robot_server.service.legacy import reset_odd
from robot_server.service.legacy.models import V1BasicResponse
from robot_server.service.legacy.models.settings import (
Expand Down Expand Up @@ -258,13 +264,13 @@ async def get_robot_settings(

@router.get(
"/settings/pipettes",
description="List all settings for all known pipettes by id",
description="List all settings for all known pipettes by id. Only available on OT-2.",
response_model=MultiPipetteSettings,
response_model_by_alias=True,
response_model_exclude_unset=True,
)
async def get_pipette_settings(
hardware: HardwareControlAPI = Depends(get_hardware),
hardware: API = Depends(get_ot2_hardware),
) -> MultiPipetteSettings:
res = {}
attached_pipettes = hardware.attached_pipettes
Expand All @@ -286,7 +292,7 @@ async def get_pipette_settings(

@router.get(
path="/settings/pipettes/{pipette_id}",
description="Get the settings of a specific pipette by ID",
description="Get the settings of a specific pipette by ID. Only available on OT-2.",
response_model=PipetteSettings,
response_model_by_alias=True,
response_model_exclude_unset=True,
Expand All @@ -295,7 +301,7 @@ async def get_pipette_settings(
},
)
async def get_pipette_setting(
pipette_id: str, hardware: HardwareControlAPI = Depends(get_hardware)
pipette_id: str, hardware: API = Depends(get_ot2_hardware)
) -> PipetteSettings:
attached_pipettes = hardware.attached_pipettes
known_ids = mutable_configurations.known_pipettes(
Expand All @@ -314,7 +320,7 @@ async def get_pipette_setting(

@router.patch(
path="/settings/pipettes/{pipette_id}",
description="Change the settings of a specific pipette",
description="Change the settings of a specific pipette. Only available on OT-2.",
response_model=PipetteSettings,
response_model_by_alias=True,
response_model_exclude_unset=True,
Expand All @@ -323,7 +329,9 @@ async def get_pipette_setting(
},
)
async def patch_pipette_setting(
pipette_id: str, settings_update: PipetteSettingsUpdate
pipette_id: str,
settings_update: PipetteSettingsUpdate,
hardware: None = Depends(get_ot2_hardware),
) -> PipetteSettings:
# Convert fields to dict of field name to value
fields = settings_update.setting_fields or {}
Expand Down
2 changes: 1 addition & 1 deletion robot-server/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ async def get_version_override() -> ComponentVersions:
def _override_ot2_hardware_with_mock(hardware: MagicMock) -> Iterator[None]:
async def get_ot2_hardware_override() -> API:
"""Override for the get_ot2_hardware FastAPI dependency."""
return MagicMock(spec=API)
return hardware

app.dependency_overrides[get_ot2_hardware] = get_ot2_hardware_override
yield
Expand Down

0 comments on commit 10c68ec

Please sign in to comment.