Browse Source

FailureDetector - Add is_failure() function to simplify the interface; the user does not need to check the bitmask

sbg
bresch 6 years ago committed by Beat Küng
parent
commit
03ad4ffd47
  1. 4
      src/modules/commander/Commander.cpp
  2. 3
      src/modules/commander/failure_detector/FailureDetector.hpp

4
src/modules/commander/Commander.cpp

@ -2223,14 +2223,14 @@ Commander::run() @@ -2223,14 +2223,14 @@ Commander::run()
!_flight_termination_triggered &&
!status_flags.circuit_breaker_flight_termination_disabled) {
if (status.failure_detector_status != 0) {
if (_failure_detector.is_failure()) {
armed.force_failsafe = true;
status_changed = true;
_flight_termination_triggered = true;
mavlink_log_critical(&mavlink_log_pub, "Attitude failure detected: force failsafe");
mavlink_log_critical(&mavlink_log_pub, "Critical failure detected: terminate flight");
set_tune_override(TONE_PARACHUTE_RELEASE_TUNE);
}
}

3
src/modules/commander/failure_detector/FailureDetector.hpp

@ -70,7 +70,8 @@ public: @@ -70,7 +70,8 @@ public:
bool update();
uint8_t get_status() const {return _status;}
uint8_t get_status() const { return _status; }
bool is_failure() const { return (_status == FAILURE_NONE) ? false : true; }
private:

Loading…
Cancel
Save