mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 17:42:48 +00:00
store SNR in received packets
This commit is contained in:
parent
1fab9c5aac
commit
968a2d7fbc
@ -87,6 +87,14 @@ bool RF95Interface::reconfigure()
|
|||||||
return ERR_NONE;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add SNR data to received messages
|
||||||
|
*/
|
||||||
|
void RF95Interface::addReceiveMetadata(MeshPacket *mp)
|
||||||
|
{
|
||||||
|
mp->rx_snr = lora->getSNR();
|
||||||
|
}
|
||||||
|
|
||||||
void RF95Interface::setStandby()
|
void RF95Interface::setStandby()
|
||||||
{
|
{
|
||||||
int err = lora->standby();
|
int err = lora->standby();
|
||||||
|
@ -45,6 +45,10 @@ class RF95Interface : public RadioLibInterface
|
|||||||
*/
|
*/
|
||||||
virtual void startReceive();
|
virtual void startReceive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add SNR data to received messages
|
||||||
|
*/
|
||||||
|
virtual void addReceiveMetadata(MeshPacket *mp);
|
||||||
private:
|
private:
|
||||||
void setStandby();
|
void setStandby();
|
||||||
};
|
};
|
@ -185,6 +185,7 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||||||
mp->from = h->from;
|
mp->from = h->from;
|
||||||
mp->to = h->to;
|
mp->to = h->to;
|
||||||
mp->id = h->id;
|
mp->id = h->id;
|
||||||
|
addReceiveMetadata(mp);
|
||||||
|
|
||||||
if (!pb_decode_from_bytes(payload, payloadLen, SubPacket_fields, p)) {
|
if (!pb_decode_from_bytes(payload, payloadLen, SubPacket_fields, p)) {
|
||||||
DEBUG_MSG("Invalid protobufs in received mesh packet, discarding.\n");
|
DEBUG_MSG("Invalid protobufs in received mesh packet, discarding.\n");
|
||||||
@ -193,7 +194,7 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||||||
} else {
|
} else {
|
||||||
// parsing was successful, queue for our recipient
|
// parsing was successful, queue for our recipient
|
||||||
mp->has_payload = true;
|
mp->has_payload = true;
|
||||||
txGood++;
|
rxGood++;
|
||||||
|
|
||||||
deliverToReceiver(mp);
|
deliverToReceiver(mp);
|
||||||
}
|
}
|
||||||
|
@ -116,4 +116,9 @@ class RadioLibInterface : public RadioInterface
|
|||||||
/**
|
/**
|
||||||
* If a send was in progress finish it and return the buffer to the pool */
|
* If a send was in progress finish it and return the buffer to the pool */
|
||||||
void completeSending();
|
void completeSending();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add SNR data to received messages
|
||||||
|
*/
|
||||||
|
virtual void addReceiveMetadata(MeshPacket *mp) = 0;
|
||||||
};
|
};
|
@ -79,6 +79,13 @@ void SX1262Interface::setStandby()
|
|||||||
disableInterrupt();
|
disableInterrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add SNR data to received messages
|
||||||
|
*/
|
||||||
|
void SX1262Interface::addReceiveMetadata(MeshPacket *mp) {
|
||||||
|
mp->rx_snr = lora.getSNR();
|
||||||
|
}
|
||||||
|
|
||||||
void SX1262Interface::startReceive()
|
void SX1262Interface::startReceive()
|
||||||
{
|
{
|
||||||
setStandby();
|
setStandby();
|
||||||
|
@ -43,7 +43,10 @@ class SX1262Interface : public RadioLibInterface
|
|||||||
* Start waiting to receive a message
|
* Start waiting to receive a message
|
||||||
*/
|
*/
|
||||||
virtual void startReceive();
|
virtual void startReceive();
|
||||||
|
/**
|
||||||
|
* Add SNR data to received messages
|
||||||
|
*/
|
||||||
|
virtual void addReceiveMetadata(MeshPacket *mp);
|
||||||
private:
|
private:
|
||||||
void setStandby();
|
void setStandby();
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user