mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 16:10:12 +08:00
multiply current measurement by -1 to force positive value for current being sunk
This commit is contained in:
@@ -185,7 +185,7 @@ void BATT_SMBUS::cycle()
|
|||||||
|
|
||||||
// Read current.
|
// Read current.
|
||||||
if (read_word(BATT_SMBUS_CURRENT, &tmp) == PX4_OK) {
|
if (read_word(BATT_SMBUS_CURRENT, &tmp) == PX4_OK) {
|
||||||
new_report.current_a = ((float)(*(int16_t *)&tmp)) / 1000.0f;
|
new_report.current_a = (-1.0f * ((float)(*(int16_t *)&tmp)) / 1000.0f);
|
||||||
new_report.current_filtered_a = new_report.current_a;
|
new_report.current_filtered_a = new_report.current_a;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -194,7 +194,7 @@ void BATT_SMBUS::cycle()
|
|||||||
|
|
||||||
// Read average current.
|
// Read average current.
|
||||||
if (read_word(BATT_SMBUS_AVERAGE_CURRENT, &tmp) == PX4_OK) {
|
if (read_word(BATT_SMBUS_AVERAGE_CURRENT, &tmp) == PX4_OK) {
|
||||||
new_report.average_current_a = ((float)(*(int16_t *)&tmp)) / 1000.0f;
|
new_report.average_current_a = (-1.0f * ((float)(*(int16_t *)&tmp)) / 1000.0f);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
success = false;
|
success = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user