diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.cpp b/libraries/AP_InertialSensor/AP_InertialSensor.cpp index 66e4981c40..98c0075683 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor.cpp @@ -1945,6 +1945,19 @@ bool AP_InertialSensor::calibrating() const return _calibrating_accel || _calibrating_gyro || (_acal && _acal->active()); } +/// calibrating - returns true if a temperature calibration is running +bool AP_InertialSensor::temperature_cal_running() const +{ +#if HAL_INS_TEMPERATURE_CAL_ENABLE + for (uint8_t i=0; i enable; + + private: AP_Float temp_min; AP_Float temp_max; AP_Vector3f accel_coeff[3]; diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_tempcal.cpp b/libraries/AP_InertialSensor/AP_InertialSensor_tempcal.cpp index 0ddaf8b734..5ec642093f 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor_tempcal.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor_tempcal.cpp @@ -328,9 +328,11 @@ void AP_InertialSensor::TCal::update_accel_learning(const Vector3f &accel, float GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "TCAL[%u]: started calibration t=%.1fC tmax=%.1fC", instance(), temperature, temp_max.get()); + AP_Notify::events.initiated_temp_cal = 1; } } if (learn != nullptr) { + AP_Notify::flags.temp_cal_running = true; learn->add_sample(accel, temperature, learn->state[0]); } } @@ -359,6 +361,7 @@ void AP_InertialSensor::TCal::Learn::finish_calibration(float temperature) float p[4]; if (!state[0].pfit[i].get_polynomial(p)) { GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "TCAL[%u]: failed accel fit axis %u", instance(), i); + AP_Notify::events.temp_cal_failed = 1; tcal.enable.set_and_save(int8_t(TCal::Enable::Disabled)); return; } @@ -374,6 +377,7 @@ void AP_InertialSensor::TCal::Learn::finish_calibration(float temperature) float p[4]; if (!state[1].pfit[i].get_polynomial(p)) { GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "TCAL[%u]: failed gyro fit axis %u", tcal.instance(), i); + AP_Notify::events.temp_cal_failed = 1; tcal.enable.set_and_save(int8_t(TCal::Enable::Disabled)); return; } @@ -389,6 +393,11 @@ void AP_InertialSensor::TCal::Learn::finish_calibration(float temperature) instance(), tcal.temp_min.get(), tcal.temp_max.get()); tcal.enable.set_and_save(int8_t(TCal::Enable::Enabled)); + + if (!AP::ins().temperature_cal_running()) { + AP_Notify::flags.temp_cal_running = false; + AP_Notify::events.temp_cal_saved = 1; + } } uint8_t AP_InertialSensor::TCal::instance(void) const