diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 7bfc203e5c..12cdfd93c7 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -198,15 +198,15 @@ static uint64_t _inair_last_time = 0; static float eph_threshold = 5.0f; static float epv_threshold = 10.0f; -static struct vehicle_status_s status; -static struct battery_status_s battery; -static struct actuator_armed_s armed; -static struct safety_s safety; -static struct vehicle_control_mode_s control_mode; -static struct offboard_control_mode_s offboard_control_mode; -static struct home_position_s _home; +static struct vehicle_status_s status = {}; +static struct battery_status_s battery = {}; +static struct actuator_armed_s armed = {}; +static struct safety_s safety = {}; +static struct vehicle_control_mode_s control_mode = {}; +static struct offboard_control_mode_s offboard_control_mode = {}; +static struct home_position_s _home = {}; static int32_t _flight_mode_slots[manual_control_setpoint_s::MODE_SLOT_MAX]; -static struct commander_state_s internal_state; +static struct commander_state_s internal_state = {}; static unsigned _last_mission_instance = 0; static manual_control_setpoint_s _last_sp_man = {}; diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index b41ed90db6..375f0a1ec3 100644 --- a/src/modules/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -1657,11 +1657,12 @@ Sensors::adc_poll(struct sensor_combined_s &raw) if (ADC_BATTERY_VOLTAGE_CHANNEL == buf_adc[i].am_channel) { /* Voltage in volts */ bat_voltage_v = (buf_adc[i].am_data * _parameters.battery_voltage_scaling); - updated_battery = true; + if (bat_voltage_v > 0.5f) { + updated_battery = true; + } } else if (ADC_BATTERY_CURRENT_CHANNEL == buf_adc[i].am_channel) { bat_current_a = (buf_adc[i].am_data * _parameters.battery_current_scaling); - updated_battery = true; #ifdef ADC_AIRSPEED_VOLTAGE_CHANNEL