From 5f2c502172aedb1dc8d47464a80bde85d7d53b00 Mon Sep 17 00:00:00 2001 From: peabody124 Date: Mon, 21 Feb 2011 05:58:24 +0000 Subject: [PATCH] Arm checks: Simply don't check GPS because the dependence on AHRS Settings breaks CC. This should be done by the GPS alarm being set only when appropriate (i.e. by AHRS on OP when needed) and not by the GPS module. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2824 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/Modules/ManualControl/manualcontrol.c | 75 +++++-------------- .../OpenPilotOSX.xcodeproj/project.pbxproj | 1 - 2 files changed, 20 insertions(+), 56 deletions(-) diff --git a/flight/Modules/ManualControl/manualcontrol.c b/flight/Modules/ManualControl/manualcontrol.c index 5a34cb9f0..4837a0716 100644 --- a/flight/Modules/ManualControl/manualcontrol.c +++ b/flight/Modules/ManualControl/manualcontrol.c @@ -42,8 +42,6 @@ #include "attitudedesired.h" #include "flighttelemetrystats.h" -#include "ahrs_comm_objects.h" - // Private constants #if defined(PIOS_MANUAL_STACK_SIZE) #define STACK_SIZE_BYTES PIOS_MANUAL_STACK_SIZE @@ -542,64 +540,31 @@ static uint32_t timeDifferenceMs(portTickType start_time, portTickType end_time) return (end_time - start_time) * portTICK_RATE_MS; return ((((portTICK_RATE_MS) -1) - start_time) + end_time) * portTICK_RATE_MS; } - + +/** + * @brief Determine if the aircraft is safe to arm + * @returns True if safe to arm, false otherwise + */ static bool okToArm(void) -{ // return TRUE if it's OK to arm, otherwise return FALSE - - bool ok = true; - - // read AHRS settings - AHRSSettingsData AHRSSettings; - AHRSSettingsGet(&AHRSSettings); - +{ // read alarms SystemAlarmsData alarms; - SystemAlarmsGet(&alarms); - -// SystemAlarmsAlarmOptions gps_alarm = AlarmsGet(SYSTEMALARMS_ALARM_GPS); -// SystemAlarmsAlarmOptions telemetry_alarm = AlarmsGet(SYSTEMALARMS_ALARM_TELEMETRY); - - switch (AHRSSettings.Algorithm) + SystemAlarmsGet(&alarms); + + + // Check each alarm + for (int i = 0; i < SYSTEMALARMS_ALARM_NUMELEM; i++) { - case AHRSSETTINGS_ALGORITHM_SIMPLE: - case AHRSSETTINGS_ALGORITHM_INSGPS_INDOOR: - case AHRSSETTINGS_ALGORITHM_INSGPS_INDOOR_NOMAG: - - // Check each alarm - for (int i = 0; i < SYSTEMALARMS_ALARM_NUMELEM; i++) - { - if (alarms.Alarm[i] >= SYSTEMALARMS_ALARM_ERROR) - { // found an alarm thats set - if (i != SYSTEMALARMS_ALARM_GPS && i != SYSTEMALARMS_ALARM_TELEMETRY) - { // it's not the gps or telemetry alarm - ok = false; // prevent arming - break; - } - } - } - - break; - - case AHRSSETTINGS_ALGORITHM_INSGPS_OUTDOOR: - default: // unknown AHRS algorithum - - // Check each alarm - for (int i = 0; i < SYSTEMALARMS_ALARM_NUMELEM; i++) - { - if (alarms.Alarm[i] >= SYSTEMALARMS_ALARM_ERROR) - { // found an alarm thats set - if (i != SYSTEMALARMS_ALARM_TELEMETRY) - { // it's not the telemetry alarm - ok = false; // prevent arming - break; - } - } - } - - break; + if (alarms.Alarm[i] >= SYSTEMALARMS_ALARM_ERROR) + { // found an alarm thats set + if (i == SYSTEMALARMS_ALARM_GPS || i == SYSTEMALARMS_ALARM_TELEMETRY) + continue; + + return false; + } } - - return ok; + + return true; } // diff --git a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj index 6cc0efc99..93a9714b1 100644 --- a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj +++ b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj @@ -8256,7 +8256,6 @@ }; buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "OpenPilotOSX" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English,