Skip to content

Commit

Permalink
tridonic: support sending 8-bit backward frames
Browse files Browse the repository at this point in the history
Bug: #126
  • Loading branch information
jktjkt authored and sde1000 committed Aug 10, 2023
1 parent 107c312 commit 8276c9c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions dali/driver/hid.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,15 @@ async def _power_supply(self, supply_on):
self.disconnect(reconnect=True)
raise CommunicationError

@staticmethod
def _command_mode(frame):
if len(frame) == 8:
return tridonic._SEND_MODE_DALI8
if len(frame) == 16:
return tridonic._SEND_MODE_DALI16
if len(frame) == 24:
return tridonic._SEND_MODE_DALI24
raise UnsupportedFrameTypeError

async def _send_raw(self, command):
frame = command.frame
Expand All @@ -423,8 +432,7 @@ async def _send_raw(self, command):
data = self._cmd(
self._CMD_SEND, seq,
ctrl=self._SEND_CTRL_SENDTWICE if command.sendtwice else 0,
mode=self._SEND_MODE_DALI16 if len(frame) == 16
else self._SEND_MODE_DALI24,
mode=self._command_mode(frame),
frame=frame.pack_len(4))
try:
os.write(self._f, data)
Expand Down

0 comments on commit 8276c9c

Please sign in to comment.