Skip to content

Commit

Permalink
Calibrated resistance calc, added operation to payload
Browse files Browse the repository at this point in the history
  • Loading branch information
graham22 committed Mar 19, 2021
1 parent 7c6ab2d commit 14d248f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion code/ESP32/BatteryTester/src/Tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ namespace BatteryTester
doc[Elements[Id::capacity]] = _capacity;
doc[Elements[Id::internalResistance]] = _internalResistanceSummation;
}
doc[Subtopics[Subtopic::operation]] = Operations[_operation];
_iot.publish(_batteryPosition, Subtopics[Subtopic::outcome], &doc, true);
}

Expand Down Expand Up @@ -354,7 +355,7 @@ namespace BatteryTester
Load_Off();
_pBattery->enabled = true;
_internalResistance = (voc - vLoad);
_internalResistance *= 1000;
_internalResistance *= 600; // ohm to milliohm * offset factor of 0.6
if (iMax <= 0)
{
logw("Battery(%d): InternalResistance failed!!! voc %d, vLoad %d, iMax %d", _batteryPosition, voc, vLoad, iMax);
Expand Down
7 changes: 5 additions & 2 deletions code/Python/WebApp/app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@
eventSource.addEventListener("outcome", function(e) {
data = JSON.parse(e.data)
if ('capacity' in data) {
document.querySelector("#capacity"+data.index).innerText = data.capacity + 'mAh';
document.querySelector("#capacity"+data.index).innerText = data.capacity == 0 ? "-" : data.capacity + ' mAh';
}
if ('internalResistance' in data) {
document.querySelector("#resistance"+data.index).innerText = data.internalResistance + ' mΩ';
document.querySelector("#resistance"+data.index).innerText = data.internalResistance == 0 ? "-" : data.internalResistance + ' mΩ';
}
if ('operation' in data) {
document.querySelector("#operation").innerText = data.operation;
}
}, true)

Expand Down

0 comments on commit 14d248f

Please sign in to comment.