mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-06 23:00:35 +08:00
Refactored to work with new battery_status module
This commit is contained in:
committed by
Julian Oes
parent
d7bb5d46bb
commit
993fa5bd37
@@ -101,7 +101,7 @@ private:
|
||||
orb_advert_t _battery_topic;
|
||||
orb_advert_t _esc_topic;
|
||||
|
||||
Battery1 _battery;
|
||||
Battery _battery;
|
||||
bool _armed;
|
||||
float _last_throttle;
|
||||
|
||||
@@ -203,6 +203,10 @@ int DfBebopBusWrapper::_publish(struct bebop_state_data &data)
|
||||
|
||||
const hrt_abstime timestamp = hrt_absolute_time();
|
||||
|
||||
// TODO Check if this is the right way for the Bebop
|
||||
// We don't have current measurements
|
||||
_battery.updateBatteryStatus(timestamp, data.battery_voltage_v, 0.0, true, true, 0, _last_throttle, _armed, false);
|
||||
|
||||
esc_status_s esc_status = {};
|
||||
|
||||
uint16_t esc_speed_setpoint_rpm[4] = {};
|
||||
@@ -218,9 +222,7 @@ int DfBebopBusWrapper::_publish(struct bebop_state_data &data)
|
||||
// TODO: when is this ever blocked?
|
||||
if (!(m_pub_blocked)) {
|
||||
|
||||
// TODO Check if this is the right way for the Bebop
|
||||
// We don't have current measurements
|
||||
_battery.updateBatteryStatus(timestamp, data.battery_voltage_v, 0.0, true, true, 0, _last_throttle, _armed, true);
|
||||
_battery.publish();
|
||||
|
||||
if (_esc_topic == nullptr) {
|
||||
_esc_topic = orb_advertise(ORB_ID(esc_status), &esc_status);
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
private:
|
||||
int _publish(const struct ltc2946_sensor_data &data);
|
||||
|
||||
Battery1 _battery{};
|
||||
Battery _battery{};
|
||||
|
||||
int _actuator_ctrl_0_sub{-1};
|
||||
int _vcontrol_mode_sub{-1};
|
||||
|
||||
Reference in New Issue
Block a user