mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 22:03:34 +08:00
FlightModeManager/FixedwingPositionControl: robustify vehicle command parameter casting
This commit is contained in:
committed by
Roman Bapst
parent
6ce3e88f9d
commit
f892a624b7
@@ -444,8 +444,9 @@ void FlightModeManager::handleCommand()
|
||||
|
||||
} else if (_current_task.task) {
|
||||
// check for other commands not related to task switching
|
||||
if (command.command == vehicle_command_s::VEHICLE_CMD_DO_CHANGE_SPEED && command.param2 >= 0
|
||||
&& (uint8_t)command.param1 == vehicle_command_s::SPEED_TYPE_GROUNDSPEED) {
|
||||
if ((command.command == vehicle_command_s::VEHICLE_CMD_DO_CHANGE_SPEED)
|
||||
&& (static_cast<uint8_t>(command.param1 + .5f) == vehicle_command_s::SPEED_TYPE_GROUNDSPEED)
|
||||
&& (command.param2 > 0.f)) {
|
||||
_current_task.task->setCruisingSpeed(command.param2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user