Skip to content

Commit

Permalink
Move blink from attr to command
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelldls committed Oct 31, 2024
1 parent 396d4a3 commit 9dcf684
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/thorlabs_mff_fastcs/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
from fastcs.controller import Controller
from fastcs.datatypes import Bool, Int, String
from fastcs.wrappers import command


@dataclass
Expand All @@ -23,11 +24,8 @@ class ThorlabsMFFSettings:


class ThorlabsAPTProtocol:
def set_identify(self, action: bool) -> bytes:
if action:
return b"\x23\x02\x00\x00\x50\x01"
else:
return b""
def set_identify(self):
return b"\x23\x02\x00\x00\x50\x01"

def get_position(self) -> bytes:
return b"\x29\x04\x00\x00\x50\x01"
Expand Down Expand Up @@ -180,12 +178,6 @@ class ThorlabsMFF(Controller):
protocol.set_position,
),
)
blink_LED = AttrW(
Bool(znam="Disabled", onam="Enabled"),
handler=ThorlabsMFFHandlerW(
protocol.set_identify,
),
)
model = AttrR(
String(),
handler=ThorlabsMFFHandlerR(
Expand Down Expand Up @@ -254,3 +246,9 @@ async def connect(self) -> None:

async def close(self) -> None:
await self.conn.close()

@command()
async def blink_led(self) -> None:
await self.conn.send_command(
protocol.set_identify(),
)

0 comments on commit 9dcf684

Please sign in to comment.