mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-09 12:49:40 +00:00
move getCurrentMa() to new CurrentSensor class
This commit is contained in:
parent
06ebcf0ffc
commit
e54d259241
14
src/modules/Telemetry/Sensor/CurrentSensor.h
Normal file
14
src/modules/Telemetry/Sensor/CurrentSensor.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class CurrentSensor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual int16_t getCurrentMa() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -5,9 +5,10 @@
|
|||||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include "VoltageSensor.h"
|
#include "VoltageSensor.h"
|
||||||
|
#include "CurrentSensor.h"
|
||||||
#include <Adafruit_INA219.h>
|
#include <Adafruit_INA219.h>
|
||||||
|
|
||||||
class INA219Sensor : public TelemetrySensor, VoltageSensor
|
class INA219Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Adafruit_INA219 ina219;
|
Adafruit_INA219 ina219;
|
||||||
@ -20,7 +21,7 @@ class INA219Sensor : public TelemetrySensor, VoltageSensor
|
|||||||
virtual int32_t runOnce() override;
|
virtual int32_t runOnce() override;
|
||||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||||
virtual uint16_t getBusVoltageMv() override;
|
virtual uint16_t getBusVoltageMv() override;
|
||||||
int16_t getCurrentMa();
|
virtual int16_t getCurrentMa() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user