Trunk Fixes

This commit is contained in:
Tom Fifield 2024-12-15 10:16:23 +11:00
parent 233b6089f6
commit 0058187bed
4 changed files with 8 additions and 7 deletions

View File

@ -413,7 +413,8 @@ class AnalogBatteryLevel : public HasBatteryLevel
#ifdef EXT_CHRG_DETECT
return digitalRead(EXT_CHRG_DETECT) == ext_chrg_detect_value;
#else
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(DISABLE_INA_CHARGING_DETECTION)
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && \
!defined(DISABLE_INA_CHARGING_DETECTION)
if (hasINA()) {
// get current flow from INA sensor - negative value means power flowing into the battery
// default assuming BATTERY+ <--> INA_VIN+ <--> SHUNT RESISTOR <--> INA_VIN- <--> LOAD
@ -472,7 +473,8 @@ class AnalogBatteryLevel : public HasBatteryLevel
return 0;
}
int16_t getINACurrent() {
int16_t getINACurrent()
{
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
return ina219Sensor.getCurrentMa();
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA3221].first ==
@ -1176,4 +1178,4 @@ bool Power::lipoInit()
{
return false;
}
#endif
#endif

View File

@ -10,5 +10,4 @@ class CurrentSensor
virtual int16_t getCurrentMa() = 0;
};
#endif

View File

@ -3,9 +3,9 @@
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
#include "../mesh/generated/meshtastic/telemetry.pb.h"
#include "CurrentSensor.h"
#include "TelemetrySensor.h"
#include "VoltageSensor.h"
#include "CurrentSensor.h"
#include <Adafruit_INA219.h>
class INA219Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
@ -24,4 +24,4 @@ class INA219Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
virtual int16_t getCurrentMa() override;
};
#endif
#endif

View File

@ -3,9 +3,9 @@
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
#include "../mesh/generated/meshtastic/telemetry.pb.h"
#include "CurrentSensor.h"
#include "TelemetrySensor.h"
#include "VoltageSensor.h"
#include "CurrentSensor.h"
#include <INA3221.h>
class INA3221Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor