AP_Arming: added check for logging available

this is used for refusing to fly without microSD inserted
This commit is contained in:
Andrew Tridgell 2015-02-06 18:38:53 +11:00
parent a70f98552e
commit 4ecd99eb76
2 changed files with 23 additions and 1 deletions

View File

@ -37,7 +37,7 @@ const AP_Param::GroupInfo AP_Arming::var_info[] PROGMEM = {
// @Param: CHECK
// @DisplayName: Arm Checks to Peform (bitmask)
// @Description: Checks prior to arming motor. This is a bitmask of checks that will be performed befor allowing arming. The default is no checks, allowing arming at any time. You can select whatever checks you prefer by adding together the values of each check type to set this parameter. For example, to only allow arming when you have GPS lock and no RC failsafe you would set ARMING_CHECK to 72. For most users it is recommended that you set this to 1 to enable all checks.
// @Values: 0:None,1:All,2:Barometer,4:Compass,8:GPS,16:INS,32:Parameters,64:RC Failsafe,128:Board voltage,256:Battery Level,512:Airspeed
// @Values: 0:None,1:All,2:Barometer,4:Compass,8:GPS,16:INS,32:Parameters,64:RC Failsafe,128:Board voltage,256:Battery Level,512:Airspeed,1024:LoggingAvailable
// @User: Advanced
AP_GROUPINFO("CHECK", 2, AP_Arming, checks_to_perform, ARMING_CHECK_ALL),
@ -49,6 +49,7 @@ const AP_Param::GroupInfo AP_Arming::var_info[] PROGMEM = {
AP_Arming::AP_Arming(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass,
const bool &home_set, gcs_send_t_p gcs_print_func)
: armed(false)
, logging_available(false)
, skip_gyro_cal(false)
, arming_method(NONE)
, ahrs(ahrs_ref)
@ -109,6 +110,20 @@ bool AP_Arming::airspeed_checks(bool report)
return true;
}
bool AP_Arming::logging_checks(bool report)
{
if ((checks_to_perform & ARMING_CHECK_ALL) ||
(checks_to_perform & ARMING_CHECK_LOGGING)) {
if (!logging_available) {
if (report) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: logging not available"));
}
return false;
}
}
return true;
}
bool AP_Arming::ins_checks(bool report)
{
if ((checks_to_perform & ARMING_CHECK_ALL) ||
@ -323,6 +338,7 @@ bool AP_Arming::pre_arm_checks(bool report)
ret &= gps_checks(report);
ret &= battery_checks(report);
ret &= airspeed_checks(report);
ret &= logging_checks(report);
ret &= manual_transmitter_checks(report);
return ret;

View File

@ -22,6 +22,7 @@ public:
ARMING_CHECK_VOLTAGE = 0x0080,
ARMING_CHECK_BATTERY = 0x0100,
ARMING_CHECK_AIRSPEED = 0x0200,
ARMING_CHECK_LOGGING = 0x0400,
};
enum ArmingMethod {
@ -52,11 +53,14 @@ public:
bool pre_arm_checks(bool report);
void set_skip_gyro_cal(bool set) { skip_gyro_cal = set; }
void set_logging_available(bool set) { logging_available = set; }
//for params
static const struct AP_Param::GroupInfo var_info[];
private:
bool armed:1;
bool logging_available:1;
bool skip_gyro_cal:1;
//Parameters
@ -80,6 +84,8 @@ private:
bool airspeed_checks(bool report);
bool logging_checks(bool report);
bool ins_checks(bool report);
bool compass_checks(bool report);