1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

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
This commit is contained in:
andrew 2010-12-27 19:59:43 +00:00 committed by andrew
parent 26650724e4
commit bdb2982ca5

View File

@ -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