mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-23 01:41:10 +00:00
Compare commits
No commits in common. "1ab93e04d5a308ba5d28feac30d77cb4512a0f79" and "e54d259241aaa9ef858e3ebb519118f2571297a6" have entirely different histories.
1ab93e04d5
...
e54d259241
@ -476,9 +476,6 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
int16_t getINACurrent() {
|
int16_t getINACurrent() {
|
||||||
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
|
||||||
return ina219Sensor.getCurrentMa();
|
return ina219Sensor.getCurrentMa();
|
||||||
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA3221].first ==
|
|
||||||
config.power.device_battery_ina_address) {
|
|
||||||
return ina3221Sensor.getCurrentMa();
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -102,9 +102,4 @@ uint16_t INA3221Sensor::getBusVoltageMv()
|
|||||||
return lround(ina3221.getVoltage(BAT_CH) * 1000);
|
return lround(ina3221.getVoltage(BAT_CH) * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t INA3221Sensor::getCurrentMa()
|
|
||||||
{
|
|
||||||
return lround(ina3221.getCurrent(BAT_CH));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -5,10 +5,9 @@
|
|||||||
#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 <INA3221.h>
|
#include <INA3221.h>
|
||||||
|
|
||||||
class INA3221Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
|
class INA3221Sensor : public TelemetrySensor, VoltageSensor
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
INA3221 ina3221 = INA3221(INA3221_ADDR42_SDA);
|
INA3221 ina3221 = INA3221(INA3221_ADDR42_SDA);
|
||||||
@ -36,7 +35,6 @@ class INA3221Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
|
|||||||
int32_t runOnce() override;
|
int32_t runOnce() override;
|
||||||
bool getMetrics(meshtastic_Telemetry *measurement) override;
|
bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||||
virtual uint16_t getBusVoltageMv() override;
|
virtual uint16_t getBusVoltageMv() override;
|
||||||
virtual int16_t getCurrentMa() override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _INA3221Measurement {
|
struct _INA3221Measurement {
|
||||||
|
Loading…
Reference in New Issue
Block a user