From f3d30564ed5bf012c7982a6cca68f028c41f23ef Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Thu, 9 Feb 2017 15:36:02 +1100 Subject: [PATCH] events: don't start baro calibration until specified temperature achieved --- src/modules/events/temperature_calibration/baro.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/events/temperature_calibration/baro.cpp b/src/modules/events/temperature_calibration/baro.cpp index 6df349d891..8cf5cc8fe9 100644 --- a/src/modules/events/temperature_calibration/baro.cpp +++ b/src/modules/events/temperature_calibration/baro.cpp @@ -96,6 +96,12 @@ int TemperatureCalibrationBaro::update_sensor_instance(PerSensorData &data, int data.sensor_sample_filt[0] = 100.0f * baro_data.pressure; // convert from hPA to Pa data.sensor_sample_filt[1] = baro_data.temperature; + + // wait for min start temp to be reached before starting calibration + if (data.sensor_sample_filt[1] < _min_start_temperature) { + return 1; + } + if (!data.cold_soaked) { data.cold_soaked = true; data.low_temp = data.sensor_sample_filt[1]; //Record the low temperature