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

OP-522: When you unchecked Run Calibration it forces the Throttle neutral to 5%

of the range and the FlightMode to 50%.

Sorry there's also some indentation changes mixed into this patch.
This commit is contained in:
James Cotton 2011-06-08 12:21:43 -05:00
parent 5aa8224181
commit 3a3c88cefa

View File

@ -553,7 +553,6 @@ void ConfigInputWidget::updateChannels(UAVObject* controlCommand)
field->setValue(0,i); field->setValue(0,i);
} }
obj->updated(); obj->updated();
} }
field = controlCommand->getField(QString("Channel")); field = controlCommand->getField(QString("Channel"));
@ -573,6 +572,22 @@ void ConfigInputWidget::updateChannels(UAVObject* controlCommand)
mdata = obj->getMetadata(); mdata = obj->getMetadata();
mdata.flightAccess = UAVObject::ACCESS_READWRITE; mdata.flightAccess = UAVObject::ACCESS_READWRITE;
obj->setMetadata(mdata); obj->setMetadata(mdata);
// Set some slider values to better defaults
ManualControlSettings * manualSettings = ManualControlSettings::GetInstance(getObjectManager());
ManualControlSettings::DataFields manualSettingsData = manualSettings->getData();
uint throttleIndex = manualSettingsData.Throttle;
uint flightModeIndex = manualSettingsData.FlightMode;
if(throttleIndex < manualSettings->THROTTLE_NONE) {
// Throttle neutral defaults to 5% of range
manualSettingsData.ChannelNeutral[throttleIndex] = 0.05 * (manualSettingsData.ChannelMax[throttleIndex] - manualSettingsData.ChannelMin[throttleIndex]) + manualSettingsData.ChannelMin[throttleIndex];
qDebug() << manualSettingsData.ChannelNeutral[throttleIndex];
}
if(flightModeIndex < manualSettings->FLIGHTMODE_NONE) {
// Flight mode neutral defaults to 50% of range
manualSettingsData.ChannelNeutral[flightModeIndex] = 0.5 * (manualSettingsData.ChannelMax[flightModeIndex] - manualSettingsData.ChannelMin[flightModeIndex]) + manualSettingsData.ChannelMin[flightModeIndex];
}
manualSettings->setData(manualSettingsData);
} }
firstUpdate = true; firstUpdate = true;
} }