mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 14:24:21 +08:00
batt_smbus: reverse reported current
smart batteries report a negative current when being discharged
This commit is contained in:
committed by
Lorenz Meier
parent
8f29a9d83b
commit
d57dd250b9
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user