mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Added forced disarming via systemalarm
This commit is contained in:
parent
9dd94f98b6
commit
6a6eace700
@ -767,6 +767,21 @@ static bool okToArm(void)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief Determine if the aircraft is forced to disarm by an explicit alarm
|
||||||
|
* @returns True if safe to arm, false otherwise
|
||||||
|
*/
|
||||||
|
static bool forcedDisArm(void)
|
||||||
|
{
|
||||||
|
// read alarms
|
||||||
|
SystemAlarmsData alarms;
|
||||||
|
SystemAlarmsGet(&alarms);
|
||||||
|
|
||||||
|
if (alarms.Alarm[SYSTEMALARMS_ALARM_FORCEDISARM] == SYSTEMALARMS_ALARM_CRITICAL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update the flightStatus object only if value changed. Reduces callbacks
|
* @brief Update the flightStatus object only if value changed. Reduces callbacks
|
||||||
@ -792,6 +807,12 @@ static void processArm(ManualControlCommandData * cmd, ManualControlSettingsData
|
|||||||
|
|
||||||
bool lowThrottle = cmd->Throttle <= 0;
|
bool lowThrottle = cmd->Throttle <= 0;
|
||||||
|
|
||||||
|
if (forcedDisArm()) {
|
||||||
|
// PathPlanner forces explicit disarming due to error condition (crash, impact, fire, ...)
|
||||||
|
setArmedIfChanged(FLIGHTSTATUS_ARMED_DISARMED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (settings->Arming == MANUALCONTROLSETTINGS_ARMING_ALWAYSDISARMED) {
|
if (settings->Arming == MANUALCONTROLSETTINGS_ARMING_ALWAYSDISARMED) {
|
||||||
// In this configuration we always disarm
|
// In this configuration we always disarm
|
||||||
setArmedIfChanged(FLIGHTSTATUS_ARMED_DISARMED);
|
setArmedIfChanged(FLIGHTSTATUS_ARMED_DISARMED);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<object name="SystemAlarms" singleinstance="true" settings="false">
|
<object name="SystemAlarms" singleinstance="true" settings="false">
|
||||||
<description>Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules.</description>
|
<description>Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules.</description>
|
||||||
<field name="Alarm" units="" type="enum" options="Uninitialised,OK,Warning,Error,Critical"
|
<field name="Alarm" units="" type="enum" options="Uninitialised,OK,Warning,Error,Critical"
|
||||||
elementnames="OutOfMemory,StackOverflow,CPUOverload,EventSystem,SDCard,Telemetry,ManualControl,Actuator,Attitude,Sensors,Stabilization,Guidance,AHRSComms,Battery,FlightTime,I2C,GPS,BootFault" defaultvalue="Uninitialised"/>
|
elementnames="OutOfMemory,StackOverflow,CPUOverload,EventSystem,SDCard,Telemetry,ManualControl,Actuator,Attitude,Sensors,Stabilization,Guidance,AHRSComms,Battery,FlightTime,I2C,GPS,BootFault,ForceDisarm" defaultvalue="Uninitialised"/>
|
||||||
<access gcs="readwrite" flight="readwrite"/>
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||||
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user