FlightTasks: added possibility to apply task parameters from the vehicle command

This commit is contained in:
Matthias Grob
2017-12-14 07:51:39 +01:00
committed by Beat Küng
parent b1f24da05e
commit efd240904f
7 changed files with 45 additions and 3 deletions
+8 -2
View File
@@ -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 */