move delay into {XAirRemote}.query()

update getters
This commit is contained in:
onyx-and-iris 2024-02-03 13:03:49 +00:00
parent cab3888946
commit 035c8d6507
8 changed files with 8 additions and 15 deletions

View File

@ -13,8 +13,7 @@ class IBus(abc.ABC):
self.index = index + 1 self.index = index + 1
def getter(self, param: str): def getter(self, param: str):
self._remote.send(f"{self.address}/{param}") return self._remote.query(f"{self.address}/{param}")
return self._remote.info_response
def setter(self, param: str, val: int): def setter(self, param: str, val: int):
self._remote.send(f"{self.address}/{param}", val) self._remote.send(f"{self.address}/{param}", val)

View File

@ -13,8 +13,7 @@ class IConfig(abc.ABC):
self._remote = remote self._remote = remote
def getter(self, param: str): def getter(self, param: str):
self._remote.send(f"{self.address}/{param}") return self._remote.query(f"{self.address}/{param}")
return self._remote.info_response
def setter(self, param: str, val: int): def setter(self, param: str, val: int):
self._remote.send(f"{self.address}/{param}", val) self._remote.send(f"{self.address}/{param}", val)

View File

@ -11,8 +11,7 @@ class IDCA(abc.ABC):
self.index = index + 1 self.index = index + 1
def getter(self, param: str) -> tuple: def getter(self, param: str) -> tuple:
self._remote.send(f"{self.address}/{param}") return self._remote.query(f"{self.address}/{param}")
return self._remote.info_response
def setter(self, param: str, val: int): def setter(self, param: str, val: int):
self._remote.send(f"{self.address}/{param}", val) self._remote.send(f"{self.address}/{param}", val)

View File

@ -13,8 +13,7 @@ class IFX(abc.ABC):
self.index = index + 1 self.index = index + 1
def getter(self, param: str): def getter(self, param: str):
self._remote.send(f"{self.address}/{param}") return self._remote.query(f"{self.address}/{param}")
return self._remote.info_response
def setter(self, param: str, val: int): def setter(self, param: str, val: int):
self._remote.send(f"{self.address}/{param}", val) self._remote.send(f"{self.address}/{param}", val)

View File

@ -15,8 +15,7 @@ class ILR(abc.ABC):
self.index = index + 1 self.index = index + 1
def getter(self, param: str): def getter(self, param: str):
self._remote.send(f"{self.address}/{param}") return self._remote.query(f"{self.address}/{param}")
return self._remote.info_response
def setter(self, param: str, val: int): def setter(self, param: str, val: int):
self._remote.send(f"{self.address}/{param}", val) self._remote.send(f"{self.address}/{param}", val)

View File

@ -15,8 +15,7 @@ class IRtn(abc.ABC):
self.index = index + 1 self.index = index + 1
def getter(self, param: str): def getter(self, param: str):
self._remote.send(f"{self.address}/{param}") return self._remote.query(f"{self.address}/{param}")
return self._remote.info_response
def setter(self, param: str, val: int): def setter(self, param: str, val: int):
self._remote.send(f"{self.address}/{param}", val) self._remote.send(f"{self.address}/{param}", val)

View File

@ -13,8 +13,7 @@ class IStrip(abc.ABC):
self.index = index + 1 self.index = index + 1
def getter(self, param: str) -> tuple: def getter(self, param: str) -> tuple:
self._remote.send(f"{self.address}/{param}") return self._remote.query(f"{self.address}/{param}")
return self._remote.info_response
def setter(self, param: str, val: int): def setter(self, param: str, val: int):
self._remote.send(f"{self.address}/{param}", val) self._remote.send(f"{self.address}/{param}", val)

View File

@ -98,10 +98,10 @@ class XAirRemote(abc.ABC):
def send(self, addr: str, param: Optional[str] = None): def send(self, addr: str, param: Optional[str] = None):
self.logger.debug(f"sending: {addr} {param if param is not None else ''}") self.logger.debug(f"sending: {addr} {param if param is not None else ''}")
self.server.send_message(addr, param) self.server.send_message(addr, param)
time.sleep(self._delay)
def query(self, address): def query(self, address):
self.send(address) self.send(address)
time.sleep(self._delay)
return self.info_response return self.info_response
def __exit__(self, exc_type, exc_value, exc_tr): def __exit__(self, exc_type, exc_value, exc_tr):