From 801568269cb02afa2a8ba6126e6bfe9475b5d7bb Mon Sep 17 00:00:00 2001 From: osnwt Date: Mon, 20 Dec 2010 05:20:06 +0000 Subject: [PATCH] 2251 rev changes reverted. Let someone change UAVObjects to provide calibrated altitude and/or offset to HomeLocation and/or take off location (which can be quite different including elevation). But please do not forget that many of users do not have the GCS with Internet at field and/or do not have sufficient weather/baro/altitude condition info for their country. So the solution should provide also a way to 'drive-power-launch'. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2259 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/OpenPilot/Modules/Altitude/altitude.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/flight/OpenPilot/Modules/Altitude/altitude.c b/flight/OpenPilot/Modules/Altitude/altitude.c index 4592ba732..17d54a16a 100644 --- a/flight/OpenPilot/Modules/Altitude/altitude.c +++ b/flight/OpenPilot/Modules/Altitude/altitude.c @@ -69,10 +69,6 @@ int32_t AltitudeInitialize() */ static void altitudeTask(void *parameters) { - // For power-up zero height pressure calibration - static float p0 = BMP085_P0 / 1000.0; - static uint32_t i = 15; - BaroAltitudeData data; portTickType lastSysTime; @@ -97,13 +93,8 @@ static void altitudeTask(void *parameters) // Convert from Pa to kPa data.Pressure = PIOS_BMP085_GetPressure() / 1000.0; - // Save zero height pressure as p0 - if (i && (--i == 0)) { - p0 = data.Pressure; - } - // Compute the current altitude (all pressures in kPa) - data.Altitude = 44330.0 * (1.0 - powf((data.Pressure / p0), (1.0 / 5.255))); + data.Altitude = 44330.0 * (1.0 - powf((data.Pressure / (BMP085_P0 / 1000.0)), (1.0 / 5.255))); // Update the AltitudeActual UAVObject BaroAltitudeSet(&data);