mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 13:03:33 +08:00
stop ignoring Wmissing-field-initializers and fix (#9912)
This commit is contained in:
+11
-20
@@ -733,27 +733,18 @@ PX4IO::init()
|
||||
}
|
||||
|
||||
/* send command to arm system via command API */
|
||||
struct vehicle_command_s cmd = {
|
||||
.timestamp = hrt_absolute_time(),
|
||||
.param5 = 0.0f,
|
||||
.param6 = 0.0f,
|
||||
/* request arming */
|
||||
.param1 = 1.0f,
|
||||
.param2 = 0.0f,
|
||||
.param3 = 0.0f,
|
||||
.param4 = 0.0f,
|
||||
.param7 = 0.0f,
|
||||
.command = vehicle_command_s::VEHICLE_CMD_COMPONENT_ARM_DISARM,
|
||||
.target_system = (uint8_t)sys_id,
|
||||
.target_component = (uint8_t)comp_id,
|
||||
.source_system = (uint8_t)sys_id,
|
||||
.source_component = (uint8_t)comp_id,
|
||||
/* ask to confirm command */
|
||||
.confirmation = 1
|
||||
};
|
||||
vehicle_command_s vcmd = {};
|
||||
vcmd.timestamp = hrt_absolute_time();
|
||||
vcmd.param1 = 1.0f; /* request arming */
|
||||
vcmd.command = vehicle_command_s::VEHICLE_CMD_COMPONENT_ARM_DISARM;
|
||||
vcmd.target_system = (uint8_t)sys_id;
|
||||
vcmd.target_component = (uint8_t)comp_id;
|
||||
vcmd.source_system = (uint8_t)sys_id;
|
||||
vcmd.source_component = (uint8_t)comp_id;
|
||||
vcmd.confirmation = true; /* ask to confirm command */
|
||||
|
||||
/* send command once */
|
||||
orb_advert_t pub = orb_advertise_queue(ORB_ID(vehicle_command), &cmd, vehicle_command_s::ORB_QUEUE_LENGTH);
|
||||
orb_advert_t pub = orb_advertise_queue(ORB_ID(vehicle_command), &vcmd, vehicle_command_s::ORB_QUEUE_LENGTH);
|
||||
|
||||
/* spin here until IO's state has propagated into the system */
|
||||
do {
|
||||
@@ -774,7 +765,7 @@ PX4IO::init()
|
||||
|
||||
/* re-send if necessary */
|
||||
if (!safety.armed) {
|
||||
orb_publish(ORB_ID(vehicle_command), pub, &cmd);
|
||||
orb_publish(ORB_ID(vehicle_command), pub, &vcmd);
|
||||
DEVICE_LOG("re-sending arm cmd");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user