2021-01-31 17:12:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "SinglePortPlugin.h"
|
|
|
|
#include "concurrency/OSThread.h"
|
|
|
|
#include "configuration.h"
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
class RangeTestPlugin : private concurrency::OSThread
|
|
|
|
{
|
|
|
|
bool firstTime = 1;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RangeTestPlugin();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual int32_t runOnce();
|
|
|
|
};
|
|
|
|
|
|
|
|
extern RangeTestPlugin *rangeTestPlugin;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Radio interface for RangeTestPlugin
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class RangeTestPluginRadio : public SinglePortPlugin
|
|
|
|
{
|
2022-01-24 07:00:14 +00:00
|
|
|
uint32_t lastRxID = 0;
|
2021-01-31 17:12:36 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RangeTestPluginRadio() : SinglePortPlugin("RangeTestPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send our payload into the mesh
|
|
|
|
*/
|
|
|
|
void sendPayload(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
|
|
|
|
2021-02-14 06:21:01 +00:00
|
|
|
/**
|
|
|
|
* Append range test data to the file on the spiffs
|
|
|
|
*/
|
|
|
|
bool appendFile(const MeshPacket &mp);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Kevin's magical calculation of two points to meters.
|
|
|
|
*/
|
|
|
|
float latLongToMeter(double lat_a, double lng_a, double lat_b, double lng_b);
|
|
|
|
|
2021-01-31 17:12:36 +00:00
|
|
|
protected:
|
|
|
|
virtual MeshPacket *allocReply();
|
|
|
|
|
|
|
|
/** Called to handle a particular incoming message
|
|
|
|
|
2021-09-23 01:42:09 +00:00
|
|
|
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
|
2021-01-31 17:12:36 +00:00
|
|
|
*/
|
2021-09-23 01:42:09 +00:00
|
|
|
virtual ProcessMessage handleReceived(const MeshPacket &mp);
|
2021-01-31 17:12:36 +00:00
|
|
|
};
|
|
|
|
|
2021-02-17 02:36:58 +00:00
|
|
|
extern RangeTestPluginRadio *rangeTestPluginRadio;
|