mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 17:52:35 +00:00
INA3221 sensor: use for bus voltage & environment metrics (#4215)
* use INA3221 for bus voltage; fixes for telemetry variants - add to sensors available for environment telemetry (to report voltage/current) - add vars to define channels to use for battery voltage (for getBusVoltage) and environment metrics (default to CH1 for both) - write to the correct fields on the measurement struct depending on the measurement variant, and DRY up the sensor measurement collection code a bit - this might be suitable for a common implementation for the INA* sensors in a future PR... * formatting * derp --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -449,6 +449,11 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
if (!ina260Sensor.isInitialized())
|
||||
return ina260Sensor.runOnce() > 0;
|
||||
return ina260Sensor.isRunning();
|
||||
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA3221].first ==
|
||||
config.power.device_battery_ina_address) {
|
||||
if (!ina3221Sensor.isInitialized())
|
||||
return ina3221Sensor.runOnce() > 0;
|
||||
return ina3221Sensor.isRunning();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user