Commit fa0c04df authored by Lorenz Meier's avatar Lorenz Meier

Merge branch 'config' of github.com:mavlink/qgroundcontrol into config

parents 001bbc8b fe15fc66
......@@ -1862,7 +1862,8 @@ void UAS::sendMessage(mavlink_message_t message)
{
if (LinkManager::instance()->getLinks().contains(link))
{
sendMessage(link, message);
if (link->isConnected())
sendMessage(link, message);
qDebug() << "SENT MESSAGE id" << message.msgid << "component" << message.compid;
}
else
......
......@@ -11,6 +11,7 @@
UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent) :
QObject(parent),
lastReceiveTime(0),
mav(NULL),
maxSilenceTimeout(30000),
paramDataModel(NULL),
......@@ -254,6 +255,7 @@ void UASParameterCommsMgr::silenceTimerExpired()
int missingReads, missingWrites;
clearRetransmissionLists(missingReads,missingWrites);
silenceTimer.stop();
lastReceiveTime = 0;
lastSilenceTimerReset = curTime;
setParameterStatusMsg(tr("TIMEOUT: Abandoning %1 reads %2 writes after %3 seconds").arg(missingReads).arg(missingWrites).arg(totalElapsed/1000));
}
......@@ -362,14 +364,18 @@ void UASParameterCommsMgr::updateSilenceTimer()
if (missReadCount > 0 || missWriteCount > 0) {
silenceTimer.start(silenceTimeout);
lastSilenceTimerReset = QGC::groundTimeMilliseconds();
if (0 == lastReceiveTime) {
lastReceiveTime = lastSilenceTimerReset;
}
silenceTimer.start(silenceTimeout);
}
else {
//all parameters have been received, broadcast to UI
emit parameterListUpToDate();
resetAfterListReceive();
silenceTimer.stop();
lastReceiveTime = 0;
}
......
......@@ -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,21 @@ 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;
}
// reset all channel mappings above Ch 5 to invalid/unused value before starting calibration
for (unsigned int j= 5; j < chanMappedMax; j++) {
rcMapping[j] = -1;
}
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 +464,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 +493,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 +1242,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 +1374,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