1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Merge branch 'laurent/OP-1764_Rc_input_ranges' into abeck/OP-1764

This commit is contained in:
abeck70 2015-03-09 21:26:20 +11:00
commit d22cb21022
2 changed files with 24 additions and 6 deletions

View File

@ -549,6 +549,8 @@ void ConfigInputWidget::wzNext()
// Force flight mode neutral to middle and Throttle neutral at 4% // Force flight mode neutral to middle and Throttle neutral at 4%
adjustSpecialNeutrals(); adjustSpecialNeutrals();
throttleError = false;
checkThrottleRange();
manualSettingsObj->setData(manualSettingsData); manualSettingsObj->setData(manualSettingsData);
// move to Arming Settings tab // move to Arming Settings tab
@ -1593,6 +1595,7 @@ void ConfigInputWidget::simpleCalibration(bool enable)
ui->saveRCInputToRAM->setEnabled(false); ui->saveRCInputToRAM->setEnabled(false);
ui->saveRCInputToSD->setEnabled(false); ui->saveRCInputToSD->setEnabled(false);
ui->runCalibration->setText(tr("Stop Manual Calibration")); ui->runCalibration->setText(tr("Stop Manual Calibration"));
throttleError = false;
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(tr("<p>Arming Settings are now set to 'Always Disarmed' for your safety.</p>" 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())); connect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration()));
} else { } else {
ui->configurationWizard->setEnabled(true);
ui->saveRCInputToRAM->setEnabled(true);
ui->saveRCInputToSD->setEnabled(true);
ui->runCalibration->setText(tr("Start Manual Calibration"));
manualCommandData = manualCommandObj->getData(); manualCommandData = manualCommandObj->getData();
manualSettingsData = manualSettingsObj->getData(); manualSettingsData = manualSettingsObj->getData();
@ -1641,16 +1639,21 @@ void ConfigInputWidget::simpleCalibration(bool enable)
for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++) { for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++) {
if ((i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) || (i == ManualControlSettings::CHANNELNUMBER_THROTTLE)) { if ((i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) || (i == ManualControlSettings::CHANNELNUMBER_THROTTLE)) {
adjustSpecialNeutrals(); adjustSpecialNeutrals();
checkThrottleRange();
} else { } else {
manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i]; manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i];
} }
} }
manualSettingsObj->setData(manualSettingsData); manualSettingsObj->setData(manualSettingsData);
// Load actuator settings back from beginning of manual calibration // Load actuator settings back from beginning of manual calibration
actuatorSettingsObj->setData(previousActuatorSettingsData); 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())); disconnect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration()));
} }
} }
@ -1671,6 +1674,19 @@ void ConfigInputWidget::adjustSpecialNeutrals()
manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) * 0.04); 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) bool ConfigInputWidget::shouldObjectBeSaved(UAVObject *object)
{ {
// ManualControlCommand no need to be saved // ManualControlCommand no need to be saved

View File

@ -71,6 +71,7 @@ public:
bool shouldObjectBeSaved(UAVObject *object); bool shouldObjectBeSaved(UAVObject *object);
private: private:
bool throttleError;
bool growing; bool growing;
bool reverse[ManualControlSettings::CHANNELNEUTRAL_NUMELEM]; bool reverse[ManualControlSettings::CHANNELNEUTRAL_NUMELEM];
txMovements currentMovement; txMovements currentMovement;
@ -199,6 +200,7 @@ private slots:
void invertControls(); void invertControls();
void simpleCalibration(bool state); void simpleCalibration(bool state);
void adjustSpecialNeutrals(); void adjustSpecialNeutrals();
void checkThrottleRange();
void updateCalibration(); void updateCalibration();
void resetChannelSettings(); void resetChannelSettings();
void resetActuatorSettings(); void resetActuatorSettings();