From bdb2982ca58f671d4d36c0db00f74ab332b89c1b Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 27 Dec 2010 19:59:43 +0000 Subject: [PATCH] Added alarm processing for GPS module. Error when GPS disconnected OK when >=7 satellites and PDOP <3.5 Warning when only 3Dfix Critical otherwise git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2297 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/OpenPilot/Modules/GPS/GPS.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flight/OpenPilot/Modules/GPS/GPS.c b/flight/OpenPilot/Modules/GPS/GPS.c index 6dff24f53..2c29fc504 100644 --- a/flight/OpenPilot/Modules/GPS/GPS.c +++ b/flight/OpenPilot/Modules/GPS/GPS.c @@ -188,6 +188,7 @@ static void gpsTask(void *parameters) GPSPositionGet(&GpsData); GpsData.Status = GPSPOSITION_STATUS_NOGPS; GPSPositionSet(&GpsData); + AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_ERROR); } else { // Had an update HomeLocationData home; @@ -197,6 +198,12 @@ static void gpsTask(void *parameters) if ((GpsData.Status == GPSPOSITION_STATUS_FIX3D) && (home.Set == HOMELOCATION_SET_FALSE)) { setHomeLocation(&GpsData); } + + //criteria for GPS-OK taken from this post... + //http://forums.openpilot.org/topic/1523-professors-insgps-in-svn/page__view__findpost__p__5220 + if ((GpsData.PDOP<3.5)&&(GpsData.Satellites>=7))AlarmsClear(SYSTEMALARMS_ALARM_GPS); + else if (GpsData.Status == GPSPOSITION_STATUS_FIX3D) AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_WARNING); + else AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_CRITICAL); } // Block task until next update