mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
delete MOT_ORDERING
This commit is contained in:
parent
a7bbcd5b04
commit
72efe84b80
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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<uint16_t>(_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;
|
||||
}
|
||||
|
||||
@ -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<px4::params::MC_AIRMODE>) _param_mc_airmode, ///< multicopter air-mode
|
||||
(ParamFloat<px4::params::MOT_SLEW_MAX>) _param_mot_slew_max,
|
||||
(ParamFloat<px4::params::THR_MDL_FAC>) _param_thr_mdl_fac, ///< thrust to motor control signal modelling factor
|
||||
(ParamInt<px4::params::MOT_ORDERING>) _param_mot_ordering,
|
||||
(ParamBool<px4::params::SYS_CTRL_ALLOC>) _param_sys_ctrl_alloc
|
||||
|
||||
)
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user