mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-08 13:41:28 +00:00
Fix INA226 Sensor Voltage Readings (#5972)
They were off by a factor of 1000 due to the difference between Volts and MilliVolts, as reported by @morcant . Fixes https://github.com/meshtastic/firmware/issues/5969
This commit is contained in:
parent
3a34f8beaf
commit
8cacdb65d6
@ -40,14 +40,14 @@ bool INA226Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
measurement->variant.environment_metrics.has_current = true;
|
||||
|
||||
// mV conversion to V
|
||||
measurement->variant.environment_metrics.voltage = ina226.getBusVoltage() / 1000;
|
||||
measurement->variant.environment_metrics.voltage = ina226.getBusVoltage();
|
||||
measurement->variant.environment_metrics.current = ina226.getCurrent_mA();
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t INA226Sensor::getBusVoltageMv()
|
||||
{
|
||||
return lround(ina226.getBusVoltage());
|
||||
return lround(ina226.getBusVoltage() * 1000);
|
||||
}
|
||||
|
||||
int16_t INA226Sensor::getCurrentMa()
|
||||
|
Loading…
Reference in New Issue
Block a user