Commit dd47752a authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #362 from tstellanova/qgc_beta01

Avoid transmit problems by not attempting to send on disconnected links
parents e72fe25a 9d6c1ddc
......@@ -1862,6 +1862,7 @@ void UAS::sendMessage(mavlink_message_t message)
{
if (LinkManager::instance()->getLinks().contains(link))
{
if (link->isConnected())
sendMessage(link, message);
qDebug() << "SENT MESSAGE id" << message.msgid << "component" << message.compid;
}
......
......@@ -300,11 +300,10 @@ void QGCPX4VehicleConfig::identifyChannelMapping(int aert_index)
}
}
msgBox.setText(tr("Identifying %1 channel").arg(channelNames[channelWanted]));
msgBox.setInformativeText(tr("Please move stick, switch or potentiometer for the %1 channel\n all the way up/down or left/right.").arg(channelNames[channelWanted]));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("Detecting %1 ...\t\t").arg(channelNames[channelWanted]));
msgBox.setInformativeText(tr("Please move stick, switch or potentiometer for this channel all the way up/down or left/right."));
msgBox.setStandardButtons(QMessageBox::NoButton);
skipActionButton = msgBox.addButton(tr("Skip"),QMessageBox::RejectRole);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
skipActionButton->hide();
msgBox.removeButton(skipActionButton);
......@@ -404,11 +403,10 @@ void QGCPX4VehicleConfig::detectChannelInversion(int aert_index)
instructions << "AUX1: Push down / towards you or turn dial to the leftmost position";
instructions << "AUX2: Push down / towards you or turn dial to the leftmost position";
msgBox.setText(tr("Identifying DIRECTION of %1 channel").arg(channelNames[channelReverseStateWanted]));
msgBox.setText(tr("%1 Direction").arg(channelNames[channelReverseStateWanted]));
msgBox.setInformativeText(tr("%2").arg((aert_index < instructions.length()) ? instructions[aert_index] : ""));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setStandardButtons(QMessageBox::NoButton);
skipActionButton = msgBox.addButton(tr("Skip"),QMessageBox::RejectRole);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
skipActionButton->hide();
msgBox.removeButton(skipActionButton);
......@@ -422,12 +420,16 @@ void QGCPX4VehicleConfig::detectChannelInversion(int aert_index)
void QGCPX4VehicleConfig::startCalibrationRC()
{
if (chanCount < 5) {
QMessageBox::warning(0,tr("Warning! Not enough RC channels"), tr("Detected %1 radio channels. To operate PX4, you need at least 5 channels. Is the radio control connected?").arg(chanCount));
QMessageBox::warning(0,
tr("RC not Connected"),
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));
return;
}
configEnabled = true;
QMessageBox::warning(0,"Warning!","You are about to start radio calibration.\nPlease ensure all motor power is disconnected AND all props are removed from the vehicle.\nAlso ensure transmitter and receiver are powered and connected.\nRESET ALL TRIMS TO CENTER!\n\nDo not move the RC sticks, then click OK to confirm");
QMessageBox::warning(0,tr("Safety Warning"),
tr("Starting RC calibration.\n\nEnsure that motor power is disconnected, all props are removed, RC transmitter and receiver are powered and connected.\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 (int i = 0; i < 8; i++) {
......@@ -457,7 +459,7 @@ void QGCPX4VehicleConfig::startCalibrationRC()
void QGCPX4VehicleConfig::stopCalibrationRC()
{
QMessageBox::information(0,"Trims","Ensure all sticks are centeres and throttle is in the downmost position, click OK to continue");
QMessageBox::information(0,"Trims","Ensure all controls are centered and throttle is in the lowest position. Click OK to continue");
calibrationEnabled = false;
configEnabled = false;
......@@ -486,10 +488,10 @@ void QGCPX4VehicleConfig::stopCalibrationRC()
setTrimPositions();
QString statusstr;
statusstr = "Below you will find the detected radio calibration information that will be sent to the autopilot\n";
statusstr += "Normal values are around 1100 to 1900, with disconnected channels reading 1000, 1500, 2000\n\n";
statusstr += "Channel\tMin\tCenter\tMax\n";
statusstr += "--------------------\n";
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");
statusstr += tr("Channel\tMin\tCenter\tMax\n");
statusstr += "-------\t---\t------\t---\n";
for (unsigned int i=0; i < chanCount; i++) {
statusstr += QString::number(i) +"\t"+ QString::number(rcMin[i]) +"\t"+ QString::number(rcValue[i]) +"\t"+ QString::number(rcMax[i]) +"\n";
}
......@@ -1235,10 +1237,13 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval)
channelWanted = -1;
// Confirm found channel
msgBox.setText(tr("%1 Channel found.").arg(channelNames[chanFound]));
msgBox.setInformativeText(tr("Found %1 to be on the raw RC channel %2").arg(channelNames[chanFound]).arg(chan + 1));
msgBox.setText(tr("Found %1 \t\t").arg(channelNames[chanFound]));
msgBox.setInformativeText(tr("Assigned raw RC channel %2").arg(chan + 1));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
skipActionButton->hide();
msgBox.removeButton(skipActionButton);
(void)msgBox.exec();
// XXX fuse with parameter update handling
......@@ -1364,17 +1369,19 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval)
channelReverseStateWanted = -1;
// Confirm found channel
msgBox.setText(tr("Direction of %1 Channel assigned").arg(channelNames[currRevFunc]));
msgBox.setInformativeText(tr("%1").arg((rcRev[rcMapping[currRevFunc]]) ? "Reversed channel." : "Did not reverse channel."));
msgBox.setText(tr("%1 direction assigned").arg(channelNames[currRevFunc]));
msgBox.setInformativeText(tr("%1").arg((rcRev[rcMapping[currRevFunc]]) ? tr("Reversed channel.") : tr("Did not reverse channel.") ));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
skipActionButton->hide();
msgBox.removeButton(skipActionButton);
(void)msgBox.exec();
}
}
dataModelChanged = true;
qDebug() << "RC CHAN:" << chan << "PPM:" << fval << "NORMALIZED:" << normalized;
//qDebug() << "RC CHAN:" << chan << "PPM:" << fval << "NORMALIZED:" << normalized;
}
void QGCPX4VehicleConfig::updateAllInvertedCheckboxes()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment