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}")

View file

@ -278,6 +278,9 @@ class MessageReader:
res["fw_build"] = dbuf.read(12).decode("utf-8", "ignore").replace("\0", "")
res["model"] = dbuf.read(40).decode("utf-8", "ignore").replace("\0", "")
res["ver"] = dbuf.read(20).decode("utf-8", "ignore").replace("\0", "")
rpt = dbuf.read(1)
if len(rpt) > 0:
res["repeat"] = (rpt[0] != 0)
await self.dispatcher.dispatch(Event(EventType.DEVICE_INFO, res))
elif packet_type_value == PacketType.CUSTOM_VARS.value: