diff --git a/libraries/SITL/SIM_ICEngine.cpp b/libraries/SITL/SIM_ICEngine.cpp index 2978c9542d..113a569aba 100644 --- a/libraries/SITL/SIM_ICEngine.cpp +++ b/libraries/SITL/SIM_ICEngine.cpp @@ -30,6 +30,9 @@ float ICEngine::update(const struct sitl_input &input) bool have_choke = choke_servo>=0; bool have_starter = starter_servo>=0; float throttle_demand = (input.servos[throttle_servo]-1000) * 0.001f; + if (throttle_reversed) { + throttle_demand = 1 - throttle_demand; + } state.ignition = have_ignition?input.servos[ignition_servo]>1700:true; state.choke = have_choke?input.servos[choke_servo]>1700:false; diff --git a/libraries/SITL/SIM_ICEngine.h b/libraries/SITL/SIM_ICEngine.h index 10423913e0..bac065a31e 100644 --- a/libraries/SITL/SIM_ICEngine.h +++ b/libraries/SITL/SIM_ICEngine.h @@ -30,12 +30,13 @@ public: const int8_t starter_servo; const float slew_rate; // percent-per-second - ICEngine(uint8_t _throttle, int8_t _choke, int8_t _ignition, int8_t _starter, float _slew_rate) : + ICEngine(uint8_t _throttle, int8_t _choke, int8_t _ignition, int8_t _starter, float _slew_rate, bool _throttle_reversed) : throttle_servo(_throttle), choke_servo(_choke), ignition_servo(_ignition), starter_servo(_starter), - slew_rate(_slew_rate) + slew_rate(_slew_rate), + throttle_reversed(_throttle_reversed) {} // update motor state @@ -54,5 +55,6 @@ private: uint8_t value; } state, last_state; bool overheat:1; + bool throttle_reversed; }; } diff --git a/libraries/SITL/SIM_Plane.h b/libraries/SITL/SIM_Plane.h index bfd0862e8e..37d42e20e6 100644 --- a/libraries/SITL/SIM_Plane.h +++ b/libraries/SITL/SIM_Plane.h @@ -115,7 +115,8 @@ protected: choke_servo, ignition_servo, starter_servo, - slewrate + slewrate, + true }; float liftCoeff(float alpha) const;