2023-08-15 00:00:51 +00:00
|
|
|
#pragma once
|
|
|
|
#include "SinglePortModule.h"
|
|
|
|
|
|
|
|
class DetectionSensorModule : public SinglePortModule, private concurrency::OSThread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DetectionSensorModule()
|
2023-08-19 12:46:34 +00:00
|
|
|
: SinglePortModule("detection", meshtastic_PortNum_DETECTION_SENSOR_APP), OSThread("DetectionSensorModule")
|
2023-08-15 00:00:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual int32_t runOnce() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool firstTime = true;
|
|
|
|
uint32_t lastSentToMesh = 0;
|
|
|
|
void sendDetectionMessage();
|
|
|
|
void sendCurrentStateMessage();
|
|
|
|
bool hasDetectionEvent();
|
|
|
|
};
|
|
|
|
|
|
|
|
extern DetectionSensorModule *detectionSensorModule;
|