mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 08:28:52 +08:00
battery: pass connected flag in by setter
This commit is contained in:
@@ -85,11 +85,11 @@ INA228::INA228(const I2CSPIDriverConfig &config, int battery_index) :
|
||||
_power_lsb = 3.2f * _current_lsb;
|
||||
|
||||
// We need to publish immediately, to guarantee that the first instance of the driver publishes to uORB instance 0
|
||||
_battery.setConnected(false);
|
||||
_battery.updateBatteryStatus(
|
||||
hrt_absolute_time(),
|
||||
0.0,
|
||||
0.0,
|
||||
false
|
||||
0.0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -309,11 +309,11 @@ INA228::collect()
|
||||
_bus_voltage = _power = _current = _shunt = 0;
|
||||
}
|
||||
|
||||
_battery.setConnected(success);
|
||||
_battery.updateBatteryStatus(
|
||||
hrt_absolute_time(),
|
||||
(float) _bus_voltage * INA228_VSCALE,
|
||||
(float) _current * _current_lsb,
|
||||
success
|
||||
(float) _current * _current_lsb
|
||||
);
|
||||
|
||||
perf_end(_sample_perf);
|
||||
@@ -377,11 +377,11 @@ INA228::RunImpl()
|
||||
ScheduleDelayed(INA228_CONVERSION_INTERVAL);
|
||||
|
||||
} else {
|
||||
_battery.setConnected(false);
|
||||
_battery.updateBatteryStatus(
|
||||
hrt_absolute_time(),
|
||||
0.0f,
|
||||
0.0f,
|
||||
false
|
||||
0.0f
|
||||
);
|
||||
|
||||
if (init() != PX4_OK) {
|
||||
|
||||
Reference in New Issue
Block a user