toRadioMetrics

fun MeshPacket.toRadioMetrics(): RadioMetrics?(source)

Extracts RadioMetrics from a MeshPacket. Returns null only when the packet carries no radio reading at all: rx_rssi absent and rx_snr zero, as in one replayed from history.

Absent is not zero. Since protobufs 2.8.0 rx_rssi is optional precisely because 0 dBm is a legitimate reading - an SX126x can report exactly 0, and the SX127x formula can go positive - so a packet carrying a real 0 dBm still has metrics. An absent rx_rssi next to a nonzero rx_snr still has metrics too, with RadioMetrics.rssiDbm falling back to 0; that is the shape a packet from pre-2.8.0 firmware takes, where proto3 elided a genuine 0 from the wire.