mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-12 18:10:36 +08:00
FlightTasks: added possibility to apply task parameters from the vehicle command
This commit is contained in:
@@ -27,13 +27,19 @@ bool FlightTasks::_updateCommand()
|
||||
}
|
||||
|
||||
/* evaluate command */
|
||||
//printf("YAY %d\n", int(command.param1));
|
||||
|
||||
uint8_t switch_result = switchTask(int(command.param1));
|
||||
uint8_t cmd_result = vehicle_command_ack_s::VEHICLE_RESULT_FAILED;
|
||||
|
||||
/* switch succeeded */
|
||||
if (!switch_result) {
|
||||
cmd_result = vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED;
|
||||
|
||||
/* if the correct task is running apply parameters to it and see if it rejects */
|
||||
if (isAnyTaskActive()) {
|
||||
if (!_current_task->applyCommandParameters(command)) {
|
||||
cmd_result = vehicle_command_ack_s::VEHICLE_RESULT_DENIED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* send back acknowledgment */
|
||||
|
||||
Reference in New Issue
Block a user