Created new AnalogBattery class

This commit is contained in:
Timothy Scott
2019-07-25 16:46:32 +02:00
committed by Julian Oes
parent bff1df7080
commit d7bb5d46bb
20 changed files with 687 additions and 253 deletions
@@ -220,7 +220,7 @@ int DfBebopBusWrapper::_publish(struct bebop_state_data &data)
// TODO Check if this is the right way for the Bebop
// We don't have current measurements
_battery.updateBatteryStatus(data.battery_voltage_v, 0.0, timestamp, true, 0, _last_throttle, _armed);
_battery.updateBatteryStatus(timestamp, data.battery_voltage_v, 0.0, true, true, 0, _last_throttle, _armed, true);
if (_esc_topic == nullptr) {
_esc_topic = orb_advertise(ORB_ID(esc_status), &esc_status);
@@ -131,16 +131,17 @@ int DfLtc2946Wrapper::stop()
int DfLtc2946Wrapper::_publish(const struct ltc2946_sensor_data &data)
{
hrt_abstime t = hrt_absolute_time();
bool connected = data.battery_voltage_V > BOARD_ADC_OPEN_CIRCUIT_V;
actuator_controls_s ctrl;
orb_copy(ORB_ID(actuator_controls_0), _actuator_ctrl_0_sub, &ctrl);
vehicle_control_mode_s vcontrol_mode;
orb_copy(ORB_ID(vehicle_control_mode), _vcontrol_mode_sub, &vcontrol_mode);
_battery.updateBatteryStatus(data.battery_voltage_V, data.battery_current_A, t,
true, 1,
_battery.updateBatteryStatus(t, data.battery_voltage_V, data.battery_current_A,
connected, true, 1,
ctrl.control[actuator_controls_s::INDEX_THROTTLE],
vcontrol_mode.flag_armed);
vcontrol_mode.flag_armed, true);
return 0;
}