warnMsgBox.setText(tr("Attitude trim denied during RC calibration"));
warnMsgBox.setInformativeText(tr("Please end the RC calibration before doing attitude trim."));
warnMsgBox.setStandardButtons(QMessageBox::Ok);
warnMsgBox.setDefaultButton(QMessageBox::Ok);
(void)warnMsgBox.exec();
}
// Not aborted, but warn user
msgBox.setText(tr("Confirm Attitude Trim"));
msgBox.setInformativeText(tr("On clicking OK, the current Roll / Pitch / Yaw stick positions will be set as trim values in auto flight. Do NOT reset your trim values after this step."));
msgBox.setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel);//allow user to cancel upload after reviewing values
tr("Is the RC receiver connected and transmitter turned on? Detected %1 radio channels. To operate PX4, you need at least 5 channels. ").arg(chanCount));
ui->rcCalibrationButton->setChecked(false);
return;
}
// XXX magic number: Set to 1 for radio input disable
mav->startRadioControlCalibration(1);
// reset all channel mappings above Ch 5 to invalid/unused value before starting calibration
for(unsignedintj=5;j<chanMappedMax;j++){
rcMapping[j]=-1;
}
configEnabled=true;
QMessageBox::warning(0,tr("Safety Warning"),
tr("Starting RC calibration.\n\nEnsure RC transmitter and receiver are powered and connected. It is recommended to disconnect all motors for additional safety, however, the system is designed to not arm during the calibration.\n\nReset transmitter trims to center, then click OK to continue"));
//go ahead and try to map first 8 channels, now that user can skip channels
for(inti=0;i<8;i++){
identifyChannelMapping(i);
}
//QMessageBox::information(0,"Information","Additional channels have not been mapped, but can be mapped in the channel table below.");
msgBox.setText(tr("Please center the throttle stick"));
msgBox.setInformativeText(tr("The stick should be roughly centered - the exact position is not relevant."));
msgBox.setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel);//allow user to cancel upload after reviewing values
intmsgBoxResult=msgBox.exec();
if(QMessageBox::Cancel==msgBoxResult){
return;// abort
}
}
// Try to identify inverted channels, but only for R/P/Y/T
for(inti=0;i<4;i++){
detectChannelInversion(i);
}
QMessageBox::information(0,"Trims","Ensure THROTTLE is in the LOW THROTTLE / MOTOR OFF position and roll / pitch / yaw are CENTERED. Click OK to continue");
QStringstatusstr=tr("The calibration has been finished. Please click OK to upload it to the autopilot.");
// statusstr = tr("This is the RC calibration information that will be sent to the autopilot if you click OK. To prevent transmission, click Cancel.");
// statusstr += tr(" Normal values range from 1000 to 2000, with disconnected channels reading 1000, 1500, 2000\n\n");