Skip to content

Commit

Permalink
fix: maths to calculate current
Browse files Browse the repository at this point in the history
(Yes, I am ashamed of myself)
  • Loading branch information
sarfata committed Sep 10, 2018
1 parent 4c2e15c commit 2610952
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/host/services/CurrentMonitorService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2610952

Please sign in to comment.