mirror of
https://github.com/meshtastic/firmware.git
synced 2026-02-06 09:01:57 +00:00
Added (excluded) Dropzone Module for more comprehensive module example (#4098)
* DropzoneModule hello world * Buttoning things up * Exclude by default * Upstream refs * Cleanup * Add modules folder to path * Case and path matters * Exclude from header * Guard
This commit is contained in:
37
src/modules/DropzoneModule.h
Normal file
37
src/modules/DropzoneModule.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#if !MESHTASTIC_EXCLUDE_DROPZONE
|
||||
#include "SinglePortModule.h"
|
||||
#include "modules/Telemetry/Sensor/DFRobotLarkSensor.h"
|
||||
|
||||
/**
|
||||
* An example module that replies to a message with the current conditions
|
||||
* and status at the dropzone when it receives a text message mentioning it's name followed by "conditions"
|
||||
*/
|
||||
class DropzoneModule : public SinglePortModule, private concurrency::OSThread
|
||||
{
|
||||
DFRobotLarkSensor sensor;
|
||||
|
||||
public:
|
||||
/** Constructor
|
||||
* name is for debugging output
|
||||
*/
|
||||
DropzoneModule() : SinglePortModule("dropzone", meshtastic_PortNum_TEXT_MESSAGE_APP), concurrency::OSThread("DropzoneModule")
|
||||
{
|
||||
// Set up the analog pin for reading the dropzone status
|
||||
pinMode(PIN_A1, INPUT);
|
||||
}
|
||||
|
||||
virtual int32_t runOnce() override;
|
||||
|
||||
protected:
|
||||
/** Called to handle a particular incoming message
|
||||
*/
|
||||
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override;
|
||||
|
||||
private:
|
||||
meshtastic_MeshPacket *sendConditions();
|
||||
uint32_t startSendConditions = 0;
|
||||
};
|
||||
|
||||
extern DropzoneModule *dropzoneModule;
|
||||
#endif
|
||||
Reference in New Issue
Block a user