mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-30 22:50:57 +00:00
mv plugins/ to modules/
This commit is contained in:
35
src/modules/Telemetry/Telemetry.h
Normal file
35
src/modules/Telemetry/Telemetry.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "../mesh/generated/telemetry.pb.h"
|
||||
#include "ProtobufPlugin.h"
|
||||
#include <OLEDDisplay.h>
|
||||
#include <OLEDDisplayUi.h>
|
||||
|
||||
class TelemetryPlugin : private concurrency::OSThread, public ProtobufPlugin<Telemetry>
|
||||
{
|
||||
public:
|
||||
TelemetryPlugin()
|
||||
: concurrency::OSThread("TelemetryPlugin"),
|
||||
ProtobufPlugin("Telemetry", PortNum_TELEMETRY_APP, &Telemetry_msg)
|
||||
{
|
||||
lastMeasurementPacket = nullptr;
|
||||
}
|
||||
virtual bool wantUIFrame() override;
|
||||
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
|
||||
|
||||
protected:
|
||||
/** Called to handle a particular incoming message
|
||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||
*/
|
||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, Telemetry *p) override;
|
||||
virtual int32_t runOnce() override;
|
||||
/**
|
||||
* Send our Telemetry into the mesh
|
||||
*/
|
||||
bool sendOurTelemetry(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
||||
|
||||
private:
|
||||
float CelsiusToFarenheit(float c);
|
||||
bool firstTime = 1;
|
||||
const MeshPacket *lastMeasurementPacket;
|
||||
uint32_t sensor_read_error_count = 0;
|
||||
};
|
||||
Reference in New Issue
Block a user