1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

OP-1526 Better fix : if ReverseAllMotors is checked, store MixerValueYaw as negative value.

This commit is contained in:
Laurent Lalanne 2014-10-06 10:46:20 +02:00
parent 58ff8aae02
commit 46e089fded

View File

@ -460,20 +460,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
// Now, read mixing values stored on board and applies values on sliders.
m_aircraft->mrPitchMixLevel->setValue(getMixerValue(mixer, "MixerValuePitch"));
m_aircraft->mrRollMixLevel->setValue(getMixerValue(mixer, "MixerValueRoll"));
m_aircraft->mrYawMixLevel->setValue(getMixerValue(mixer, "MixerValueYaw"));
// check sign from Yaw mixer value (positive unreversed / negative reversed)
// and apply Yaw value stored on board
int channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
if (channel > -1) {
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
if (value > 0) {
// MixerValueYaw : negative = reversed
setYawMixLevel(getMixerValue(mixer, "MixerValueYaw"));
} else {
setYawMixLevel(-getMixerValue(mixer, "MixerValueYaw"));
}
}
updateAirframe(frameType);
}
@ -736,7 +725,8 @@ QString ConfigMultiRotorWidget::updateConfigObjectsFromWidgets()
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
// Tricopter : Yaw mix slider value applies to servo (was fixed)
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, getMixerValue(mixer, "MixerValueYaw") * 1.27);
// Get absolute MixerValueYaw, no servo reverse when Reverse All Motors is checked
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, abs(getMixerValue(mixer, "MixerValueYaw")) * 1.27);
}
m_aircraft->mrStatusLabel->setText(tr("Configuration OK"));
@ -1039,7 +1029,9 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
setMixerValue(mixer, "MixerValueRoll", m_aircraft->mrRollMixLevel->value());
setMixerValue(mixer, "MixerValuePitch", m_aircraft->mrPitchMixLevel->value());
setMixerValue(mixer, "MixerValueYaw", m_aircraft->mrYawMixLevel->value());
// Store negative value if ReverseAllMotors is checked
setMixerValue(mixer, "MixerValueYaw", m_aircraft->mrYawMixLevel->value() * (invertMotors ? -1.0 : 1.0));
QList<QComboBox *> mmList;
mmList << m_aircraft->multiMotorChannelBox1 << m_aircraft->multiMotorChannelBox2