small indent issue

This commit is contained in:
Florent
2026-04-25 15:48:45 +02:00
parent 2e178e83e7
commit f538062546

View File

@@ -942,36 +942,36 @@ class MessageReader:
await self.dispatcher.dispatch( await self.dispatcher.dispatch(
Event(EventType.DISCOVER_RESPONSE, ndr, attributes) Event(EventType.DISCOVER_RESPONSE, ndr, attributes)
) )
elif packet_type_value == PacketType.CONTACT_DELETED.value: elif packet_type_value == PacketType.CONTACT_DELETED.value:
# N01: PUSH_CODE_CONTACT_DELETED (0x8F) — 1-byte code + 32-byte pubkey # N01: PUSH_CODE_CONTACT_DELETED (0x8F) — 1-byte code + 32-byte pubkey
# Emitted by MyMesh::onContactOverwrite() (MyMesh.cpp:325-334) # Emitted by MyMesh::onContactOverwrite() (MyMesh.cpp:325-334)
if len(data) < 33: if len(data) < 33:
logger.debug("CONTACT_DELETED frame too short (%d bytes, need 33)", len(data)) logger.debug("CONTACT_DELETED frame too short (%d bytes, need 33)", len(data))
return return
pubkey = data[1:33].hex() pubkey = data[1:33].hex()
await self.dispatcher.dispatch( await self.dispatcher.dispatch(
Event(EventType.CONTACT_DELETED, {"pubkey": pubkey}, {"pubkey": pubkey}) Event(EventType.CONTACT_DELETED, {"pubkey": pubkey}, {"pubkey": pubkey})
) )
elif packet_type_value == PacketType.CONTACTS_FULL.value: elif packet_type_value == PacketType.CONTACTS_FULL.value:
# N02: PUSH_CODE_CONTACTS_FULL (0x90) — 1-byte push, no payload # N02: PUSH_CODE_CONTACTS_FULL (0x90) — 1-byte push, no payload
# Emitted by MyMesh::onContactsFull() (MyMesh.cpp:336) # Emitted by MyMesh::onContactsFull() (MyMesh.cpp:336)
await self.dispatcher.dispatch(Event(EventType.CONTACTS_FULL, {})) await self.dispatcher.dispatch(Event(EventType.CONTACTS_FULL, {}))
elif packet_type_value == PacketType.TUNING_PARAMS.value: elif packet_type_value == PacketType.TUNING_PARAMS.value:
# N03: RESP_CODE_TUNING_PARAMS (23) — response to CMD_GET_TUNING_PARAMS (43) # N03: RESP_CODE_TUNING_PARAMS (23) — response to CMD_GET_TUNING_PARAMS (43)
# Format: 1-byte code + 4-byte rx_delay (LE) + 4-byte airtime_factor (LE) = 9 bytes # Format: 1-byte code + 4-byte rx_delay (LE) + 4-byte airtime_factor (LE) = 9 bytes
# Emitted by MyMesh.cpp:1307-1313 # Emitted by MyMesh.cpp:1307-1313
if len(data) < 9: if len(data) < 9:
logger.debug("TUNING_PARAMS frame too short (%d bytes, need 9)", len(data)) logger.debug("TUNING_PARAMS frame too short (%d bytes, need 9)", len(data))
await self.dispatcher.dispatch( await self.dispatcher.dispatch(
Event(EventType.ERROR, {"reason": "invalid_frame_length"}) Event(EventType.ERROR, {"reason": "invalid_frame_length"})
) )
return return
rx_delay = int.from_bytes(data[1:5], byteorder="little") rx_delay = int.from_bytes(data[1:5], byteorder="little")
airtime_factor = int.from_bytes(data[5:9], byteorder="little") airtime_factor = int.from_bytes(data[5:9], byteorder="little")
res = {"rx_delay": rx_delay, "airtime_factor": airtime_factor} res = {"rx_delay": rx_delay, "airtime_factor": airtime_factor}
await self.dispatcher.dispatch(Event(EventType.TUNING_PARAMS, res)) await self.dispatcher.dispatch(Event(EventType.TUNING_PARAMS, res))
else: else:
logger.debug(f"Unhandled data received {data}") logger.debug(f"Unhandled data received {data}")