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

OP-1660 Reset channel data : Type and number. Prevent bad channel setting like channel type set and no channel number or wizard freezes.

This commit is contained in:
Laurent Lalanne 2014-12-29 01:07:11 +01:00
parent 9e91c83c60
commit 64cea89d3e
3 changed files with 16 additions and 0 deletions

View File

@ -412,6 +412,9 @@ void ConfigInputWidget::goToWizard()
flightModeSettingsData.Arming = FlightModeSettings::ARMING_ALWAYSDISARMED;
flightModeSettingsObj->setData(flightModeSettingsData);
// Now reset channel settings
resetChannelSettings();
// Use faster input update rate.
fastMdata();
@ -1661,3 +1664,14 @@ bool ConfigInputWidget::shouldObjectBeSaved(UAVObject *object)
// ManualControlCommand no need to be saved
return dynamic_cast<ManualControlCommand *>(object) == 0;
}
void ConfigInputWidget::resetChannelSettings()
{
manualSettingsData = manualSettingsObj->getData();
// Clear all channel data : Channel Type (PPM,PWM..) and Number
for (unsigned int channel = 0; channel < 9; channel++) {
manualSettingsData.ChannelGroups[channel] = ManualControlSettings::CHANNELGROUPS_NONE;
manualSettingsData.ChannelNumber[channel] = 0;
manualSettingsObj->setData(manualSettingsData);
}
}

View File

@ -192,6 +192,7 @@ private slots:
void simpleCalibration(bool state);
void adjustSpecialNeutrals();
void updateCalibration();
void resetChannelSettings();
protected:
void resizeEvent(QResizeEvent *event);

View File

@ -61,6 +61,7 @@ void InputChannelForm::minMaxUpdated()
void InputChannelForm::updateTooltip()
{
int currentValue = ui->channelNeutral->value();
ui->channelNeutral->setToolTip(QString::number(currentValue));
}