mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-03 08:00:35 +08:00
battery: separate out publishing from updating
to allow smart battery drivers to use the battery class and filling in additional information in case it makes sense.
This commit is contained in:
@@ -83,7 +83,7 @@ AnalogBattery::updateBatteryStatusADC(hrt_abstime timestamp, float voltage_raw,
|
||||
Battery::setConnected(connected);
|
||||
Battery::updateVoltage(voltage_v);
|
||||
Battery::updateCurrent(current_a);
|
||||
Battery::updateBatteryStatus(timestamp);
|
||||
Battery::updateAndPublishBatteryStatus(timestamp);
|
||||
}
|
||||
|
||||
bool AnalogBattery::is_valid()
|
||||
|
||||
@@ -102,7 +102,7 @@ EscBattery::Run()
|
||||
_battery.setConnected(true);
|
||||
_battery.updateVoltage(average_voltage_v);
|
||||
_battery.updateCurrent(total_current_a);
|
||||
_battery.updateBatteryStatus(esc_status.timestamp);
|
||||
_battery.updateAndPublishBatteryStatus(esc_status.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ void BatterySimulator::Run()
|
||||
_battery.setConnected(true);
|
||||
_battery.updateVoltage(vbatt);
|
||||
_battery.updateCurrent(ibatt);
|
||||
_battery.updateBatteryStatus(now_us);
|
||||
_battery.updateAndPublishBatteryStatus(now_us);
|
||||
|
||||
perf_end(_loop_perf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user