From 26109528517673f8f62df66981a947f62220661a Mon Sep 17 00:00:00 2001 From: Thomas Sarlandie Date: Mon, 10 Sep 2018 15:57:20 +0200 Subject: [PATCH] fix: maths to calculate current (Yes, I am ashamed of myself) --- src/host/services/CurrentMonitorService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/host/services/CurrentMonitorService.cpp b/src/host/services/CurrentMonitorService.cpp index 1f9f40cd..a48b5645 100644 --- a/src/host/services/CurrentMonitorService.cpp +++ b/src/host/services/CurrentMonitorService.cpp @@ -46,7 +46,7 @@ void CurrentMonitorService::loop() { sk.setSource(SKSource::sourceForKBoxSensor(SKSourceInputKBoxCurrentMonitor)); sk.setElectricalBatteriesVoltage("shunt", busVoltage); - double current = shuntVoltageMV * 1e-3 * _config.shuntResistance; + double current = (shuntVoltageMV * 1e-3) / _config.shuntResistance; if (_config.shuntResistance > 0) { // TODO: It would be best to properly configure the INA219 properly and let it do the maths. sk.setElectricalBatteriesCurrent("shunt", current);