|
|
|
@ -7,8 +7,6 @@
@@ -7,8 +7,6 @@
|
|
|
|
|
namespace { |
|
|
|
|
int16_t mode_switch_pwm = 1100; |
|
|
|
|
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; |
|
|
|
|
int16_t rollTrim = 0; |
|
|
|
@ -87,7 +85,7 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
@@ -87,7 +85,7 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
|
|
|
|
|
channels[4] = mode_switch_pwm; // for testing only
|
|
|
|
|
channels[5] = constrain_int16((x+xTrim)*rpyScale+rpyCenter,1100,1900); // forward for ROV
|
|
|
|
|
channels[6] = constrain_int16((y+yTrim)*rpyScale+rpyCenter,1100,1900); // lateral for ROV
|
|
|
|
|
channels[7] = 0xffff; // camera tilt (sent in camera_tilt_smooth)
|
|
|
|
|
channels[7] = cam_tilt; // camera tilt
|
|
|
|
|
channels[8] = lights1; // lights 1
|
|
|
|
|
channels[9] = lights2; // lights 2
|
|
|
|
|
channels[10] = video_switch; // video switch
|
|
|
|
@ -160,7 +158,7 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
@@ -160,7 +158,7 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
|
|
|
|
|
toggle_mode = false; |
|
|
|
|
break; |
|
|
|
|
case JSButton::button_function_t::k_mount_center: |
|
|
|
|
cam_tilt_goal = g.cam_tilt_center; |
|
|
|
|
cam_tilt = g.cam_tilt_center; |
|
|
|
|
break; |
|
|
|
|
case JSButton::button_function_t::k_mount_tilt_up: { |
|
|
|
|
uint8_t i; |
|
|
|
@ -173,7 +171,7 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
@@ -173,7 +171,7 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
|
|
|
|
|
uint16_t min = ch->get_output_min(); |
|
|
|
|
uint16_t max = ch->get_output_max(); |
|
|
|
|
|
|
|
|
|
cam_tilt_goal = constrain_int16(cam_tilt_goal-g.cam_tilt_step,min,max); |
|
|
|
|
cam_tilt = constrain_int16(cam_tilt-g.cam_tilt_step,min,max); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -188,7 +186,7 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
@@ -188,7 +186,7 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
|
|
|
|
|
uint16_t min = ch->get_output_min(); |
|
|
|
|
uint16_t max = ch->get_output_max(); |
|
|
|
|
|
|
|
|
|
cam_tilt_goal = constrain_int16(cam_tilt_goal+g.cam_tilt_step,min,max); |
|
|
|
|
cam_tilt = constrain_int16(cam_tilt+g.cam_tilt_step,min,max); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -424,23 +422,6 @@ JSButton* Sub::get_button(uint8_t index)
@@ -424,23 +422,6 @@ JSButton* Sub::get_button(uint8_t index)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Sub::camera_tilt_smooth() |
|
|
|
|
{ |
|
|
|
|
if (failsafe.manual_control) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
int16_t channels[11]; |
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0 ; i < 11 ; i++) { |
|
|
|
|
channels[i] = 0xffff; |
|
|
|
|
} |
|
|
|
|
// Camera tilt low pass filter
|
|
|
|
|
cam_tilt = cam_tilt*cam_tilt_alpha+cam_tilt_goal*(1-cam_tilt_alpha); |
|
|
|
|
channels[7] = cam_tilt; |
|
|
|
|
|
|
|
|
|
failsafe.rc_override_active = hal.rcin->set_overrides(channels, 10); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Sub::default_js_buttons() |
|
|
|
|
{ |
|
|
|
|
JSButton::button_function_t defaults[16][2] = { |
|
|
|
|