Skip to content

Commit

Permalink
Change program_number soft signal to take an int and work out the str…
Browse files Browse the repository at this point in the history
…ing later
  • Loading branch information
noemifrisina committed Sep 17, 2024
1 parent 3ad8d10 commit 38ed26e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/dodal/devices/i24/pmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ class ScanState(IntEnum):
DONE = 0


class ProgramNumber(str, Enum):
ELEVEN = "&2b11r"
TWELVE = "&2b12r"
FOURTEEN = "&2b14r"


class LaserSettings(str, Enum):
"""PMAC strings to switch laser on and off.
Note. On the PMAC, M-variables usually have to do with position compare
Expand Down Expand Up @@ -149,12 +143,17 @@ def __init__(

super().__init__(backend, timeout, name)

async def _get_prog_number_string(self) -> str:
prog_num = await self.prog_num.get_value()
return f"&2b{prog_num}r"

@AsyncStatus.wrap
async def kickoff(self):
"""Kick off the collection by sending a program number to the pmac_string and \
wait for the scan status PV to go to 1.
"""
prog_num_str = await self.prog_num.get_value()
# prog_num = await self.prog_num.get_value()
prog_num_str = await self._get_prog_number_string()
await self.signal.set(prog_num_str, wait=True)
await wait_for_value(
self.status,
Expand Down Expand Up @@ -227,7 +226,7 @@ def __init__(self, prefix: str, name: str = "") -> None:

# A couple of soft signals for running a collection: program number to send to
# the PMAC_STRING and expected collection time.
self.program_number = soft_signal_rw(str)
self.program_number = soft_signal_rw(int)
self.collection_time = soft_signal_rw(float, units="s")

self.run_program = ProgramRunner(
Expand Down
3 changes: 1 addition & 2 deletions tests/devices/unit_tests/i24/test_pmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
PMAC,
EncReset,
LaserSettings,
ProgramNumber,
)
from dodal.devices.util.test_utils import patch_motor

Expand Down Expand Up @@ -83,7 +82,7 @@ async def go_high_then_low():
lambda *args, **kwargs: asyncio.create_task(go_high_then_low()), # type: ignore
)

set_mock_value(fake_pmac.program_number, ProgramNumber.ELEVEN)
set_mock_value(fake_pmac.program_number, 11)
set_mock_value(fake_pmac.collection_time, 2.0)
await fake_pmac.run_program.kickoff()
await fake_pmac.run_program.complete()
Expand Down

0 comments on commit 38ed26e

Please sign in to comment.