Skip to content

Commit

Permalink
Add deactivate_heater G-Code
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Maggio committed Jul 19, 2022
1 parent 1ed6115 commit 0926e14
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def _get_labware_latch_state(self, command: Command) -> str:
return f"M241 STATUS:{self._latch_status.value.upper()}"

def _deactivate_heater(self, command: Command) -> str:
pass
self._temperature.set_target(None)
return f"M106"

@staticmethod
def get_terminator() -> bytes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def deactivate(self, temperature: float) -> None:
self._target = None
self._current = temperature

def set_target(self, target: float) -> None:
def set_target(self, target: Optional[float]) -> None:
self._target = target

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,25 @@ async def test_deactivate_shaker(heatershaker: HeaterShaker) -> None:
assert heatershaker.target_speed is None
assert heatershaker.speed == 0

async def test_deactivate_heater(heatershaker: HeaterShaker) -> None:
await heatershaker.wait_next_poll()
await heatershaker.start_set_temperature(50.0)
await heatershaker.await_temperature(50.0)
assert heatershaker.target_temperature == 50.0
assert 49.3 <= heatershaker.temperature <= 50.7

await heatershaker.deactivate_heater()
assert heatershaker.target_temperature is None

assert 49.3 <= heatershaker.temperature <= 50.7 # Temp should not change
await heatershaker.wait_next_poll()
await heatershaker.wait_next_poll()
await heatershaker.wait_next_poll()
assert 49.3 <= heatershaker.temperature <= 50.7 # Temp should not change


async def test_temp(heatershaker: HeaterShaker) -> None:
"""Test setting temp"""
await heatershaker.wait_next_poll()
await heatershaker.start_set_temperature(50.0)

# Have to wait for next poll because target temp will not update until then
await heatershaker.wait_next_poll()
Expand Down

0 comments on commit 0926e14

Please sign in to comment.