Merge pull request #73 from meshtastic/master

pulling 1.2 into my fork
This commit is contained in:
Jm Casler
2021-03-02 20:46:21 -08:00
committed by GitHub
77 changed files with 1814 additions and 1087 deletions

View File

@@ -149,8 +149,10 @@ String GetSenderName(const MeshPacket &mp) {
return sender;
}
bool EnvironmentalMeasurementPluginRadio::handleReceivedProtobuf(const MeshPacket &mp, const EnvironmentalMeasurement &p)
bool EnvironmentalMeasurementPluginRadio::handleReceivedProtobuf(const MeshPacket &mp, const EnvironmentalMeasurement *pptr)
{
const EnvironmentalMeasurement &p = *pptr;
if (!(radioConfig.preferences.environmental_measurement_plugin_measurement_enabled || radioConfig.preferences.environmental_measurement_plugin_screen_enabled)){
// If this plugin is not enabled in any capacity, don't handle the packet, and allow other plugins to consume
return false;

View File

@@ -47,7 +47,7 @@ class EnvironmentalMeasurementPluginRadio : public ProtobufPlugin<EnvironmentalM
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
*/
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const EnvironmentalMeasurement &p);
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const EnvironmentalMeasurement *p);
virtual bool wantUIFrame();

View File

@@ -114,8 +114,8 @@ void RangeTestPluginRadio::sendPayload(NodeNum dest, bool wantReplies)
static char heartbeatString[20];
snprintf(heartbeatString, sizeof(heartbeatString), "seq %d", packetSequence);
p->decoded.data.payload.size = strlen(heartbeatString); // You must specify how many bytes are in the reply
memcpy(p->decoded.data.payload.bytes, heartbeatString, p->decoded.data.payload.size);
p->decoded.payload.size = strlen(heartbeatString); // You must specify how many bytes are in the reply
memcpy(p->decoded.payload.bytes, heartbeatString, p->decoded.payload.size);
service.sendToMesh(p);
@@ -129,7 +129,7 @@ bool RangeTestPluginRadio::handleReceived(const MeshPacket &mp)
if (radioConfig.preferences.range_test_plugin_enabled) {
auto &p = mp.decoded.data;
auto &p = mp.decoded;
// DEBUG_MSG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n",
// nodeDB.getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
@@ -207,7 +207,7 @@ float RangeTestPluginRadio::latLongToMeter(double lat_a, double lng_a, double la
bool RangeTestPluginRadio::appendFile(const MeshPacket &mp)
{
auto &p = mp.decoded.data;
auto &p = mp.decoded;
NodeInfo *n = nodeDB.getNode(mp.from);
/*

View File

@@ -190,7 +190,7 @@ void StoreForwardPlugin::historyAdd(const MeshPacket *mp)
auto &p = mp;
static uint8_t bytes[MAX_RHPACKETLEN];
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), SubPacket_fields, &p->decoded);
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), Data_fields, &p->decoded);
assert(numbytes <= MAX_RHPACKETLEN);
DEBUG_MSG("MP numbytes %u\n", numbytes);
@@ -271,37 +271,37 @@ bool StoreForwardPluginRadio::handleReceived(const MeshPacket &mp)
uint32_t sawTime = storeForwardPlugin->sawNode(mp.from & 0xffffffff);
DEBUG_MSG("We last saw this node (%u), %u sec ago\n", mp.from & 0xffffffff, (millis() - sawTime) / 1000);
if (mp.decoded.data.portnum == PortNum_UNKNOWN_APP) {
if (mp.decoded.portnum == PortNum_UNKNOWN_APP) {
DEBUG_MSG("Packet came from - PortNum_UNKNOWN_APP\n");
} else if (mp.decoded.data.portnum == PortNum_TEXT_MESSAGE_APP) {
} else if (mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) {
DEBUG_MSG("Packet came from - PortNum_TEXT_MESSAGE_APP\n");
storeForwardPlugin->historyAdd(&mp);
} else if (mp.decoded.data.portnum == PortNum_REMOTE_HARDWARE_APP) {
} else if (mp.decoded.portnum == PortNum_REMOTE_HARDWARE_APP) {
DEBUG_MSG("Packet came from - PortNum_REMOTE_HARDWARE_APP\n");
} else if (mp.decoded.data.portnum == PortNum_POSITION_APP) {
} else if (mp.decoded.portnum == PortNum_POSITION_APP) {
DEBUG_MSG("Packet came from - PortNum_POSITION_APP\n");
} else if (mp.decoded.data.portnum == PortNum_NODEINFO_APP) {
} else if (mp.decoded.portnum == PortNum_NODEINFO_APP) {
DEBUG_MSG("Packet came from - PortNum_NODEINFO_APP\n");
} else if (mp.decoded.data.portnum == PortNum_REPLY_APP) {
} else if (mp.decoded.portnum == PortNum_REPLY_APP) {
DEBUG_MSG("Packet came from - PortNum_REPLY_APP\n");
} else if (mp.decoded.data.portnum == PortNum_IP_TUNNEL_APP) {
} else if (mp.decoded.portnum == PortNum_IP_TUNNEL_APP) {
DEBUG_MSG("Packet came from - PortNum_IP_TUNNEL_APP\n");
} else if (mp.decoded.data.portnum == PortNum_SERIAL_APP) {
} else if (mp.decoded.portnum == PortNum_SERIAL_APP) {
DEBUG_MSG("Packet came from - PortNum_SERIAL_APP\n");
} else if (mp.decoded.data.portnum == PortNum_STORE_FORWARD_APP) {
} else if (mp.decoded.portnum == PortNum_STORE_FORWARD_APP) {
DEBUG_MSG("Packet came from - PortNum_STORE_FORWARD_APP\n");
} else if (mp.decoded.data.portnum == PortNum_RANGE_TEST_APP) {
} else if (mp.decoded.portnum == PortNum_RANGE_TEST_APP) {
DEBUG_MSG("Packet came from - PortNum_RANGE_TEST_APP\n");
} else if (mp.decoded.data.portnum == PortNum_PRIVATE_APP) {
} else if (mp.decoded.portnum == PortNum_PRIVATE_APP) {
DEBUG_MSG("Packet came from - PortNum_PRIVATE_APP\n");
} else if (mp.decoded.data.portnum == PortNum_RANGE_TEST_APP) {
} else if (mp.decoded.portnum == PortNum_RANGE_TEST_APP) {
DEBUG_MSG("Packet came from - PortNum_RANGE_TEST_APP\n");
} else if (mp.decoded.data.portnum == PortNum_ATAK_FORWARDER) {
} else if (mp.decoded.portnum == PortNum_ATAK_FORWARDER) {
DEBUG_MSG("Packet came from - PortNum_ATAK_FORWARDER\n");
} else {
DEBUG_MSG("Packet came from an unknown port %u\n", mp.decoded.data.portnum);
DEBUG_MSG("Packet came from an unknown port %u\n", mp.decoded.portnum);
}
if ((millis() - sawTime) > STOREFORWARD_SEND_HISTORY_SHORT) {