diff --git a/ArduPlane/Parameters.h b/ArduPlane/Parameters.h index 5d1dd81d2f..a8d013d35e 100644 --- a/ArduPlane/Parameters.h +++ b/ArduPlane/Parameters.h @@ -70,6 +70,7 @@ public: k_param_land_pitch_cd, k_param_ins, k_param_stick_mixing, + k_param_reset_mission_chan, // 110: Telemetry control // @@ -289,6 +290,7 @@ public: AP_Int16 num_resets; AP_Int16 log_bitmask; AP_Int8 reset_switch_chan; + AP_Int8 reset_mission_chan; AP_Int8 manual_level; AP_Int32 airspeed_cruise_cm; AP_Int32 RTL_altitude_cm; diff --git a/ArduPlane/Parameters.pde b/ArduPlane/Parameters.pde index 8eb140a026..418a32e732 100644 --- a/ArduPlane/Parameters.pde +++ b/ArduPlane/Parameters.pde @@ -379,10 +379,16 @@ const AP_Param::Info var_info[] PROGMEM = { // @Param: RST_SWITCH_CH // @DisplayName: Reset Switch Channel - // @Description: RC channel to use to reset to last flight mode after geofence takeover + // @Description: RC channel to use to reset to last flight mode after geofence takeover. // @User: Advanced GSCALAR(reset_switch_chan, "RST_SWITCH_CH", 0), + // @Param: RST_MISSION_CH + // @DisplayName: Reset Mission Channel + // @Description: RC channel to use to reset the mission to the first waypoint. When this channel goes above 1750 the mission is reset. Set RST_MISSION_CH to 0 to disable. + // @User: Advanced + GSCALAR(reset_mission_chan, "RST_MISSION_CH", 0), + // @Param: TRIM_ARSPD_CM // @DisplayName: Target airspeed // @Description: Airspeed in cm/s to aim for when airspeed is enabled in auto mode diff --git a/ArduPlane/control_modes.pde b/ArduPlane/control_modes.pde index 3b5f61e16f..eda7f5d167 100644 --- a/ArduPlane/control_modes.pde +++ b/ArduPlane/control_modes.pde @@ -39,6 +39,13 @@ static void read_control_switch() reset_I(); } + if (g.reset_mission_chan != 0 && + APM_RC.InputCh(g.reset_mission_chan-1) > RESET_SWITCH_CHAN_PWM) { + // reset to first waypoint in mission + prev_WP = current_loc; + change_command(1); + } + switch_debouncer = false; if (g.inverted_flight_ch != 0) {