2023-08-14 19:00:51 -05:00
|
|
|
#pragma once
|
|
|
|
|
#include "SinglePortModule.h"
|
|
|
|
|
|
|
|
|
|
class DetectionSensorModule : public SinglePortModule, private concurrency::OSThread
|
|
|
|
|
{
|
|
|
|
|
public:
|
2024-11-04 12:16:25 -06:00
|
|
|
DetectionSensorModule() : SinglePortModule("detection", meshtastic_PortNum_DETECTION_SENSOR_APP), OSThread("DetectionSensor")
|
2023-08-14 19:00:51 -05:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual int32_t runOnce() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool firstTime = true;
|
|
|
|
|
uint32_t lastSentToMesh = 0;
|
2024-09-19 21:59:42 +02:00
|
|
|
bool wasDetected = false;
|
2023-08-14 19:00:51 -05:00
|
|
|
void sendDetectionMessage();
|
2024-09-19 21:59:42 +02:00
|
|
|
void sendCurrentStateMessage(bool state);
|
2023-08-14 19:00:51 -05:00
|
|
|
bool hasDetectionEvent();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern DetectionSensorModule *detectionSensorModule;
|