From 0b0cda02cca74ae4a82b7c4ab38754223518f5cd Mon Sep 17 00:00:00 2001 From: Jacob Walser Date: Thu, 13 Oct 2016 17:52:04 -0400 Subject: [PATCH] Sub: add method to get throttle channel control_in, while applying deadzone to center like angle type channels --- ArduSub/Attitude.cpp | 5 +++++ ArduSub/Sub.h | 1 + 2 files changed, 6 insertions(+) diff --git a/ArduSub/Attitude.cpp b/ArduSub/Attitude.cpp index 7c49b35a60..aaa1fee40d 100644 --- a/ArduSub/Attitude.cpp +++ b/ArduSub/Attitude.cpp @@ -128,6 +128,11 @@ void Sub::set_throttle_takeoff() pos_control.init_takeoff(); } +int16_t Sub::get_throttle_control_dz() +{ + return (channel_throttle->pwm_to_angle() + 1000)/2; +} + // get_pilot_desired_throttle - transform pilot's throttle input to make cruise throttle mid stick // used only for manual throttle modes // returns throttle output 0 to 1000 diff --git a/ArduSub/Sub.h b/ArduSub/Sub.h index ec4e090b90..36520febd9 100644 --- a/ArduSub/Sub.h +++ b/ArduSub/Sub.h @@ -1056,6 +1056,7 @@ private: void auto_terrain_recover_run(void); void translate_wpnav_rp(float &lateral_out, float &forward_out); + int16_t get_throttle_control_dz(); bool surface_init(bool ignore_flags); void surface_run();