AP_Compass: use switch statement in failed() method
This commit is contained in:
parent
dc58d0406c
commit
afd8d8255f
@ -138,9 +138,21 @@ void CompassCalibrator::new_sample(const Vector3f& sample)
|
||||
|
||||
bool CompassCalibrator::failed() {
|
||||
WITH_SEMAPHORE(state_sem);
|
||||
return (cal_state.status == Status::FAILED ||
|
||||
cal_state.status == Status::BAD_ORIENTATION ||
|
||||
cal_state.status == Status::BAD_RADIUS);
|
||||
switch (cal_state.status) {
|
||||
case Status::FAILED:
|
||||
case Status::BAD_ORIENTATION:
|
||||
case Status::BAD_RADIUS:
|
||||
return true;
|
||||
case Status::SUCCESS:
|
||||
case Status::NOT_STARTED:
|
||||
case Status::WAITING_TO_START:
|
||||
case Status::RUNNING_STEP_ONE:
|
||||
case Status::RUNNING_STEP_TWO:
|
||||
return false;
|
||||
}
|
||||
|
||||
// compiler guarantees we don't get here
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,8 @@ public:
|
||||
// update the state machine and calculate offsets, diagonals and offdiagonals
|
||||
void update();
|
||||
|
||||
// compass calibration states
|
||||
// compass calibration states - these correspond to the mavlink
|
||||
// MAG_CAL_STATUS enumeration
|
||||
enum class Status {
|
||||
NOT_STARTED = 0,
|
||||
WAITING_TO_START = 1,
|
||||
|
Loading…
Reference in New Issue
Block a user