Skip to content

Commit

Permalink
add rssi and snr to json output (#2894)
Browse files Browse the repository at this point in the history
* add rssi and snr to json output

* explicitly cast to int and float
  • Loading branch information
tavdog authored Oct 17, 2023
1 parent e6b20bf commit 092e6f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mqtt/MQTT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,10 @@ std::string MQTT::meshPacketToJson(meshtastic_MeshPacket *mp)
jsonObj["channel"] = new JSONValue((uint)mp->channel);
jsonObj["type"] = new JSONValue(msgType.c_str());
jsonObj["sender"] = new JSONValue(owner.id);
if (mp->rx_rssi != 0)
jsonObj["rssi"] = new JSONValue((int)mp->rx_rssi);
if (mp->rx_snr != 0)
jsonObj["snr"] = new JSONValue((float)mp->rx_snr);

// serialize and write it to the stream
JSONValue *value = new JSONValue(jsonObj);
Expand Down

0 comments on commit 092e6f2

Please sign in to comment.