From 23122f4b9007b080468683e173a015d8e56aa208 Mon Sep 17 00:00:00 2001 From: Jacob Walser Date: Wed, 7 Dec 2016 15:01:08 -0500 Subject: [PATCH] Sub: Add camera tilt servo center parameter --- ArduSub/Parameters.cpp | 7 +++++++ ArduSub/Parameters.h | 2 ++ ArduSub/joystick.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ArduSub/Parameters.cpp b/ArduSub/Parameters.cpp index d9763407d9..a713b75d54 100644 --- a/ArduSub/Parameters.cpp +++ b/ArduSub/Parameters.cpp @@ -524,6 +524,13 @@ const AP_Param::Info Sub::var_info[] = { // @Range: 0.5 4.0 GSCALAR(throttle_gain, "JS_THR_GAIN", 1.0f), + // @Param: CAM_TILT_CENTER + // @DisplayName: Camera tilt mount center + // @Description: Servo PWM at camera center position + // @User: Standard + // @Range: 1000 2000 + GSCALAR(cam_tilt_center, "CAM_CENTER", 1500), + // @Group: BTN0_ // @Path: ../libraries/AP_JSButton/AP_JSButton.cpp GGROUP(jbtn_0, "BTN0_", JSButton), diff --git a/ArduSub/Parameters.h b/ArduSub/Parameters.h index 45c8a1ba1c..fdae4d847d 100644 --- a/ArduSub/Parameters.h +++ b/ArduSub/Parameters.h @@ -207,6 +207,7 @@ public: k_param_terrain_follow, k_param_rc_feel_rp, k_param_throttle_gain, + k_param_cam_tilt_center, // Acro Mode parameters k_param_acro_yaw_p = 220, // Used in all modes for get_pilot_desired_yaw_rate @@ -346,6 +347,7 @@ public: AP_Float minGain; AP_Int8 numGainSettings; AP_Float throttle_gain; + AP_Int16 cam_tilt_center; AP_Int16 cam_tilt_step; AP_Int16 lights_step; diff --git a/ArduSub/joystick.cpp b/ArduSub/joystick.cpp index 7f90909962..7259fc63d1 100644 --- a/ArduSub/joystick.cpp +++ b/ArduSub/joystick.cpp @@ -152,7 +152,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 = 1500; + cam_tilt_goal = g.cam_tilt_center; break; case JSButton::button_function_t::k_mount_tilt_up: { uint8_t i;