Browse Source

AP_Camera: rename 'enum aux_switch_pos_t' to 'enum class AuxSwitchPos'

zr-v5.1
Peter Barker 5 years ago committed by Peter Barker
parent
commit
ea03504af2
  1. 26
      libraries/AP_Camera/AP_RunCam.cpp

26
libraries/AP_Camera/AP_RunCam.cpp

@ -437,40 +437,40 @@ void AP_RunCam::handle_in_menu(Event ev)
// map rc input to an event // map rc input to an event
AP_RunCam::Event AP_RunCam::map_rc_input_to_event() const AP_RunCam::Event AP_RunCam::map_rc_input_to_event() const
{ {
const RC_Channel::aux_switch_pos_t throttle = rc().get_channel_pos(AP::rcmap()->throttle()); const RC_Channel::AuxSwitchPos throttle = rc().get_channel_pos(AP::rcmap()->throttle());
const RC_Channel::aux_switch_pos_t yaw = rc().get_channel_pos(AP::rcmap()->yaw()); const RC_Channel::AuxSwitchPos yaw = rc().get_channel_pos(AP::rcmap()->yaw());
const RC_Channel::aux_switch_pos_t roll = rc().get_channel_pos(AP::rcmap()->roll()); const RC_Channel::AuxSwitchPos roll = rc().get_channel_pos(AP::rcmap()->roll());
const RC_Channel::aux_switch_pos_t pitch = rc().get_channel_pos(AP::rcmap()->pitch()); const RC_Channel::AuxSwitchPos pitch = rc().get_channel_pos(AP::rcmap()->pitch());
Event result = Event::NONE; Event result = Event::NONE;
if (_button_pressed != ButtonState::NONE) { if (_button_pressed != ButtonState::NONE) {
if (_button_pressed == ButtonState::PRESSED && yaw == RC_Channel::MIDDLE && pitch == RC_Channel::MIDDLE && roll == RC_Channel::MIDDLE) { if (_button_pressed == ButtonState::PRESSED && yaw == RC_Channel::AuxSwitchPos::MIDDLE && pitch == RC_Channel::AuxSwitchPos::MIDDLE && roll == RC_Channel::AuxSwitchPos::MIDDLE) {
result = Event::BUTTON_RELEASE; result = Event::BUTTON_RELEASE;
} else { } else {
result = Event::NONE; // still waiting to be released result = Event::NONE; // still waiting to be released
} }
} else if (throttle == RC_Channel::MIDDLE && yaw == RC_Channel::LOW } else if (throttle == RC_Channel::AuxSwitchPos::MIDDLE && yaw == RC_Channel::AuxSwitchPos::LOW
&& pitch == RC_Channel::MIDDLE && roll == RC_Channel::MIDDLE && pitch == RC_Channel::AuxSwitchPos::MIDDLE && roll == RC_Channel::AuxSwitchPos::MIDDLE
// don't allow an action close to arming unless the user had configured it or arming is not possible // don't allow an action close to arming unless the user had configured it or arming is not possible
// but don't prevent the 5-Key control actually working // but don't prevent the 5-Key control actually working
&& (_cam_control_option & uint8_t(ControlOption::STICK_YAW_RIGHT) || is_arming_prevented())) { && (_cam_control_option & uint8_t(ControlOption::STICK_YAW_RIGHT) || is_arming_prevented())) {
result = Event::EXIT_MENU; result = Event::EXIT_MENU;
} else if (throttle == RC_Channel::MIDDLE && yaw == RC_Channel::HIGH } else if (throttle == RC_Channel::AuxSwitchPos::MIDDLE && yaw == RC_Channel::AuxSwitchPos::HIGH
&& pitch == RC_Channel::MIDDLE && roll == RC_Channel::MIDDLE && pitch == RC_Channel::AuxSwitchPos::MIDDLE && roll == RC_Channel::AuxSwitchPos::MIDDLE
&& (_cam_control_option & uint8_t(ControlOption::STICK_YAW_RIGHT) || is_arming_prevented())) { && (_cam_control_option & uint8_t(ControlOption::STICK_YAW_RIGHT) || is_arming_prevented())) {
result = Event::ENTER_MENU; result = Event::ENTER_MENU;
} else if (roll == RC_Channel::LOW) { } else if (roll == RC_Channel::AuxSwitchPos::LOW) {
result = Event::IN_MENU_EXIT; result = Event::IN_MENU_EXIT;
} else if (yaw == RC_Channel::MIDDLE && pitch == RC_Channel::MIDDLE && roll == RC_Channel::HIGH) { } else if (yaw == RC_Channel::AuxSwitchPos::MIDDLE && pitch == RC_Channel::AuxSwitchPos::MIDDLE && roll == RC_Channel::AuxSwitchPos::HIGH) {
if (has_feature(Feature::RCDEVICE_PROTOCOL_FEATURE_SIMULATE_5_KEY_OSD_CABLE)) { if (has_feature(Feature::RCDEVICE_PROTOCOL_FEATURE_SIMULATE_5_KEY_OSD_CABLE)) {
result = Event::IN_MENU_RIGHT; result = Event::IN_MENU_RIGHT;
} else { } else {
result = Event::IN_MENU_ENTER; result = Event::IN_MENU_ENTER;
} }
} else if (pitch == RC_Channel::LOW) { } else if (pitch == RC_Channel::AuxSwitchPos::LOW) {
result = Event::IN_MENU_UP; result = Event::IN_MENU_UP;
} else if (pitch == RC_Channel::HIGH) { } else if (pitch == RC_Channel::AuxSwitchPos::HIGH) {
result = Event::IN_MENU_DOWN; result = Event::IN_MENU_DOWN;
} else if (_video_recording != _last_video_recording) { } else if (_video_recording != _last_video_recording) {
switch (_video_recording) { switch (_video_recording) {

Loading…
Cancel
Save