Reject trace responses with RSSI=0 before accepting as ping result #55

Closed
opened 2026-10-27 09:30:31 +01:00 by adam · 1 comment
Owner

Branch: feat/companion

Problem

Ping responses occasionally return rssi: 0, snr: 0. RSSI of 0 dBm is physically impossible for LoRa — it indicates the SX1262 getPacketStatus() register returned a zero value (likely an SPI bus read anomaly).

The trace helper currently accepts any matching tag unconditionally:

# trace.py:72-83
if trace_tag in self.pending_pings:
    ping_info['result'] = {
        'rssi': getattr(packet, "rssi", 0),  # accepts 0 without validation
        ...
    }
    ping_info['event'].set()

Suggested Fix

Add a signal sanity check before accepting the trace response:

rssi_val = getattr(packet, "rssi", 0)
if rssi_val == 0:
    logger.warning(f"Ignoring trace response for tag {trace_tag} with RSSI=0 (no signal data)")
    return  # wait for a valid response or let timeout handle it

This way, a spurious 0/0 read is silently dropped and the caller either gets a real response (if one arrives within the timeout) or a clean timeout error — rather than reporting fake signal data.

**Branch:** `feat/companion` ## Problem Ping responses occasionally return `rssi: 0, snr: 0`. RSSI of 0 dBm is physically impossible for LoRa — it indicates the SX1262 `getPacketStatus()` register returned a zero value (likely an SPI bus read anomaly). The trace helper currently accepts any matching tag unconditionally: ```python # trace.py:72-83 if trace_tag in self.pending_pings: ping_info['result'] = { 'rssi': getattr(packet, "rssi", 0), # accepts 0 without validation ... } ping_info['event'].set() ``` ## Suggested Fix Add a signal sanity check before accepting the trace response: ```python rssi_val = getattr(packet, "rssi", 0) if rssi_val == 0: logger.warning(f"Ignoring trace response for tag {trace_tag} with RSSI=0 (no signal data)") return # wait for a valid response or let timeout handle it ``` This way, a spurious 0/0 read is silently dropped and the caller either gets a real response (if one arrives within the timeout) or a clean timeout error — rather than reporting fake signal data. <!-- github-sync-id:4060111166 -->
adam closed this issue 2026-10-27 09:30:31 +01:00
Author
Owner

For me Ping fails almost every time. I'm using a Seedstudio SX126 connected via SPI

For me Ping fails almost every time. I'm using a Seedstudio SX126 connected via SPI <!-- github-comment-id:4284403938 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/pyMC_Repeater#55