Reduced logging in non debug
Build, push image, and notify Watchtower / build-image (push) Successful in 43s
Build, push image, and notify Watchtower / notify (push) Successful in 13s

This commit is contained in:
2026-08-06 15:20:12 +02:00
parent 2df05fd684
commit 5381631876
+9 -9
View File
@@ -51,7 +51,7 @@ class BaseLoraDevice:
# 1. Handle incoming ACK response # 1. Handle incoming ACK response
if data.get("_type") == "_ack": if data.get("_type") == "_ack":
ack_id = data.get("_ack_id") ack_id = data.get("_ack_id")
print(f"[ReliableLoRa] <- SUCCESSFULLY MATCHED ACK ID: {ack_id}") log(f"[ReliableLoRa] <- SUCCESSFULLY MATCHED ACK ID: {ack_id}")
if ack_id is not None: if ack_id is not None:
self.received_acks.add(ack_id) self.received_acks.add(ack_id)
if len(self.received_acks) > 100: if len(self.received_acks) > 100:
@@ -61,11 +61,11 @@ class BaseLoraDevice:
# 2. Handle incoming command expecting an ACK # 2. Handle incoming command expecting an ACK
msg_id = data.get("_msg_id") msg_id = data.get("_msg_id")
if msg_id is not None: if msg_id is not None:
print(f"[ReliableLoRa] <- Received packet with msg_id {msg_id}. Queuing ACK.") log(f"[ReliableLoRa] <- Received packet with msg_id {msg_id}. Queuing ACK.")
self._send_ack(msg_id) self._send_ack(msg_id)
if msg_id in self.processed_msg_ids: if msg_id in self.processed_msg_ids:
print(f"[ReliableLoRa] Discarding duplicate retry for msg_id {msg_id}") log(f"[ReliableLoRa] Discarding duplicate retry for msg_id {msg_id}")
return None # Discard duplicate retry return None # Discard duplicate retry
self.processed_msg_ids.add(msg_id) self.processed_msg_ids.add(msg_id)
@@ -86,10 +86,10 @@ class BaseLoraDevice:
msg_id = self._generate_msg_id() msg_id = self._generate_msg_id()
payload["_msg_id"] = msg_id payload["_msg_id"] = msg_id
print(f"\n[ReliableLoRa] === Starting send_reliable for msg_id {msg_id} ===") log(f"\n[ReliableLoRa] === Starting send_reliable for msg_id {msg_id} ===")
for attempt in range(max_retries): for attempt in range(max_retries):
print(f"[ReliableLoRa] Attempt {attempt + 1}/{max_retries} transmitting msg_id {msg_id}") log(f"[ReliableLoRa] Attempt {attempt + 1}/{max_retries} transmitting msg_id {msg_id}")
self.send(payload) self.send(payload)
# 1. Open a single continuous RX window for the full timeout duration # 1. Open a single continuous RX window for the full timeout duration
@@ -112,12 +112,12 @@ class BaseLoraDevice:
try: try:
if msg_id in self.received_acks: if msg_id in self.received_acks:
self.received_acks.remove(msg_id) self.received_acks.remove(msg_id)
print(f"[ReliableLoRa] === ACK received for msg_id {msg_id} on attempt {attempt + 1} ===") log(f"[ReliableLoRa] === ACK received for msg_id {msg_id} on attempt {attempt + 1} ===")
return True return True
finally: finally:
if lock: lock.release() if lock: lock.release()
print(f"[ReliableLoRa] Attempt {attempt + 1} timed out waiting for ACK for msg_id {msg_id}") log(f"[ReliableLoRa] Attempt {attempt + 1} timed out waiting for ACK for msg_id {msg_id}")
print(f"[ReliableLoRa] ERROR: Failed to receive ACK for msg_id {msg_id} after {max_retries} attempts.") print(f"[ReliableLoRa] ERROR: Failed to receive ACK for msg_id {msg_id} after {max_retries} attempts.")
return False return False
@@ -334,13 +334,13 @@ else:
hex_payload = payload.hex() hex_payload = payload.hex()
print(f"[RPi LoRa Serial] Transmitting HEX string: {hex_payload}") log(f"[RPi LoRa Serial] Transmitting HEX string: {hex_payload}")
# Format: AT+SEND=<group>,<payload_string>,<confirm>,<retries> # Format: AT+SEND=<group>,<payload_string>,<confirm>,<retries>
cmd = f"AT+SEND={group},{hex_payload},0,3" cmd = f"AT+SEND={group},{hex_payload},0,3"
resp = self._send_at_cmd(cmd, wait_time=0.3) resp = self._send_at_cmd(cmd, wait_time=0.3)
print(f"[RPi LoRa Serial] AT+SEND response: {resp}") log(f"[RPi LoRa Serial] AT+SEND response: {resp}")
def receive_packet(self, timeout_ms=500): def receive_packet(self, timeout_ms=500):
"""Reads incoming serial lines from LA66 stick with robust format parsing.""" """Reads incoming serial lines from LA66 stick with robust format parsing."""