mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-01 19:46:42 +00:00
partial work
This commit is contained in:
parent
e8c6fccd63
commit
c00173dbd2
@ -5,11 +5,16 @@
|
|||||||
#include "Router.h"
|
#include "Router.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
//#include <iostream>
|
||||||
|
//#include <sstream>
|
||||||
|
//#include <string>
|
||||||
|
|
||||||
|
//#undef str
|
||||||
|
|
||||||
|
|
||||||
#define RANGETESTPLUGIN_ENABLED 1
|
#define RANGETESTPLUGIN_ENABLED 1
|
||||||
#define RANGETESTPLUGIN_SENDER 0
|
#define RANGETESTPLUGIN_SENDER 20000
|
||||||
|
|
||||||
RangeTestPlugin *rangeTestPlugin;
|
RangeTestPlugin *rangeTestPlugin;
|
||||||
RangeTestPluginRadio *rangeTestPluginRadio;
|
RangeTestPluginRadio *rangeTestPluginRadio;
|
||||||
@ -34,10 +39,21 @@ int32_t RangeTestPlugin::runOnce()
|
|||||||
firstTime = 0;
|
firstTime = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// If sender
|
||||||
|
if (RANGETESTPLUGIN_SENDER) {
|
||||||
|
|
||||||
|
return (RANGETESTPLUGIN_SENDER);
|
||||||
|
|
||||||
|
// Otherwise, we're a receiver.
|
||||||
|
} else {
|
||||||
|
|
||||||
|
rangeTestPluginRadio->sendPayload();
|
||||||
|
return (500);
|
||||||
|
}
|
||||||
// TBD
|
// TBD
|
||||||
}
|
}
|
||||||
|
|
||||||
return (10);
|
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("Range Test Plugin - Disabled\n");
|
DEBUG_MSG("Range Test Plugin - Disabled\n");
|
||||||
|
|
||||||
@ -61,6 +77,15 @@ void RangeTestPluginRadio::sendPayload(NodeNum dest, bool wantReplies)
|
|||||||
p->to = dest;
|
p->to = dest;
|
||||||
p->decoded.want_response = wantReplies;
|
p->decoded.want_response = wantReplies;
|
||||||
|
|
||||||
|
p->want_ack = true;
|
||||||
|
|
||||||
|
uint16_t packetSequence = 123456;
|
||||||
|
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);
|
||||||
|
|
||||||
service.sendToMesh(p);
|
service.sendToMesh(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,9 +113,6 @@ bool RangeTestPluginRadio::handleReceived(const MeshPacket &mp)
|
|||||||
mp.hop_limit;
|
mp.hop_limit;
|
||||||
mp.decoded.position.latitude_i;
|
mp.decoded.position.latitude_i;
|
||||||
mp.decoded.position.longitude_i;
|
mp.decoded.position.longitude_i;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user