|
|
|
@ -8,8 +8,8 @@
@@ -8,8 +8,8 @@
|
|
|
|
|
// Anonymous namespace to hold variables used only in this file
|
|
|
|
|
namespace { |
|
|
|
|
int16_t mode = 1100; |
|
|
|
|
int16_t cam_tilt = 1500; |
|
|
|
|
int16_t cam_tilt_goal = 1500; |
|
|
|
|
float cam_tilt = 1500.0; |
|
|
|
|
float cam_tilt_goal = 1500.0; |
|
|
|
|
float cam_tilt_alpha = 0.97; |
|
|
|
|
int16_t lights1 = 1100; |
|
|
|
|
int16_t lights2 = 1100; |
|
|
|
@ -131,11 +131,35 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held) {
@@ -131,11 +131,35 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held) {
|
|
|
|
|
case JSButton::button_function_t::k_mount_center: |
|
|
|
|
cam_tilt_goal = 1500; |
|
|
|
|
break; |
|
|
|
|
case JSButton::button_function_t::k_mount_tilt_up: |
|
|
|
|
cam_tilt_goal = constrain_float(cam_tilt_goal-g.cam_tilt_step,800,2200); |
|
|
|
|
case JSButton::button_function_t::k_mount_tilt_up: { |
|
|
|
|
uint8_t i; |
|
|
|
|
|
|
|
|
|
// Find the first aux channel configured as mount tilt, if any
|
|
|
|
|
if(RC_Channel_aux::find_channel(RC_Channel_aux::k_mount_tilt, i)) { |
|
|
|
|
|
|
|
|
|
// Get the channel output limits
|
|
|
|
|
RC_Channel *ch = RC_Channel::rc_channel(i); |
|
|
|
|
uint16_t min = ch->get_limit_pwm(RC_Channel::RC_CHANNEL_LIMIT_MIN); |
|
|
|
|
uint16_t max = ch->get_limit_pwm(RC_Channel::RC_CHANNEL_LIMIT_MAX); |
|
|
|
|
|
|
|
|
|
cam_tilt_goal = constrain_int16(cam_tilt_goal-g.cam_tilt_step,min,max); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case JSButton::button_function_t::k_mount_tilt_down: |
|
|
|
|
cam_tilt_goal = constrain_float(cam_tilt_goal+g.cam_tilt_step,800,2200); |
|
|
|
|
case JSButton::button_function_t::k_mount_tilt_down: { |
|
|
|
|
uint8_t i; |
|
|
|
|
|
|
|
|
|
// Find the first aux channel configured as mount tilt, if any
|
|
|
|
|
if(RC_Channel_aux::find_channel(RC_Channel_aux::k_mount_tilt, i)) { |
|
|
|
|
|
|
|
|
|
// Get the channel output limits
|
|
|
|
|
RC_Channel *ch = RC_Channel::rc_channel(i); |
|
|
|
|
uint16_t min = ch->get_limit_pwm(RC_Channel::RC_CHANNEL_LIMIT_MIN); |
|
|
|
|
uint16_t max = ch->get_limit_pwm(RC_Channel::RC_CHANNEL_LIMIT_MAX); |
|
|
|
|
|
|
|
|
|
cam_tilt_goal = constrain_int16(cam_tilt_goal+g.cam_tilt_step,min,max); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case JSButton::button_function_t::k_camera_trigger: |
|
|
|
|
break; |
|
|
|
|