From c07f377eb13ee16d953e199bd356122d57654883 Mon Sep 17 00:00:00 2001 From: Francisco Ferreira Date: Sat, 12 Nov 2016 09:38:40 +0000 Subject: [PATCH] AP_AccelCal: make collect_sample responsible for state changes Also only set the snoop if the step has changed --- libraries/AP_AccelCal/AP_AccelCal.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/AP_AccelCal/AP_AccelCal.cpp b/libraries/AP_AccelCal/AP_AccelCal.cpp index 254fedd284..27d77e5197 100644 --- a/libraries/AP_AccelCal/AP_AccelCal.cpp +++ b/libraries/AP_AccelCal/AP_AccelCal.cpp @@ -45,8 +45,6 @@ void AP_AccelCal::update() } if(_start_collect_sample) { collect_sample(); - _gcs->set_snoop(nullptr); - _start_collect_sample = false; } switch(_status) { case ACCEL_CAL_NOT_STARTED: @@ -96,9 +94,9 @@ void AP_AccelCal::update() return; } _printf("Place vehicle %s and press any key.", msg); + // setup snooping of packets so we can see the COMMAND_ACK + _gcs->set_snoop(_snoop); } - // setup snooping of packets so we can see the COMMAND_ACK - _gcs->set_snoop(_snoop); break; } case ACCEL_CAL_COLLECTING_SAMPLE: @@ -246,6 +244,7 @@ void AP_AccelCal::collect_sample() } // setup snooping of packets so we can see the COMMAND_ACK _gcs->set_snoop(nullptr); + _start_collect_sample = false; update_status(); }