mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Merge remote-tracking branch 'origin/corvuscorax/OP-1018_airspeed-sensor-init-fix' into next
This commit is contained in:
commit
bbf501ea54
@ -72,7 +72,8 @@ void baro_airspeedGetETASV3(AirspeedSensorData *airspeedSensor, AirspeedSettings
|
|||||||
// Calibrate sensor by averaging zero point value
|
// Calibrate sensor by averaging zero point value
|
||||||
if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) {
|
if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) {
|
||||||
calibrationCount++;
|
calibrationCount++;
|
||||||
calibrationCount2++;
|
calibrationSum = 0;
|
||||||
|
calibrationCount2 = 0;
|
||||||
return;
|
return;
|
||||||
} else if (calibrationCount <= (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) {
|
} else if (calibrationCount <= (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) {
|
||||||
calibrationCount++;
|
calibrationCount++;
|
||||||
@ -81,6 +82,9 @@ void baro_airspeedGetETASV3(AirspeedSensorData *airspeedSensor, AirspeedSettings
|
|||||||
if (calibrationCount > (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) {
|
if (calibrationCount > (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) {
|
||||||
airspeedSettings->ZeroPoint = (int16_t)(((float)calibrationSum) / calibrationCount2);
|
airspeedSettings->ZeroPoint = (int16_t)(((float)calibrationSum) / calibrationCount2);
|
||||||
AirspeedSettingsZeroPointSet(&airspeedSettings->ZeroPoint);
|
AirspeedSettingsZeroPointSet(&airspeedSettings->ZeroPoint);
|
||||||
|
calibrationCount = 0;
|
||||||
|
calibrationSum = 0;
|
||||||
|
calibrationCount2 = 0;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user