batt_smbus: reverse reported current

smart batteries report a negative current when being discharged
This commit is contained in:
Randy Mackay
2015-02-19 23:28:04 +09:00
committed by Lorenz Meier
parent 8f29a9d83b
commit d57dd250b9
+1 -2
View File
@@ -368,8 +368,7 @@ BATT_SMBUS::cycle()
uint8_t buff[4];
if (read_block(BATT_SMBUS_CURRENT, buff, 4, false) == 4) {
new_report.current_a = (float)((int32_t)((uint32_t)buff[3] << 24 | (uint32_t)buff[2] << 16 | (uint32_t)buff[1] << 8 |
(uint32_t)buff[0])) / 1000.0f;
new_report.current_a = -(float)((int32_t)((uint32_t)buff[3] << 24 | (uint32_t)buff[2] << 16 | (uint32_t)buff[1] << 8 | (uint32_t)buff[0])) / 1000.0f;
}
// publish to orb