mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 09:28:58 +00: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
@@ -2001,10 +2001,11 @@ int Logger::remove_directory(const char *dir)
|
||||
|
||||
void Logger::ack_vehicle_command(orb_advert_t &vehicle_command_ack_pub, uint16_t command, uint32_t result)
|
||||
{
|
||||
vehicle_command_ack_s vehicle_command_ack;
|
||||
vehicle_command_ack.timestamp = hrt_absolute_time();
|
||||
vehicle_command_ack.command = command;
|
||||
vehicle_command_ack.result = result;
|
||||
vehicle_command_ack_s vehicle_command_ack = {
|
||||
.timestamp = hrt_absolute_time(),
|
||||
.command = command,
|
||||
.result = (uint8_t)result
|
||||
};
|
||||
|
||||
if (vehicle_command_ack_pub == nullptr) {
|
||||
vehicle_command_ack_pub = orb_advertise_queue(ORB_ID(vehicle_command_ack), &vehicle_command_ack,
|
||||
|
||||
Reference in New Issue
Block a user