Skip to content

Commit

Permalink
move getCurrentMa() to new CurrentSensor class
Browse files Browse the repository at this point in the history
  • Loading branch information
nebman authored and fifieldt committed Nov 7, 2024
1 parent 06ebcf0 commit e54d259
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/modules/Telemetry/Sensor/CurrentSensor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "configuration.h"

#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR

#pragma once

class CurrentSensor
{
public:
virtual int16_t getCurrentMa() = 0;
};


#endif
5 changes: 3 additions & 2 deletions src/modules/Telemetry/Sensor/INA219Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include "../mesh/generated/meshtastic/telemetry.pb.h"
#include "TelemetrySensor.h"
#include "VoltageSensor.h"
#include "CurrentSensor.h"
#include <Adafruit_INA219.h>

class INA219Sensor : public TelemetrySensor, VoltageSensor
class INA219Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
{
private:
Adafruit_INA219 ina219;
Expand All @@ -20,7 +21,7 @@ class INA219Sensor : public TelemetrySensor, VoltageSensor
virtual int32_t runOnce() override;
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
virtual uint16_t getBusVoltageMv() override;
int16_t getCurrentMa();
virtual int16_t getCurrentMa() override;
};

#endif

0 comments on commit e54d259

Please sign in to comment.