get/set repeat mode

This commit is contained in:
Florent
2026-02-14 09:25:34 -04:00
parent b8294cfb2f
commit 03a2a7c64e
2 changed files with 13 additions and 10 deletions

View File

@@ -66,16 +66,16 @@ class DeviceCommands(CommandHandlerBase):
b"\x0c" + int(val).to_bytes(4, "little"), [EventType.OK, EventType.ERROR]
)
async def set_radio(self, freq: float, bw: float, sf: int, cr: int) -> Event:
logger.debug(f"Setting radio params: freq={freq}, bw={bw}, sf={sf}, cr={cr}")
return await self.send(
b"\x0b"
+ int(float(freq) * 1000).to_bytes(4, "little")
+ int(float(bw) * 1000).to_bytes(4, "little")
+ int(sf).to_bytes(1, "little")
+ int(cr).to_bytes(1, "little"),
[EventType.OK, EventType.ERROR],
)
async def set_radio(self, freq: float, bw: float, sf: int, cr: int, repeat = None) -> Event:
logger.debug(f"Setting radio params: freq={freq}, bw={bw}, sf={sf}, cr={cr}, repeat={repeat}")
data = b"\x0b"
data += int(float(freq) * 1000).to_bytes(4, "little")
data += int(float(bw) * 1000).to_bytes(4, "little")
data += int(sf).to_bytes(1, "little")
data += int(cr).to_bytes(1, "little")
if not repeat is None:
data += int(repeat).to_bytes(1,"little")
return await self.send(data, [EventType.OK, EventType.ERROR])
async def set_tuning(self, rx_dly: int, af: int) -> Event:
logger.debug(f"Setting tuning params: rx_dly={rx_dly}, af={af}")