add fget() to level getters in strip, bus

This commit is contained in:
onyx-and-iris 2022-10-04 15:40:32 +01:00
parent a029011012
commit 8663aab2ce
2 changed files with 10 additions and 4 deletions

View File

@ -74,13 +74,16 @@ class BusLevel(IRemote):
def getter(self): def getter(self):
"""Returns a tuple of level values for the channel.""" """Returns a tuple of level values for the channel."""
def fget(i):
return round((((1 << 16) - 1) - i) * -0.01, 1)
if self._remote.running and self._remote.event.ldirty: if self._remote.running and self._remote.event.ldirty:
return tuple( return tuple(
round(i * -0.01, 1) fget(i)
for i in self._remote.cache["bus_level"][self.range[0] : self.range[-1]] for i in self._remote.cache["bus_level"][self.range[0] : self.range[-1]]
) )
return tuple( return tuple(
round(i * -0.01, 1) fget(i)
for i in self._remote._get_levels(self.public_packet)[1][ for i in self._remote._get_levels(self.public_packet)[1][
self.range[0] : self.range[-1] self.range[0] : self.range[-1]
] ]

View File

@ -105,15 +105,18 @@ class StripLevel(IRemote):
def getter(self): def getter(self):
"""Returns a tuple of level values for the channel.""" """Returns a tuple of level values for the channel."""
def fget(i):
return round((((1 << 16) - 1) - i) * -0.01, 1)
if self._remote.running and self._remote.event.ldirty: if self._remote.running and self._remote.event.ldirty:
return tuple( return tuple(
round(i * -0.01, 1) fget(i)
for i in self._remote.cache["strip_level"][ for i in self._remote.cache["strip_level"][
self.range[0] : self.range[-1] self.range[0] : self.range[-1]
] ]
) )
return tuple( return tuple(
round(i * -0.01, 1) fget(i)
for i in self._remote._get_levels(self.public_packet)[0][ for i in self._remote._get_levels(self.public_packet)[0][
self.range[0] : self.range[-1] self.range[0] : self.range[-1]
] ]