RC_Channel: use SourceSetSelection enum class

This commit is contained in:
Tatsuya Yamaguchi 2023-06-19 23:21:35 +09:00 committed by Peter Barker
parent a7f9abcff9
commit 253d98dd53

View File

@ -1627,23 +1627,23 @@ bool RC_Channel::do_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos ch
#endif #endif
case AUX_FUNC::EKF_POS_SOURCE: { case AUX_FUNC::EKF_POS_SOURCE: {
uint8_t source_set = 0; AP_NavEKF_Source::SourceSetSelection source_set = AP_NavEKF_Source::SourceSetSelection::PRIMARY;
switch (ch_flag) { switch (ch_flag) {
case AuxSwitchPos::LOW: case AuxSwitchPos::LOW:
// low switches to primary source // low switches to primary source
source_set = 0; source_set = AP_NavEKF_Source::SourceSetSelection::PRIMARY;
break; break;
case AuxSwitchPos::MIDDLE: case AuxSwitchPos::MIDDLE:
// middle switches to secondary source // middle switches to secondary source
source_set = 1; source_set = AP_NavEKF_Source::SourceSetSelection::SECONDARY;
break; break;
case AuxSwitchPos::HIGH: case AuxSwitchPos::HIGH:
// high switches to tertiary source // high switches to tertiary source
source_set = 2; source_set = AP_NavEKF_Source::SourceSetSelection::TERTIARY;
break; break;
} }
AP::ahrs().set_posvelyaw_source_set(source_set); AP::ahrs().set_posvelyaw_source_set(source_set);
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Using EKF Source Set %u", source_set+1); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Using EKF Source Set %u", uint8_t(source_set)+1);
break; break;
} }