num_strip_levels, num_bus_levels added to KindMaps

This commit is contained in:
onyx-and-iris 2023-07-25 16:22:47 +01:00
parent 77ba347e99
commit 9bf52b5c11
5 changed files with 14 additions and 6 deletions

View File

@ -110,6 +110,7 @@ class IRemote(metaclass=ABCMeta):
cmd += (f".{param}",)
return "".join(cmd)
@property
@abstractmethod
def identifier(self):
pass

View File

@ -53,6 +53,14 @@ class KindMapClass(metaclass=SingletonType):
def num_bus(self):
return sum(self.outs)
@property
def num_strip_levels(self) -> int:
return 2 * self.phys_in + 8 * self.virt_in
@property
def num_bus_levels(self) -> int:
return 8 * (self.phys_out + self.virt_out)
def __str__(self) -> str:
return self.name.capitalize()

View File

@ -9,7 +9,7 @@ class MacroButton(IRemote):
@property
def identifier(self):
return f"button[{self.index}]"
return f"command.button[{self.index}]"
@property
def state(self) -> bool:

View File

@ -103,12 +103,12 @@ class VbanRtPacket:
@property
def inputlevels(self) -> tuple:
"""returns the entire level array across all inputs for a kind"""
return self.strip_levels[0 : (2 * self._kind.phys_in + 8 * self._kind.virt_in)]
return self.strip_levels[0 : self._kind.num_strip_levels]
@property
def outputlevels(self) -> tuple:
"""returns the entire level array across all outputs for a kind"""
return self.bus_levels[0 : 8 * self._kind.num_bus]
return self.bus_levels[0 : self._kind.num_bus_levels]
@property
def stripstate(self) -> tuple:

View File

@ -141,9 +141,8 @@ class Updater(threading.Thread):
self._remote.socks[Socket.response].bind(
(socket.gethostbyname(socket.gethostname()), self._remote.port)
)
p_in, v_in = self._remote.kind.ins
self._remote._strip_comp = [False] * (2 * p_in + 8 * v_in)
self._remote._bus_comp = [False] * (self._remote.kind.num_bus * 8)
self._remote._strip_comp = [False] * (self._remote.kind.num_strip_levels)
self._remote._bus_comp = [False] * (self._remote.kind.num_bus_levels)
def run(self):
"""