AP_Arming: use callback in place of variable reference for home state

This commit is contained in:
Peter Barker 2016-08-15 13:37:03 +10:00 committed by Randy Mackay
parent b31d2a59da
commit 362c6e1b9e
2 changed files with 5 additions and 5 deletions

View File

@ -75,12 +75,11 @@ const AP_Param::GroupInfo AP_Arming::var_info[] = {
//The function point is particularly hacky, hacky, tacky //The function point is particularly hacky, hacky, tacky
//but I don't want to reimplement messaging to GCS at the moment: //but I don't want to reimplement messaging to GCS at the moment:
AP_Arming::AP_Arming(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass, AP_Arming::AP_Arming(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass,
const AP_BattMonitor &battery, const enum HomeState &home_set) : const AP_BattMonitor &battery) :
ahrs(ahrs_ref), ahrs(ahrs_ref),
barometer(baro), barometer(baro),
_compass(compass), _compass(compass),
_battery(battery), _battery(battery),
home_is_set(home_set),
armed(false), armed(false),
arming_method(NONE) arming_method(NONE)
{ {
@ -337,7 +336,7 @@ bool AP_Arming::gps_checks(bool report)
if ((checks_to_perform & ARMING_CHECK_ALL) || (checks_to_perform & ARMING_CHECK_GPS)) { if ((checks_to_perform & ARMING_CHECK_ALL) || (checks_to_perform & ARMING_CHECK_GPS)) {
//GPS OK? //GPS OK?
if (home_is_set == HOME_UNSET || if (home_status() == HOME_UNSET ||
gps.status() < AP_GPS::GPS_OK_FIX_3D) { gps.status() < AP_GPS::GPS_OK_FIX_3D) {
if (report) { if (report) {
GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_CRITICAL, "PreArm: Bad GPS Position"); GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_CRITICAL, "PreArm: Bad GPS Position");

View File

@ -44,7 +44,7 @@ public:
}; };
AP_Arming(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass, AP_Arming(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass,
const AP_BattMonitor &battery, const enum HomeState &home_set); const AP_BattMonitor &battery);
ArmingRequired arming_required(); ArmingRequired arming_required();
virtual bool arm(uint8_t method); virtual bool arm(uint8_t method);
@ -78,7 +78,6 @@ protected:
const AP_Baro &barometer; const AP_Baro &barometer;
Compass &_compass; Compass &_compass;
const AP_BattMonitor &_battery; const AP_BattMonitor &_battery;
const enum HomeState &home_is_set;
// internal members // internal members
bool armed:1; bool armed:1;
@ -108,4 +107,6 @@ protected:
bool board_voltage_checks(bool report); bool board_voltage_checks(bool report);
bool manual_transmitter_checks(bool report); bool manual_transmitter_checks(bool report);
virtual enum HomeState home_status() const = 0;
}; };