Skip to content

Commit

Permalink
RC_Channel: integrate AP_CAMERA_SET_CAMERA_SOURCE_ENABLED
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 committed Mar 25, 2024
1 parent 3a57094 commit e9cffbb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libraries/RC_Channel/RC_Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,14 +1004,18 @@ bool RC_Channel::do_aux_function_camera_image_tracking(const AuxSwitchPos ch_fla

bool RC_Channel::do_aux_function_camera_lens(const AuxSwitchPos ch_flag)
{
#if AP_CAMERA_SET_CAMERA_SOURCE_ENABLED
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
return false;
}
// Low selects lens 0 (default), Mediums selects lens1, High selects lens2
return camera->set_lens((uint8_t)ch_flag);
#else
return false;
#endif // AP_CAMERA_SET_CAMERA_SOURCE_ENABLED
}
#endif
#endif // AP_CAMERA_ENABLED

void RC_Channel::do_aux_function_runcam_control(const AuxSwitchPos ch_flag)
{
Expand Down Expand Up @@ -1526,9 +1530,11 @@ bool RC_Channel::do_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos ch
case AUX_FUNC::CAMERA_IMAGE_TRACKING:
return do_aux_function_camera_image_tracking(ch_flag);

#if AP_CAMERA_SET_CAMERA_SOURCE_ENABLED
case AUX_FUNC::CAMERA_LENS:
return do_aux_function_camera_lens(ch_flag);
#endif
#endif // AP_CAMERA_SET_CAMERA_SOURCE_ENABLED
#endif // AP_CAMERA_ENABLED

#if HAL_MOUNT_ENABLED
case AUX_FUNC::RETRACT_MOUNT1: {
Expand Down

0 comments on commit e9cffbb

Please sign in to comment.