AP_Compass: simplify calibration transition to COMPASS_CAL_RUNNING_STEP_ONE

This commit is contained in:
Gustavo Jose de Sousa 2015-10-15 18:34:53 -03:00 committed by Andrew Tridgell
parent f21ee7694a
commit f8433f82e6

View File

@ -253,14 +253,12 @@ bool CompassCalibrator::set_status(compass_cal_status_t status) {
return false;
}
if(_sample_buffer != NULL) {
initialize_fit();
_status = COMPASS_CAL_RUNNING_STEP_ONE;
return true;
if (_sample_buffer == NULL) {
_sample_buffer =
(CompassSample*) malloc(sizeof(CompassSample) *
COMPASS_CAL_NUM_SAMPLES);
}
_sample_buffer = (CompassSample*)malloc(sizeof(CompassSample)*COMPASS_CAL_NUM_SAMPLES);
if(_sample_buffer != NULL) {
initialize_fit();
_status = COMPASS_CAL_RUNNING_STEP_ONE;