diff --git a/src/drivers/dshot/DShot.cpp b/src/drivers/dshot/DShot.cpp index 4c4c36fcf7..5ae0150efb 100644 --- a/src/drivers/dshot/DShot.cpp +++ b/src/drivers/dshot/DShot.cpp @@ -262,7 +262,7 @@ int DShot::send_command_thread_safe(const dshot_command_t command, const int num cmd.motor_mask = 0xff; } else { - cmd.motor_mask = 1 << _mixing_output.reorderedMotorIndex(motor_index); + cmd.motor_mask = 1 << motor_index; } cmd.num_repetitions = num_repetitions; @@ -320,7 +320,7 @@ int DShot::request_esc_info() _telemetry->handler.redirectOutput(*_request_esc_info.load()); _waiting_for_esc_info = true; - int motor_index = _mixing_output.reorderedMotorIndex(_request_esc_info.load()->motor_index); + int motor_index = _request_esc_info.load()->motor_index; _current_command.motor_mask = 1 << motor_index; _current_command.num_repetitions = 1; @@ -352,7 +352,7 @@ bool DShot::updateOutputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS], requested_telemetry_index = request_esc_info(); } else { - requested_telemetry_index = _mixing_output.reorderedMotorIndex(_telemetry->handler.getRequestMotorIndex()); + requested_telemetry_index = _telemetry->handler.getRequestMotorIndex(); } } diff --git a/src/lib/mixer_module/mixer_module.cpp b/src/lib/mixer_module/mixer_module.cpp index 4fe528f359..e6fd6e41e5 100644 --- a/src/lib/mixer_module/mixer_module.cpp +++ b/src/lib/mixer_module/mixer_module.cpp @@ -150,8 +150,6 @@ void MixingOutput::updateParams() { ModuleParams::updateParams(); - _param_mot_ordering.set(0); // not used with dynamic mixing - bool function_changed = false; for (unsigned i = 0; i < _max_num_outputs; i++) { @@ -429,10 +427,10 @@ unsigned MixingOutput::motorTest() if (idx < MAX_ACTUATORS) { if (test_motor.value < 0.f) { - _current_output_value[reorderedMotorIndex(idx)] = _disarmed_value[idx]; + _current_output_value[idx] = _disarmed_value[idx]; } else { - _current_output_value[reorderedMotorIndex(idx)] = + _current_output_value[idx] = math::constrain(_min_value[idx] + (uint16_t)((_max_value[idx] - _min_value[idx]) * test_motor.value), _min_value[idx], _max_value[idx]); } @@ -767,20 +765,3 @@ MixingOutput::actualFailsafeValue(int index) const return value; } - -int MixingOutput::reorderedMotorIndex(int index) const -{ - if ((MotorOrdering)_param_mot_ordering.get() == MotorOrdering::Betaflight) { - switch (index) { - case 0: return 1; - - case 1: return 2; - - case 2: return 3; - - case 3: return 0; - } - } - - return index; -} diff --git a/src/lib/mixer_module/mixer_module.hpp b/src/lib/mixer_module/mixer_module.hpp index 170456f98c..0f642d3bdd 100644 --- a/src/lib/mixer_module/mixer_module.hpp +++ b/src/lib/mixer_module/mixer_module.hpp @@ -186,13 +186,6 @@ public: */ uint16_t actualFailsafeValue(int index) const; - /** - * Get the motor index that maps from PX4 convention to the configured one - * @param index motor index in [0, num_motors-1] - * @return reordered motor index. When out of range, the input index is returned - */ - int reorderedMotorIndex(int index) const; - void setIgnoreLockdown(bool ignore_lockdown) { _ignore_lockdown = ignore_lockdown; } /** @@ -244,11 +237,6 @@ private: param_t failsafe{PARAM_INVALID}; }; - enum class MotorOrdering : int32_t { - PX4 = 0, - Betaflight = 1 - }; - void lock() { do {} while (px4_sem_wait(&_lock) != 0); } void unlock() { px4_sem_post(&_lock); } @@ -319,7 +307,6 @@ private: (ParamInt) _param_mc_airmode, ///< multicopter air-mode (ParamFloat) _param_mot_slew_max, (ParamFloat) _param_thr_mdl_fac, ///< thrust to motor control signal modelling factor - (ParamInt) _param_mot_ordering, (ParamBool) _param_sys_ctrl_alloc ) diff --git a/src/lib/mixer_module/params.c b/src/lib/mixer_module/params.c index 040c77b74b..e54a25eca0 100644 --- a/src/lib/mixer_module/params.c +++ b/src/lib/mixer_module/params.c @@ -16,20 +16,3 @@ * @group Mixer Output */ PARAM_DEFINE_INT32(MC_AIRMODE, 0); - -/** - * Motor Ordering - * - * Determines the motor ordering. This can be used for example in combination with - * a 4-in-1 ESC that assumes a motor ordering which is different from PX4. - * - * ONLY supported for Quads. - * - * When changing this, make sure to test the motor response without props first. - * - * @value 0 PX4 - * @value 1 Betaflight / Cleanflight - * - * @group Mixer Output - */ -PARAM_DEFINE_INT32(MOT_ORDERING, 0);