mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14: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:
parent
5aa8224181
commit
3a3c88cefa
@ -553,7 +553,6 @@ void ConfigInputWidget::updateChannels(UAVObject* controlCommand)
|
||||
field->setValue(0,i);
|
||||
}
|
||||
obj->updated();
|
||||
|
||||
}
|
||||
|
||||
field = controlCommand->getField(QString("Channel"));
|
||||
@ -573,6 +572,22 @@ void ConfigInputWidget::updateChannels(UAVObject* controlCommand)
|
||||
mdata = obj->getMetadata();
|
||||
mdata.flightAccess = UAVObject::ACCESS_READWRITE;
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user