mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 14:33:34 +08:00
Initialize all outgoing vehicle_command_ack_s and vehicle_command_s
This will initialize those structs with zero in all fields not set and all fields set will only be change once to the final value not wasting CPU time zeroing it. This will guarantee that no non-unitialized structs will have a trash value on from_external causing it to be sent to the MAVLink channel without need it.
This commit is contained in:
committed by
Lorenz Meier
parent
7c268f4fa1
commit
925efe990d
@@ -534,9 +534,11 @@ pthread_addr_t UavcanServers::run(pthread_addr_t)
|
||||
}
|
||||
|
||||
// Acknowledge the received command
|
||||
struct vehicle_command_ack_s ack = {};
|
||||
ack.command = cmd.command;
|
||||
ack.result = cmd_ack_result;
|
||||
struct vehicle_command_ack_s ack = {
|
||||
.timestamp = 0,
|
||||
.command = cmd.command,
|
||||
.result = cmd_ack_result
|
||||
};
|
||||
|
||||
if (_command_ack_pub == nullptr) {
|
||||
_command_ack_pub = orb_advertise_queue(ORB_ID(vehicle_command_ack), &ack, vehicle_command_ack_s::ORB_QUEUE_LENGTH);
|
||||
|
||||
Reference in New Issue
Block a user