From 5f38669666437363ccfa6bfae7a5f364f840a650 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 5 Jul 2012 16:27:13 +1000 Subject: [PATCH] SITL: run the HIL barometer at 80Hz to match APM2 --- libraries/Desktop/support/sitl_barometer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/Desktop/support/sitl_barometer.cpp b/libraries/Desktop/support/sitl_barometer.cpp index 2be39737e6..465041f00c 100644 --- a/libraries/Desktop/support/sitl_barometer.cpp +++ b/libraries/Desktop/support/sitl_barometer.cpp @@ -25,6 +25,13 @@ void sitl_update_barometer(float altitude) { extern AP_Baro_BMP085_HIL barometer; double Temp, Press, y; + static uint32_t last_update; + + // 80Hz, to match the real APM2 barometer + if (millis() - last_update < 12) { + return; + } + last_update = millis(); Temp = 312;