mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Merge branch 'laurent/OP-1764_Rc_input_ranges' into abeck/OP-1764
This commit is contained in:
commit
d22cb21022
@ -549,6 +549,8 @@ void ConfigInputWidget::wzNext()
|
||||
|
||||
// Force flight mode neutral to middle and Throttle neutral at 4%
|
||||
adjustSpecialNeutrals();
|
||||
throttleError = false;
|
||||
checkThrottleRange();
|
||||
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
// move to Arming Settings tab
|
||||
@ -1593,6 +1595,7 @@ void ConfigInputWidget::simpleCalibration(bool enable)
|
||||
ui->saveRCInputToRAM->setEnabled(false);
|
||||
ui->saveRCInputToSD->setEnabled(false);
|
||||
ui->runCalibration->setText(tr("Stop Manual Calibration"));
|
||||
throttleError = false;
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("<p>Arming Settings are now set to 'Always Disarmed' for your safety.</p>"
|
||||
@ -1628,11 +1631,6 @@ void ConfigInputWidget::simpleCalibration(bool enable)
|
||||
|
||||
connect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration()));
|
||||
} else {
|
||||
ui->configurationWizard->setEnabled(true);
|
||||
ui->saveRCInputToRAM->setEnabled(true);
|
||||
ui->saveRCInputToSD->setEnabled(true);
|
||||
ui->runCalibration->setText(tr("Start Manual Calibration"));
|
||||
|
||||
manualCommandData = manualCommandObj->getData();
|
||||
manualSettingsData = manualSettingsObj->getData();
|
||||
|
||||
@ -1641,16 +1639,21 @@ void ConfigInputWidget::simpleCalibration(bool enable)
|
||||
for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++) {
|
||||
if ((i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) || (i == ManualControlSettings::CHANNELNUMBER_THROTTLE)) {
|
||||
adjustSpecialNeutrals();
|
||||
checkThrottleRange();
|
||||
} else {
|
||||
manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i];
|
||||
}
|
||||
}
|
||||
|
||||
manualSettingsObj->setData(manualSettingsData);
|
||||
|
||||
// Load actuator settings back from beginning of manual calibration
|
||||
actuatorSettingsObj->setData(previousActuatorSettingsData);
|
||||
|
||||
ui->configurationWizard->setEnabled(true);
|
||||
ui->saveRCInputToRAM->setEnabled(true);
|
||||
ui->saveRCInputToSD->setEnabled(true);
|
||||
ui->runCalibration->setText(tr("Start Manual Calibration"));
|
||||
|
||||
disconnect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration()));
|
||||
}
|
||||
}
|
||||
@ -1671,6 +1674,19 @@ void ConfigInputWidget::adjustSpecialNeutrals()
|
||||
manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) * 0.04);
|
||||
}
|
||||
|
||||
void ConfigInputWidget::checkThrottleRange()
|
||||
{
|
||||
if ((abs(manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE] -
|
||||
manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) < 300) && (throttleError == false)) {
|
||||
throttleError = true;
|
||||
QMessageBox::warning(this, tr("Warning"), tr("<p>There is something wrong with Throttle range. Please redo calibration and move <b>ALL sticks</b>, Throttle stick included.</p>"), QMessageBox::Ok);
|
||||
|
||||
// Set Throttle neutral to max value so Throttle can't be positive
|
||||
manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_THROTTLE] =
|
||||
manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE];
|
||||
}
|
||||
}
|
||||
|
||||
bool ConfigInputWidget::shouldObjectBeSaved(UAVObject *object)
|
||||
{
|
||||
// ManualControlCommand no need to be saved
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
bool shouldObjectBeSaved(UAVObject *object);
|
||||
|
||||
private:
|
||||
bool throttleError;
|
||||
bool growing;
|
||||
bool reverse[ManualControlSettings::CHANNELNEUTRAL_NUMELEM];
|
||||
txMovements currentMovement;
|
||||
@ -199,6 +200,7 @@ private slots:
|
||||
void invertControls();
|
||||
void simpleCalibration(bool state);
|
||||
void adjustSpecialNeutrals();
|
||||
void checkThrottleRange();
|
||||
void updateCalibration();
|
||||
void resetChannelSettings();
|
||||
void resetActuatorSettings();
|
||||
|
Loading…
Reference in New Issue
Block a user