1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

GCS-Airframe config

Fixes rounding issues. Needs TESTING.
This commit is contained in:
PT_Dreamer 2012-10-14 13:15:09 +01:00
parent 731ac9bc48
commit 30959b460d

View File

@ -579,14 +579,14 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
if (channel > -1)
{
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( value/1.27 );
m_aircraft->mrPitchMixLevel->setValue( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( 1-value/1.27 );
setYawMixLevel( -qRound(value/1.27) );
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( -value/1.27);
m_aircraft->mrRollMixLevel->setValue( -qRound(value/1.27));
}
}
@ -605,13 +605,13 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
if (channel > -1)
{
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( value/1.27 );
m_aircraft->mrPitchMixLevel->setValue( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( 1-value/1.27 );
setYawMixLevel( -qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( value/1.27);
m_aircraft->mrRollMixLevel->setValue( qRound(value/1.27));
}
@ -635,15 +635,15 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
if (channel > -1)
{
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
m_aircraft->mrPitchMixLevel->setValue( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( floor(-value/1.27) );
setYawMixLevel( -qRound(value/1.27) );
//change channels
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) );
m_aircraft->mrRollMixLevel->setValue( -qRound(value/1.27) );
}
@ -668,14 +668,14 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
if (channel > -1)
{
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
m_aircraft->mrPitchMixLevel->setValue( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( floor(-value/1.27) );
setYawMixLevel( -qRound(value/1.27) );
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) );
m_aircraft->mrRollMixLevel->setValue( -qRound(value/1.27) );
}
}
else if (frameType == "HexaCoax")
@ -696,14 +696,14 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
if (channel > -1)
{
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( 2*value/1.27 );
m_aircraft->mrPitchMixLevel->setValue( qRound(2*value/1.27) );
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( value/1.27 );
setYawMixLevel( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( value/1.27);
m_aircraft->mrRollMixLevel->setValue( qRound(value/1.27) );
}
}
else if (frameType == "Octo" || frameType == "OctoV" || frameType == "OctoCoaxP")
@ -727,39 +727,39 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
{
if (frameType == "Octo") {
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
m_aircraft->mrPitchMixLevel->setValue( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( floor(-value/1.27) );
setYawMixLevel( -qRound(value/1.27) );
//change channels
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(-value/1.27) );
m_aircraft->mrRollMixLevel->setValue( -qRound(value/1.27) );
}
else if (frameType == "OctoV") {
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
m_aircraft->mrPitchMixLevel->setValue( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( floor(-value/1.27) );
setYawMixLevel( -qRound(value/1.27) );
//change channels
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(-value/1.27) );
m_aircraft->mrRollMixLevel->setValue( -qRound(value/1.27) );
}
else if (frameType == "OctoCoaxP") {
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
m_aircraft->mrPitchMixLevel->setValue( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( floor(-value/1.27) );
setYawMixLevel( -qRound(value/1.27) );
//change channels
channel = m_aircraft->multiMotorChannelBox3->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(-value/1.27) );
m_aircraft->mrRollMixLevel->setValue( -qRound(value/1.27) );
}
}
@ -784,13 +784,13 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
if (channel > -1)
{
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
m_aircraft->mrPitchMixLevel->setValue( qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
setYawMixLevel( floor(-value/1.27) );
setYawMixLevel( -qRound(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) );
m_aircraft->mrRollMixLevel->setValue( qRound(value/1.27) );
}
}
else if (frameType == "Tri")
@ -807,10 +807,10 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
if (channel > -1)
{
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
m_aircraft->mrPitchMixLevel->setValue( floor(2*value/1.27) );
m_aircraft->mrPitchMixLevel->setValue( qRound(2*value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) );
m_aircraft->mrRollMixLevel->setValue( qRound(value/1.27) );
}
}