Browse Source

GCS_MAVLink: use singleton to get AP_AdvancedFailsafe pointer

mission-4.1.18
Peter Barker 5 years ago committed by Andrew Tridgell
parent
commit
2f60b230cd
  1. 1
      libraries/GCS_MAVLink/GCS.h
  2. 4
      libraries/GCS_MAVLink/GCS_Common.cpp

1
libraries/GCS_MAVLink/GCS.h

@ -282,7 +282,6 @@ protected:
// overridable method to check for packet acceptance. Allows for // overridable method to check for packet acceptance. Allows for
// enforcement of GCS sysid // enforcement of GCS sysid
bool accept_packet(const mavlink_status_t &status, const mavlink_message_t &msg); bool accept_packet(const mavlink_status_t &status, const mavlink_message_t &msg);
virtual AP_AdvancedFailsafe *get_advanced_failsafe() const { return nullptr; };
virtual bool set_mode(uint8_t mode) = 0; virtual bool set_mode(uint8_t mode) = 0;
void set_ekf_origin(const Location& loc); void set_ekf_origin(const Location& loc);

4
libraries/GCS_MAVLink/GCS_Common.cpp

@ -2490,7 +2490,7 @@ MAV_RESULT GCS_MAVLINK::handle_preflight_reboot(const mavlink_command_long_t &pa
*/ */
MAV_RESULT GCS_MAVLINK::handle_flight_termination(const mavlink_command_long_t &packet) MAV_RESULT GCS_MAVLINK::handle_flight_termination(const mavlink_command_long_t &packet)
{ {
AP_AdvancedFailsafe *failsafe = get_advanced_failsafe(); AP_AdvancedFailsafe *failsafe = AP::advancedfailsafe();
if (failsafe == nullptr) { if (failsafe == nullptr) {
return MAV_RESULT_UNSUPPORTED; return MAV_RESULT_UNSUPPORTED;
} }
@ -4631,7 +4631,7 @@ uint64_t GCS_MAVLINK::capabilities() const
ret |= MAV_PROTOCOL_CAPABILITY_MAVLINK2; ret |= MAV_PROTOCOL_CAPABILITY_MAVLINK2;
} }
AP_AdvancedFailsafe *failsafe = get_advanced_failsafe(); AP_AdvancedFailsafe *failsafe = AP::advancedfailsafe();
if (failsafe != nullptr && failsafe->enabled()) { if (failsafe != nullptr && failsafe->enabled()) {
// Copter and Sub may also set this bit as they can always terminate // Copter and Sub may also set this bit as they can always terminate
ret |= MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION; ret |= MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION;

Loading…
Cancel
Save