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 committed Aug 10, 2023
1 parent 6923d79 commit 2b65d37
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 2b65d37

Please sign in to comment.