From 1f522b997ef522a634072b297f51dfa168350924 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Sat, 16 Jul 2022 21:52:41 +0100 Subject: [PATCH] reset() added to command. minor delay added to login (give time for first incoming packet). --- vban_cmd/base.py | 3 +++ vban_cmd/command.py | 3 +++ vban_cmd/packet.py | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vban_cmd/base.py b/vban_cmd/base.py index ffb06ff..1adaa12 100644 --- a/vban_cmd/base.py +++ b/vban_cmd/base.py @@ -70,6 +70,7 @@ class VbanCmd(metaclass=ABCMeta): self._public_packet = self._get_rt() worker2 = Thread(target=self._updates, daemon=True) worker2.start() + time.sleep(0.1) def _send_register_rt(self): """Fires a subscription packet every 10 seconds""" @@ -143,6 +144,8 @@ class VbanCmd(metaclass=ABCMeta): self.text_header.framecounter = count.to_bytes(4, "little") if param: self.cache[f"{id_}.{param}"] = val + if self.sync: + time.sleep(0.02) @script def sendtext(self, cmd): diff --git a/vban_cmd/command.py b/vban_cmd/command.py index f1c7e08..88fd080 100644 --- a/vban_cmd/command.py +++ b/vban_cmd/command.py @@ -43,3 +43,6 @@ class Command(IRemote): self.setter("lock", 1 if val else 0) lock = property(fset=set_lock) + + def reset(self): + self._remote.apply_config("reset") diff --git a/vban_cmd/packet.py b/vban_cmd/packet.py index f9ff8ed..96ef829 100644 --- a/vban_cmd/packet.py +++ b/vban_cmd/packet.py @@ -187,7 +187,7 @@ class VBAN_VMRT_Packet_Data: def striplabels(self) -> tuple: """returns tuple of strip labels""" return tuple( - self._stripLabelUTF8c60[i : i + 60].decode("ascii").split("\x00")[0] + self._stripLabelUTF8c60[i : i + 60].decode().split("\x00")[0] for i in range(0, 480, 60) ) @@ -195,7 +195,7 @@ class VBAN_VMRT_Packet_Data: def buslabels(self) -> tuple: """returns tuple of bus labels""" return tuple( - self._busLabelUTF8c60[i : i + 60].decode("ascii").split("\x00")[0] + self._busLabelUTF8c60[i : i + 60].decode().split("\x00")[0] for i in range(0, 480, 60) )