sensors coverity fix 143426

This commit is contained in:
Daniel Agar 2017-04-27 21:01:13 -04:00 committed by Nuno Marques
parent 086ddf5078
commit d3ed773838
1 changed files with 17 additions and 37 deletions

View File

@ -157,39 +157,39 @@ public:
private:
DevHandle _h_adc; /**< ADC driver handle */
hrt_abstime _last_adc; /**< last time we took input from the ADC */
hrt_abstime _last_adc{0}; /**< last time we took input from the ADC */
const bool _hil_enabled; /**< if true, HIL is active */
bool _armed; /**< arming status of the vehicle */
bool _armed{false}; /**< arming status of the vehicle */
int _actuator_ctrl_0_sub; /**< attitude controls sub */
int _diff_pres_sub; /**< raw differential pressure subscription */
int _vcontrol_mode_sub; /**< vehicle control mode subscription */
int _params_sub; /**< notification of parameter updates */
int _actuator_ctrl_0_sub{-1}; /**< attitude controls sub */
int _diff_pres_sub{-1}; /**< raw differential pressure subscription */
int _vcontrol_mode_sub{-1}; /**< vehicle control mode subscription */
int _params_sub{-1}; /**< notification of parameter updates */
orb_advert_t _sensor_pub; /**< combined sensor data topic */
orb_advert_t _battery_pub[BOARD_NUMBER_BRICKS] = {nullptr}; /**< battery status */
orb_advert_t _sensor_pub{nullptr}; /**< combined sensor data topic */
orb_advert_t _battery_pub[BOARD_NUMBER_BRICKS] {}; /**< battery status */
#if BOARD_NUMBER_BRICKS > 1
int _battery_pub_intance0ndx = 0; /**< track the index of instance 0 */
int _battery_pub_intance0ndx {0}; /**< track the index of instance 0 */
#endif
orb_advert_t _airspeed_pub; /**< airspeed */
orb_advert_t _diff_pres_pub; /**< differential_pressure */
orb_advert_t _sensor_preflight; /**< sensor preflight topic */
orb_advert_t _airspeed_pub{nullptr}; /**< airspeed */
orb_advert_t _diff_pres_pub{nullptr}; /**< differential_pressure */
orb_advert_t _sensor_preflight{nullptr}; /**< sensor preflight topic */
perf_counter_t _loop_perf; /**< loop performance counter */
DataValidator _airspeed_validator; /**< data validator to monitor airspeed */
struct battery_status_s _battery_status[BOARD_NUMBER_BRICKS]; /**< battery status */
struct differential_pressure_s _diff_pres;
struct airspeed_s _airspeed;
battery_status_s _battery_status[BOARD_NUMBER_BRICKS] {}; /**< battery status */
differential_pressure_s _diff_pres{};
airspeed_s _airspeed{};
Battery _battery[BOARD_NUMBER_BRICKS]; /**< Helper lib to publish battery_status topic. */
Parameters _parameters; /**< local copies of interesting parameters */
ParameterHandles _parameter_handles; /**< handles for interesting parameters */
Parameters _parameters{}; /**< local copies of interesting parameters */
ParameterHandles _parameter_handles{}; /**< handles for interesting parameters */
RCUpdate _rc_update;
VotedSensorsUpdate _voted_sensors_update;
@ -233,31 +233,11 @@ private:
};
Sensors::Sensors(bool hil_enabled) :
_last_adc(0),
_hil_enabled(hil_enabled),
_armed(false),
_actuator_ctrl_0_sub(-1),
_diff_pres_sub(-1),
_vcontrol_mode_sub(-1),
_params_sub(-1),
/* publications */
_sensor_pub(nullptr),
_airspeed_pub(nullptr),
_diff_pres_pub(nullptr),
_sensor_preflight(nullptr),
/* performance counters */
_loop_perf(perf_alloc(PC_ELAPSED, "sensors")),
_rc_update(_parameters),
_voted_sensors_update(_parameters, hil_enabled)
{
memset(&_diff_pres, 0, sizeof(_diff_pres));
memset(&_parameters, 0, sizeof(_parameters));
initialize_parameter_handles(_parameter_handles);
_airspeed_validator.set_timeout(300000);