firmware/src/modules/esp32/RangeTestModule.h

59 lines
1.4 KiB
C
Raw Normal View History

#pragma once
#include "SinglePortPlugin.h"
#include "concurrency/OSThread.h"
#include "configuration.h"
#include <Arduino.h>
#include <functional>
2022-02-27 09:49:24 +00:00
class RangeTestModule : private concurrency::OSThread
{
bool firstTime = 1;
public:
2022-02-27 09:49:24 +00:00
RangeTestModule();
protected:
2022-01-24 17:24:40 +00:00
virtual int32_t runOnce() override;
};
2022-02-27 09:49:24 +00:00
extern RangeTestModule *rangeTestModule;
/*
2022-02-27 09:49:24 +00:00
* Radio interface for RangeTestModule
*
*/
2022-02-27 09:49:24 +00:00
class RangeTestModuleRadio : public SinglePortPlugin
{
2022-01-24 07:00:14 +00:00
uint32_t lastRxID = 0;
public:
2022-02-27 09:49:24 +00:00
RangeTestModuleRadio() : SinglePortPlugin("RangeTestModuleRadio", PortNum_TEXT_MESSAGE_APP) {}
/**
* Send our payload into the mesh
*/
void sendPayload(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
/**
* Append range test data to the file on the Filesystem
*/
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);
protected:
2022-01-24 17:24:40 +00:00
virtual MeshPacket *allocReply() override;
/** Called to handle a particular incoming message
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
*/
2022-01-24 17:24:40 +00:00
virtual ProcessMessage handleReceived(const MeshPacket &mp) override;
};
2022-02-27 09:49:24 +00:00
extern RangeTestModuleRadio *rangeTestModuleRadio;