Skip to content

Commit

Permalink
calibration_routines: fix 'Command denied during calibration' error m…
Browse files Browse the repository at this point in the history
…essage

The uorb subscribe logic got changed for queued topics with
#9436, meaning an orb_subscribe will
return past messages as well now.

This lead to an error 'Command denied during calibration' for the previously
received calibration start command.
  • Loading branch information
bkueng authored and LorenzMeier committed Jun 18, 2018
1 parent 1fac3a1 commit d1343b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/modules/commander/calibration_routines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,16 @@ calibrate_return calibrate_from_orientation(orb_advert_t *mavlink_log_pub,

int calibrate_cancel_subscribe()
{
return orb_subscribe(ORB_ID(vehicle_command));
int vehicle_command_sub = orb_subscribe(ORB_ID(vehicle_command));
if (vehicle_command_sub >= 0) {
// make sure we won't read any old messages
struct vehicle_command_s cmd;
bool update;
while (orb_check(vehicle_command_sub, &update) == 0 && update) {
orb_copy(ORB_ID(vehicle_command), vehicle_command_sub, &cmd);
}
}
return vehicle_command_sub;
}

void calibrate_cancel_unsubscribe(int cmd_sub)
Expand Down

0 comments on commit d1343b0

Please sign in to comment.