Commit a4d7f100 authored by Lorenz Meier's avatar Lorenz Meier

Completely overhauled RC config, automated *everything*

parent 15032b1b
...@@ -39,17 +39,21 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -39,17 +39,21 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
mav(NULL), mav(NULL),
chanCount(0), chanCount(0),
channelWanted(-1), channelWanted(-1),
channelReverseStateWanted(-1),
rcRoll(0.0f), rcRoll(0.0f),
rcPitch(0.0f), rcPitch(0.0f),
rcYaw(0.0f), rcYaw(0.0f),
rcThrottle(0.0f), rcThrottle(0.0f),
rcMode(0.0f), rcMode(0.0f),
rcAssist(0.0f),
rcMission(0.0f),
rcReturn(0.0f),
rcFlaps(0.0f),
rcAux1(0.0f), rcAux1(0.0f),
rcAux2(0.0f), rcAux2(0.0f),
rcAux3(0.0f),
dataModelChanged(true), dataModelChanged(true),
rc_mode(RC_MODE_NONE),
calibrationEnabled(false), calibrationEnabled(false),
configEnabled(false),
px4AirframeConfig(NULL), px4AirframeConfig(NULL),
#ifdef QUPGRADE_SUPPORT #ifdef QUPGRADE_SUPPORT
firmwareDialog(NULL), firmwareDialog(NULL),
...@@ -62,14 +66,19 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -62,14 +66,19 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
channelNames << "Pitch / Elevator"; channelNames << "Pitch / Elevator";
channelNames << "Yaw / Rudder"; channelNames << "Yaw / Rudder";
channelNames << "Throttle"; channelNames << "Throttle";
channelNames << "SW1 / Main Mode Switch"; channelNames << "Main Mode Switch";
channelNames << "SW2 / Sub Mode Switch"; channelNames << "Assist Switch";
channelNames << "Aux1 / Flaps"; channelNames << "Mission Switch";
channelNames << "Return Switch";
channelNames << "Flaps";
channelNames << "Aux1";
channelNames << "Aux2"; channelNames << "Aux2";
channelNames << "Aux3"; channelNames << "Aux3";
channelNames << "Aux4"; channelNames << "Aux4";
channelNames << "Aux5"; channelNames << "Aux5";
channelNames << "Aux6"; channelNames << "Aux6";
channelNames << "Aux7";
channelNames << "Aux8";
setObjectName("QGC_VEHICLECONFIG"); setObjectName("QGC_VEHICLECONFIG");
ui->setupUi(this); ui->setupUi(this);
...@@ -116,6 +125,9 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -116,6 +125,9 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
connect(ui->firmwareMenuButton, SIGNAL(clicked()), connect(ui->firmwareMenuButton, SIGNAL(clicked()),
this, SLOT(firmwareMenuButtonClicked())); this, SLOT(firmwareMenuButtonClicked()));
connect(ui->advancedCheckBox, SIGNAL(clicked(bool)), ui->advancedGroupBox, SLOT(setVisible(bool)));
ui->advancedGroupBox->setVisible(false);
ui->rcCalibrationButton->setCheckable(true); ui->rcCalibrationButton->setCheckable(true);
connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool))); connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool)));
connect(ui->writeButton, SIGNAL(clicked()), connect(ui->writeButton, SIGNAL(clicked()),
...@@ -138,9 +150,12 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -138,9 +150,12 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
connect(ui->yawSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setYawChan(int))); connect(ui->yawSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setYawChan(int)));
connect(ui->throttleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setThrottleChan(int))); connect(ui->throttleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setThrottleChan(int)));
connect(ui->modeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setModeChan(int))); connect(ui->modeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setModeChan(int)));
connect(ui->assistSwSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAssistChan(int)));
connect(ui->missionSwSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMissionChan(int)));
connect(ui->returnSwSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setReturnChan(int)));
connect(ui->flapsSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setFlapsChan(int)));
connect(ui->aux1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux1Chan(int))); connect(ui->aux1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux1Chan(int)));
connect(ui->aux2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux2Chan(int))); connect(ui->aux2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux2Chan(int)));
connect(ui->aux3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux3Chan(int)));
// Connect RC reverse assignments // Connect RC reverse assignments
connect(ui->invertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setRollInverted(bool))); connect(ui->invertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setRollInverted(bool)));
...@@ -148,16 +163,22 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -148,16 +163,22 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
connect(ui->invertCheckBox_3, SIGNAL(clicked(bool)), this, SLOT(setYawInverted(bool))); connect(ui->invertCheckBox_3, SIGNAL(clicked(bool)), this, SLOT(setYawInverted(bool)));
connect(ui->invertCheckBox_4, SIGNAL(clicked(bool)), this, SLOT(setThrottleInverted(bool))); connect(ui->invertCheckBox_4, SIGNAL(clicked(bool)), this, SLOT(setThrottleInverted(bool)));
connect(ui->invertCheckBox_5, SIGNAL(clicked(bool)), this, SLOT(setModeInverted(bool))); connect(ui->invertCheckBox_5, SIGNAL(clicked(bool)), this, SLOT(setModeInverted(bool)));
connect(ui->invertCheckBox_6, SIGNAL(clicked(bool)), this, SLOT(setAux1Inverted(bool))); connect(ui->assistSwInvertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setAssistInverted(bool)));
connect(ui->invertCheckBox_7, SIGNAL(clicked(bool)), this, SLOT(setAux2Inverted(bool))); connect(ui->missionSwInvertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setMissionInverted(bool)));
connect(ui->invertCheckBox_8, SIGNAL(clicked(bool)), this, SLOT(setAux3Inverted(bool))); connect(ui->returnSwInvertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setReturnInverted(bool)));
connect(ui->flapsInvertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setFlapsInverted(bool)));
connect(ui->aux1InvertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setAux1Inverted(bool)));
connect(ui->aux2InvertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setAux2Inverted(bool)));
connect(ui->rollButton, SIGNAL(clicked()), this, SLOT(identifyRollChannel())); connect(ui->rollButton, SIGNAL(clicked()), this, SLOT(identifyRollChannel()));
connect(ui->pitchButton, SIGNAL(clicked()), this, SLOT(identifyPitchChannel())); connect(ui->pitchButton, SIGNAL(clicked()), this, SLOT(identifyPitchChannel()));
connect(ui->yawButton, SIGNAL(clicked()), this, SLOT(identifyYawChannel())); connect(ui->yawButton, SIGNAL(clicked()), this, SLOT(identifyYawChannel()));
connect(ui->throttleButton, SIGNAL(clicked()), this, SLOT(identifyThrottleChannel())); connect(ui->throttleButton, SIGNAL(clicked()), this, SLOT(identifyThrottleChannel()));
connect(ui->modeButton, SIGNAL(clicked()), this, SLOT(identifyModeChannel())); connect(ui->modeButton, SIGNAL(clicked()), this, SLOT(identifyModeChannel()));
connect(ui->subButton, SIGNAL(clicked()), this, SLOT(identifySubModeChannel())); connect(ui->assistSwButton, SIGNAL(clicked()), this, SLOT(identifyAssistChannel()));
connect(ui->missionSwButton, SIGNAL(clicked()), this, SLOT(identifyMissionChannel()));
connect(ui->returnSwButton, SIGNAL(clicked()), this, SLOT(identifyReturnChannel()));
connect(ui->flapsButton, SIGNAL(clicked()), this, SLOT(identifyFlapsChannel()));
connect(ui->aux1Button, SIGNAL(clicked()), this, SLOT(identifyAux1Channel())); connect(ui->aux1Button, SIGNAL(clicked()), this, SLOT(identifyAux1Channel()));
connect(ui->aux2Button, SIGNAL(clicked()), this, SLOT(identifyAux2Channel())); connect(ui->aux2Button, SIGNAL(clicked()), this, SLOT(identifyAux2Channel()));
connect(ui->persistRcValuesButt,SIGNAL(clicked()), this, SLOT(writeCalibrationRC())); connect(ui->persistRcValuesButt,SIGNAL(clicked()), this, SLOT(writeCalibrationRC()));
...@@ -165,10 +186,26 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -165,10 +186,26 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
//set rc values to defaults //set rc values to defaults
for (unsigned int i = 0; i < chanMax; i++) { for (unsigned int i = 0; i < chanMax; i++) {
rcValue[i] = UINT16_MAX; rcValue[i] = UINT16_MAX;
rcValueReversed[i] = UINT16_MAX;
rcMapping[i] = i; rcMapping[i] = i;
rcToFunctionMapping[i] = i;
channelWantedList[i] = (float)UINT16_MAX;//TODO need to clean these up! channelWantedList[i] = (float)UINT16_MAX;//TODO need to clean these up!
rcMin[i] = 1000.0f; rcMin[i] = 1000.0f;
rcMax[i] = 2000.0f; rcMax[i] = 2000.0f;
// Mapping not established here, so can't pick values via mapping yet!
rcMappedMin[i] = 1000;
rcMappedMax[i] = 2000;
rcMappedValue[i] = UINT16_MAX;
rcMappedNormalizedValue[i] = 0.0f;
}
for (unsigned int i = chanMax -1; i < chanMappedMax; i++) {
rcMapping[i] = -1;
rcMappedMin[i] = 1000;
rcMappedMax[i] = 2000;
rcMappedValue[i] = UINT16_MAX;
rcMappedNormalizedValue[i] = 0.0f;
} }
updateTimer.setInterval(150); updateTimer.setInterval(150);
...@@ -214,7 +251,7 @@ void QGCPX4VehicleConfig::firmwareMenuButtonClicked() ...@@ -214,7 +251,7 @@ void QGCPX4VehicleConfig::firmwareMenuButtonClicked()
void QGCPX4VehicleConfig::identifyChannelMapping(int aert_index) void QGCPX4VehicleConfig::identifyChannelMapping(int aert_index)
{ {
if (chanCount == 0) if (chanCount == 0 || aert_index < 0)
return; return;
int oldmapping = rcMapping[aert_index]; int oldmapping = rcMapping[aert_index];
...@@ -245,17 +282,6 @@ void QGCPX4VehicleConfig::identifyChannelMapping(int aert_index) ...@@ -245,17 +282,6 @@ void QGCPX4VehicleConfig::identifyChannelMapping(int aert_index)
} }
void QGCPX4VehicleConfig::setRCModeIndex(int newRcMode)
{
newRcMode += 1; //promote from an index to a mode enum
if (newRcMode > 0 && newRcMode < 5) {
rc_mode = (enum RC_MODE) (newRcMode);
dataModelChanged = true;
}
}
void QGCPX4VehicleConfig::toggleCalibrationRC(bool enabled) void QGCPX4VehicleConfig::toggleCalibrationRC(bool enabled)
{ {
if (enabled) if (enabled)
...@@ -274,10 +300,11 @@ void QGCPX4VehicleConfig::setTrimPositions() ...@@ -274,10 +300,11 @@ void QGCPX4VehicleConfig::setTrimPositions()
int pitchMap = rcMapping[1]; int pitchMap = rcMapping[1];
int yawMap = rcMapping[2]; int yawMap = rcMapping[2];
int throttleMap = rcMapping[3]; int throttleMap = rcMapping[3];
int modeSwMap = rcMapping[4];
int aux1Map = rcMapping[5]; // Reset all trims, as some might not be touched
int aux2Map = rcMapping[6]; for (unsigned i = 0; i < chanCount; i++) {
int aux3Map = rcMapping[7]; rcTrim[i] = 1500;
}
// Set trim to min if stick is close to min // Set trim to min if stick is close to min
if (abs(rcValue[throttleMap] - rcMin[throttleMap]) < 100) { if (abs(rcValue[throttleMap] - rcMin[throttleMap]) < 100) {
...@@ -302,28 +329,79 @@ void QGCPX4VehicleConfig::setTrimPositions() ...@@ -302,28 +329,79 @@ void QGCPX4VehicleConfig::setTrimPositions()
rcTrim[pitchMap] = rcValue[pitchMap]; // pitch rcTrim[pitchMap] = rcValue[pitchMap]; // pitch
rcTrim[yawMap] = rcValue[yawMap]; // yaw rcTrim[yawMap] = rcValue[yawMap]; // yaw
rcTrim[modeSwMap] = ((rcMax[modeSwMap] - rcMin[modeSwMap]) / 2.0f) + rcMin[modeSwMap]; // mode sw // Mode switch and optional modes, might not be mapped (== -1)
rcTrim[aux1Map] = ((rcMax[aux1Map] - rcMin[aux1Map]) / 2.0f) + rcMin[aux1Map]; // aux 1 for (unsigned i = 4; i < chanMappedMax; i++) {
rcTrim[aux2Map] = ((rcMax[aux2Map] - rcMin[aux2Map]) / 2.0f) + rcMin[aux2Map]; // aux 2 if (rcMapping[i] >= 0 && rcMapping[i] < (int)chanCount) {
rcTrim[aux3Map] = ((rcMax[aux3Map] - rcMin[aux3Map]) / 2.0f) + rcMin[aux3Map]; // aux 3 rcTrim[rcMapping[i]] = ((rcMax[rcMapping[i]] - rcMin[rcMapping[i]]) / 2.0f) + rcMin[rcMapping[i]];
} else if (rcMapping[i] != -1){
qDebug() << "RC MAPPING FAILED #" << i << "VAL:" << rcMapping[i];
}
}
} }
void QGCPX4VehicleConfig::detectChannelInversion() void QGCPX4VehicleConfig::detectChannelInversion(int aert_index)
{ {
if (chanCount == 0 || aert_index < 0 || aert_index >= (int)chanMappedMax)
return;
bool oldstatus = rcRev[rcMapping[aert_index]];
channelReverseStateWanted = aert_index;
// Reset search list
for (unsigned i = 0; i < chanMax; i++) {
if (i >= chanCount) {
channelReverseStateWantedList[i] = 0;
}
else {
channelReverseStateWantedList[i] = rcValue[i];
}
}
QStringList instructions;
instructions << "ROLL: Move stick left";
instructions << "PITCH: Move stick up";
instructions << "YAW: Move stick left";
instructions << "THROTTLE: Move stick down";
instructions << "MODE SWITCH: Push down / towards you";
instructions << "ASSISTED SWITCH: Push down / towards you";
instructions << "MISSION SWITCH: Push down / towards you";
instructions << "RETURN SWITCH: Push down / towards you";
instructions << "FLAPS: Push down / towards you or turn dial to the leftmost position";
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.setInformativeText(tr("%2").arg((aert_index < instructions.length()) ? instructions[aert_index] : ""));
msgBox.setStandardButtons(QMessageBox::Ok);
skipActionButton = msgBox.addButton(tr("Skip"),QMessageBox::RejectRole);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
skipActionButton->hide();
msgBox.removeButton(skipActionButton);
if (msgBox.clickedButton() == skipActionButton ){
channelReverseStateWanted = -1;
rcRev[rcMapping[aert_index]] = oldstatus;
}
skipActionButton = NULL;
} }
void QGCPX4VehicleConfig::startCalibrationRC() void QGCPX4VehicleConfig::startCalibrationRC()
{ {
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\n\nDo not move the RC sticks, then click OK to confirm"); 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");
//go ahead and try to map first 8 channels, now that user can skip channels //go ahead and try to map first 8 channels, now that user can skip channels
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
identifyChannelMapping(i); identifyChannelMapping(i);
} }
//QMessageBox::information(0,"Information","Additional channels have not been mapped, but can be mapped in the channel table below."); // Try to identify inverted channels, but only for R/P/Y/T
for (int i = 0; i < 4; i++) {
detectChannelInversion(i);
}
//QMessageBox::information(0,"Information","Additional channels have not been mapped, but can be mapped in the channel table below.");
configEnabled = false;
QMessageBox::information(0,"Information","Click OK, then move all sticks to their extreme positions, watching the min/max values to ensure you get the most range from your controller. This includes all switches"); QMessageBox::information(0,"Information","Click OK, then move all sticks to their extreme positions, watching the min/max values to ensure you get the most range from your controller. This includes all switches");
ui->rcCalibrationButton->setText(tr("Save RC Calibration")); ui->rcCalibrationButton->setText(tr("Save RC Calibration"));
resetCalibrationRC(); resetCalibrationRC();
...@@ -343,6 +421,7 @@ void QGCPX4VehicleConfig::stopCalibrationRC() ...@@ -343,6 +421,7 @@ 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 sticks are centeres and throttle is in the downmost position, click OK to continue");
calibrationEnabled = false; calibrationEnabled = false;
configEnabled = false;
ui->rcCalibrationButton->setText(tr("Start RC Calibration")); ui->rcCalibrationButton->setText(tr("Start RC Calibration"));
ui->rollWidget->hideMinMax(); ui->rollWidget->hideMinMax();
...@@ -1109,9 +1188,12 @@ void QGCPX4VehicleConfig::writeCalibrationRC() ...@@ -1109,9 +1188,12 @@ void QGCPX4VehicleConfig::writeCalibrationRC()
paramMgr->setPendingParam(0, "RC_MAP_YAW", (int32_t)(rcMapping[2]+1)); paramMgr->setPendingParam(0, "RC_MAP_YAW", (int32_t)(rcMapping[2]+1));
paramMgr->setPendingParam(0, "RC_MAP_THROTTLE", (int32_t)(rcMapping[3]+1)); paramMgr->setPendingParam(0, "RC_MAP_THROTTLE", (int32_t)(rcMapping[3]+1));
paramMgr->setPendingParam(0, "RC_MAP_MODE_SW", (int32_t)(rcMapping[4]+1)); paramMgr->setPendingParam(0, "RC_MAP_MODE_SW", (int32_t)(rcMapping[4]+1));
paramMgr->setPendingParam(0, "RC_MAP_AUX1", (int32_t)(rcMapping[5]+1)); paramMgr->setPendingParam(0, "RC_MAP_ASSIST_SW", (int32_t)(rcMapping[5]+1));
paramMgr->setPendingParam(0, "RC_MAP_AUX2", (int32_t)(rcMapping[6]+1)); paramMgr->setPendingParam(0, "RC_MAP_MISSIO_SW", (int32_t)(rcMapping[6]+1));
paramMgr->setPendingParam(0, "RC_MAP_AUX3", (int32_t)(rcMapping[7]+1)); paramMgr->setPendingParam(0, "RC_MAP_RETURN_SW", (int32_t)(rcMapping[7]+1));
paramMgr->setPendingParam(0, "RC_MAP_FLAPS", (int32_t)(rcMapping[8]+1));
paramMgr->setPendingParam(0, "RC_MAP_AUX1", (int32_t)(rcMapping[9]+1));
paramMgr->setPendingParam(0, "RC_MAP_AUX2", (int32_t)(rcMapping[10]+1));
//let the param mgr manage sending all the pending RC_foo updates and persisting after //let the param mgr manage sending all the pending RC_foo updates and persisting after
paramMgr->sendPendingParameters(true); paramMgr->sendPendingParameters(true);
...@@ -1140,15 +1222,13 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval) ...@@ -1140,15 +1222,13 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval)
} }
// Raw value // Raw value
int ival = (int)fval; int delta = abs(fval - rcMappedValue[rcToFunctionMapping[chan]]);
int delta = abs(ival - rcValue[chan]); if (!configEnabled && !calibrationEnabled && delta < 12 && delta >= 0 && rcValue[chan] > 800 && rcValue[chan] < 2200) {
if (delta < 3) {
//ignore tiny jitter values //ignore tiny jitter values
return; return;
} }
else { else {
qDebug() << "chan" << chan << " delta:" << delta; rcValue[chan] = fval;
rcValue[chan] = ival;
} }
...@@ -1166,7 +1246,7 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval) ...@@ -1166,7 +1246,7 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval)
// If the first channel moved considerably, pick it // If the first channel moved considerably, pick it
if (fabsf(channelWantedList[chan] - fval) > 300.0f) { if (fabsf(channelWantedList[chan] - fval) > 300.0f) {
rcMapping[channelWanted] = chan; rcMapping[channelWanted] = chan;
updateInvertedCheckboxes(chan); updateMappingView(channelWanted);
int chanFound = channelWanted; int chanFound = channelWanted;
channelWanted = -1; channelWanted = -1;
...@@ -1177,20 +1257,48 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval) ...@@ -1177,20 +1257,48 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval)
msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
(void)msgBox.exec(); (void)msgBox.exec();
}
}
// Find correct mapped channel // XXX fuse with parameter update handling
for (unsigned int i = 0; i < chanCount; i++) { switch (chanFound) {
if (chan == rcMapping[i]) { case 0:
rcMappedValue[i] = (rcRev[chan]) ? rcMax[chan] - (fval - rcMin[chan]) : fval; ui->rollSpinBox->setValue(chan + 1);
break;
// Copy min / max case 1:
rcMappedMin[i] = rcMin[chan]; ui->pitchSpinBox->setValue(chan + 1);
rcMappedMax[i] = rcMax[chan]; break;
case 2:
ui->yawSpinBox->setValue(chan + 1);
break;
case 3:
ui->throttleSpinBox->setValue(chan + 1);
break;
case 4:
ui->modeSpinBox->setValue(chan + 1);
break;
case 5:
ui->assistSwSpinBox->setValue(chan + 1);
break;
case 6:
ui->missionSwSpinBox->setValue(chan + 1);
break;
case 7:
ui->returnSwSpinBox->setValue(chan + 1);
break;
case 8:
ui->flapsSpinBox->setValue(chan + 1);
break;
case 9:
ui->aux1SpinBox->setValue(chan + 1);
break;
case 10:
ui->aux2SpinBox->setValue(chan + 1);
break;
}
} }
} }
rcValueReversed[chan] = (rcRev[chan]) ? rcMax[chan] - (fval - rcMin[chan]) : fval;
// Normalized value // Normalized value
float normalized; float normalized;
float chanTrim = rcTrim[chan]; float chanTrim = rcTrim[chan];
...@@ -1206,6 +1314,19 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval) ...@@ -1206,6 +1314,19 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval)
// Invert // Invert
normalized = (rcRev[chan]) ? -1.0f*normalized : normalized; normalized = (rcRev[chan]) ? -1.0f*normalized : normalized;
// Find correct mapped channel
for (unsigned int i = 0; i < chanCount; i++) {
if (chan == rcMapping[i]) {
rcMappedValue[i] = (rcRev[chan]) ? rcMax[chan] - (fval - rcMin[chan]) : fval;
// Copy min / max
rcMappedMin[i] = rcMin[chan];
rcMappedMax[i] = rcMax[chan];
rcMappedNormalizedValue[i] = normalized;
}
}
if (chan == rcMapping[0]) { if (chan == rcMapping[0]) {
rcRoll = normalized; rcRoll = normalized;
} }
...@@ -1226,16 +1347,50 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval) ...@@ -1226,16 +1347,50 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval)
rcThrottle = qBound(0.0f, rcThrottle, 1.0f); rcThrottle = qBound(0.0f, rcThrottle, 1.0f);
} }
else if (chan == rcMapping[4]) { else if (chan == rcMapping[4]) {
rcMode = normalized;// MODE SWITCH rcMode = normalized; // MODE SWITCH
} }
else if (chan == rcMapping[5]) { else if (chan == rcMapping[5]) {
rcAux1 = normalized; // AUX1 rcAssist = normalized; // ASSIST SWITCH
} }
else if (chan == rcMapping[6]) { else if (chan == rcMapping[6]) {
rcAux2 = normalized;// AUX2 rcMission = normalized; // MISSION SWITCH
} }
else if (chan == rcMapping[7]) { else if (chan == rcMapping[7]) {
rcAux3 = normalized; // AUX3 rcReturn = normalized; // RETURN SWITCH
}
else if (chan == rcMapping[8]) {
rcFlaps = normalized; // FLAPS
}
else if (chan == rcMapping[9]) {
rcAux1 = normalized; // AUX2
}
else if (chan == rcMapping[10]) {
rcAux2 = normalized; // AUX3
}
if (channelReverseStateWanted >= 0) {
// If the *right* channel moved considerably, evaluate it
if (fabsf(fval - 1500) > 350.0f &&
rcMapping[channelReverseStateWanted] == chan) {
// Check if the output is positive
if (fval > 1750) {
rcRev[rcMapping[channelReverseStateWanted]] = true;
} else {
rcRev[rcMapping[channelReverseStateWanted]] = false;
}
unsigned currRevFunc = channelReverseStateWanted;
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.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
(void)msgBox.exec();
}
} }
dataModelChanged = true; dataModelChanged = true;
...@@ -1243,36 +1398,98 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval) ...@@ -1243,36 +1398,98 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float fval)
qDebug() << "RC CHAN:" << chan << "PPM:" << fval << "NORMALIZED:" << normalized; qDebug() << "RC CHAN:" << chan << "PPM:" << fval << "NORMALIZED:" << normalized;
} }
void QGCPX4VehicleConfig::updateInvertedCheckboxes(int index) void QGCPX4VehicleConfig::updateAllInvertedCheckboxes()
{ {
unsigned int mapindex = rcMapping[index]; for (unsigned function_index = 0; function_index < chanMappedMax; function_index++) {
switch (mapindex) int rc_input_index = rcMapping[function_index];
{
case 0: if (rc_input_index < 0 || rc_input_index > chanMax)
ui->invertCheckBox->setChecked(rcRev[index]); continue;
break;
case 1: // Map index to checkbox.
ui->invertCheckBox_2->setChecked(rcRev[index]); // TODO(lm) Would be better to stick the checkboxes into a vector upfront
break; switch (function_index)
case 2: {
ui->invertCheckBox_3->setChecked(rcRev[index]); case 0:
break; ui->invertCheckBox->setChecked(rcRev[rc_input_index]);
case 3: ui->rollWidget->setName(tr("Roll (#%1)").arg(rcMapping[0] + 1));
ui->invertCheckBox_4->setChecked(rcRev[index]); break;
break; case 1:
case 4: ui->invertCheckBox_2->setChecked(rcRev[rc_input_index]);
ui->invertCheckBox_5->setChecked(rcRev[index]); ui->pitchWidget->setName(tr("Pitch (#%1)").arg(rcMapping[1] + 1));
break; break;
case 5: case 2:
ui->invertCheckBox_6->setChecked(rcRev[index]); ui->invertCheckBox_3->setChecked(rcRev[rc_input_index]);
break; ui->yawWidget->setName(tr("Yaw (#%1)").arg(rcMapping[2] + 1));
case 6: break;
ui->invertCheckBox_7->setChecked(rcRev[index]); case 3:
break; ui->invertCheckBox_4->setChecked(rcRev[rc_input_index]);
case 7: ui->throttleWidget->setName(tr("Throt. (#%1)").arg(rcMapping[3] + 1));
ui->invertCheckBox_8->setChecked(rcRev[index]); break;
break; case 4:
ui->invertCheckBox_5->setChecked(rcRev[rc_input_index]);
//ui->radio5Widget->setName(tr("Mode Switch (#%1)").arg(rcMapping[4] + 1));
break;
case 5:
ui->assistSwInvertCheckBox->setChecked(rcRev[rc_input_index]);
break;
case 6:
ui->missionSwInvertCheckBox->setChecked(rcRev[rc_input_index]);
break;
case 7:
ui->returnSwInvertCheckBox->setChecked(rcRev[rc_input_index]);
break;
case 8:
ui->flapsInvertCheckBox->setChecked(rcRev[rc_input_index]);
break;
case 9:
ui->aux1InvertCheckBox->setChecked(rcRev[rc_input_index]);
break;
case 10:
ui->aux2InvertCheckBox->setChecked(rcRev[rc_input_index]);
break;
}
}
}
void QGCPX4VehicleConfig::updateMappingView(int function_index)
{
Q_UNUSED(function_index);
updateAllInvertedCheckboxes();
QStringList assignments;
for (unsigned i = 0; i < chanMax; i++) {
assignments << "";
}
for (unsigned i = 0; i < chanMappedMax; i++) {
if (rcMapping[i] >= 0 && rcMapping[i] < (int)chanMax) {
assignments.replace(rcMapping[i], assignments[rcMapping[i]].append(QString(" / ").append(channelNames[i])));
}
}
for (unsigned i = 0; i < chanMax; i++) {
if (assignments[i] == "")
assignments[i] = "UNUSED";
}
for (unsigned i = 0; i < chanMax; i++) {
switch (i) {
case 4:
ui->radio5Widget->setName(tr("%1 (#5)").arg(assignments[4]));
break;
case 5:
ui->radio6Widget->setName(tr("%1 (#6)").arg(assignments[5]));
break;
case 6:
ui->radio7Widget->setName(tr("%1 (#7)").arg(assignments[6]));
break;
case 7:
ui->radio8Widget->setName(tr("%1 (#8)").arg(assignments[7]));
break;
}
} }
} }
...@@ -1284,46 +1501,62 @@ void QGCPX4VehicleConfig::handleRcParameterChange(QString parameterName, QVarian ...@@ -1284,46 +1501,62 @@ void QGCPX4VehicleConfig::handleRcParameterChange(QString parameterName, QVarian
// Order is: roll, pitch, yaw, throttle, mode sw, aux 1-3 // Order is: roll, pitch, yaw, throttle, mode sw, aux 1-3
int intValue = value.toInt() - 1; int intValue = value.toInt() - 1;
if (parameterName.startsWith("RC_MAP_ROLL")) { if (parameterName.startsWith("RC_MAP_ROLL")) {
rcMapping[0] = intValue; setChannelToFunctionMapping(0, intValue);
ui->rollSpinBox->setValue(rcMapping[0]+1); ui->rollSpinBox->setValue(rcMapping[0]+1);
ui->rollSpinBox->setEnabled(true); ui->rollSpinBox->setEnabled(true);
} }
else if (parameterName.startsWith("RC_MAP_PITCH")) { else if (parameterName.startsWith("RC_MAP_PITCH")) {
rcMapping[1] = intValue; setChannelToFunctionMapping(1, intValue);
ui->pitchSpinBox->setValue(rcMapping[1]+1); ui->pitchSpinBox->setValue(rcMapping[1]+1);
ui->pitchSpinBox->setEnabled(true); ui->pitchSpinBox->setEnabled(true);
} }
else if (parameterName.startsWith("RC_MAP_YAW")) { else if (parameterName.startsWith("RC_MAP_YAW")) {
rcMapping[2] = intValue; setChannelToFunctionMapping(2, intValue);
ui->yawSpinBox->setValue(rcMapping[2]+1); ui->yawSpinBox->setValue(rcMapping[2]+1);
ui->yawSpinBox->setEnabled(true); ui->yawSpinBox->setEnabled(true);
} }
else if (parameterName.startsWith("RC_MAP_THROTTLE")) { else if (parameterName.startsWith("RC_MAP_THROTTLE")) {
rcMapping[3] = intValue; setChannelToFunctionMapping(3, intValue);
ui->throttleSpinBox->setValue(rcMapping[3]+1); ui->throttleSpinBox->setValue(rcMapping[3]+1);
ui->throttleSpinBox->setEnabled(true); ui->throttleSpinBox->setEnabled(true);
} }
else if (parameterName.startsWith("RC_MAP_MODE_SW")) { else if (parameterName.startsWith("RC_MAP_MODE_SW")) {
rcMapping[4] = intValue; setChannelToFunctionMapping(4, intValue);
ui->modeSpinBox->setValue(rcMapping[4]+1); ui->modeSpinBox->setValue(rcMapping[4]+1);
ui->modeSpinBox->setEnabled(true); ui->modeSpinBox->setEnabled(true);
} }
else if (parameterName.startsWith("RC_MAP_ASSIST_SW")) {
setChannelToFunctionMapping(5, intValue);
ui->assistSwSpinBox->setValue(rcMapping[5]+1);
ui->assistSwSpinBox->setEnabled(true);
}
else if (parameterName.startsWith("RC_MAP_MISSIO_SW")) {
setChannelToFunctionMapping(6, intValue);
ui->missionSwSpinBox->setValue(rcMapping[6]+1);
ui->missionSwSpinBox->setEnabled(true);
}
else if (parameterName.startsWith("RC_MAP_RETURN_SW")) {
setChannelToFunctionMapping(7, intValue);
ui->returnSwSpinBox->setValue(rcMapping[7]+1);
ui->returnSwSpinBox->setEnabled(true);
}
else if (parameterName.startsWith("RC_MAP_FLAPS")) {
setChannelToFunctionMapping(8, intValue);
ui->flapsSpinBox->setValue(rcMapping[8]+1);
ui->flapsSpinBox->setEnabled(true);
}
else if (parameterName.startsWith("RC_MAP_AUX1")) { else if (parameterName.startsWith("RC_MAP_AUX1")) {
rcMapping[5] = intValue; setChannelToFunctionMapping(9, intValue);
ui->aux1SpinBox->setValue(rcMapping[5]+1); ui->aux1SpinBox->setValue(rcMapping[9]+1);
ui->aux1SpinBox->setEnabled(true); ui->aux1SpinBox->setEnabled(true);
} }
else if (parameterName.startsWith("RC_MAP_AUX2")) { else if (parameterName.startsWith("RC_MAP_AUX2")) {
rcMapping[6] = intValue; setChannelToFunctionMapping(10, intValue);
ui->aux2SpinBox->setValue(rcMapping[6]+1); ui->aux2SpinBox->setValue(rcMapping[10]+1);
ui->aux2SpinBox->setEnabled(true); ui->aux2SpinBox->setEnabled(true);
} }
else if (parameterName.startsWith("RC_MAP_AUX3")) {
rcMapping[7] = intValue;
ui->aux3SpinBox->setValue(rcMapping[7]+1);
ui->aux3SpinBox->setEnabled(true);
}
} }
else if (parameterName.startsWith("RC_SCALE_")) { else if (parameterName.startsWith("RC_SCALE_")) {
// Scaling // Scaling
...@@ -1337,30 +1570,16 @@ void QGCPX4VehicleConfig::handleRcParameterChange(QString parameterName, QVarian ...@@ -1337,30 +1570,16 @@ void QGCPX4VehicleConfig::handleRcParameterChange(QString parameterName, QVarian
else if (parameterName.startsWith("RC_SCALE_YAW")) { else if (parameterName.startsWith("RC_SCALE_YAW")) {
rcScaling[2] = floatVal; rcScaling[2] = floatVal;
} }
else if (parameterName.startsWith("RC_SCALE_THROTTLE")) { // Not implemented at this point
rcScaling[3] = floatVal; // else if (parameterName.startsWith("RC_SCALE_THROTTLE")) {
} // rcScaling[3] = floatVal;
else if (parameterName.startsWith("RC_SCALE_MODE_SW")) { // }
rcScaling[4] = floatVal; // else if (parameterName.startsWith("RC_SCALE_AUX1")) {
} // rcScaling[5] = floatVal;
else if (parameterName.startsWith("RC_SCALE_AUX1")) { // }
rcScaling[5] = floatVal; // else if (parameterName.startsWith("RC_SCALE_AUX2")) {
} // rcScaling[6] = floatVal;
else if (parameterName.startsWith("RC_SCALE_AUX2")) { // }
rcScaling[6] = floatVal;
}
else if (parameterName.startsWith("RC_SCALE_AUX3")) {
rcScaling[7] = floatVal;
}
}
else if (parameterName.startsWith("RC_TYPE")) {
if (0 != rcTypeUpdateRequested) {
rcTypeUpdateRequested = 0;
updateStatus(tr("Received RC type update, setting parameters based on model."));
rcType = value.toInt();
// Request all other parameters as well
requestCalibrationRC();
}
} }
} }
else { else {
...@@ -1404,11 +1623,24 @@ void QGCPX4VehicleConfig::handleRcParameterChange(QString parameterName, QVarian ...@@ -1404,11 +1623,24 @@ void QGCPX4VehicleConfig::handleRcParameterChange(QString parameterName, QVarian
index = parameterName.mid(2, 1).toInt(&ok) - 1; index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && index < chanMax) { if (ok && index < chanMax) {
rcRev[index] = (intVal == -1) ? true : false; rcRev[index] = (intVal == -1) ? true : false;
updateInvertedCheckboxes(index);
for (unsigned i = 0; i < chanMappedMax; i++)
{
if (rcMapping[i] == (int)index)
updateMappingView(i);
}
} }
} }
} }
}
void QGCPX4VehicleConfig::setChannelToFunctionMapping(int function, int channel)
{
if (function >= 0 && function < (int)chanMappedMax)
rcMapping[function] = channel;
if (channel >= 0 && channel < (int)chanMax)
rcToFunctionMapping[channel] = function;
} }
void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value) void QGCPX4VehicleConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
...@@ -1501,25 +1733,9 @@ void QGCPX4VehicleConfig::updateError(const QString& str) ...@@ -1501,25 +1733,9 @@ void QGCPX4VehicleConfig::updateError(const QString& str)
ui->advancedStatusLabel->setStyleSheet(QString("QLabel { margin: 0px 2px; font: 14px; color: %1; background-color: %2; }").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name())); ui->advancedStatusLabel->setStyleSheet(QString("QLabel { margin: 0px 2px; font: 14px; color: %1; background-color: %2; }").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name()));
} }
void QGCPX4VehicleConfig::setRCType(int type)
{
if (!mav) return;
// XXX TODO Add handling of RC_TYPE vs non-RC_TYPE here
mav->setParameter(0, "RC_TYPE", type);
rcTypeUpdateRequested = QGC::groundTimeMilliseconds();
QTimer::singleShot(rcTypeTimeout+100, this, SLOT(checktimeOuts()));
}
void QGCPX4VehicleConfig::checktimeOuts() void QGCPX4VehicleConfig::checktimeOuts()
{ {
if (rcTypeUpdateRequested > 0) {
if (QGC::groundTimeMilliseconds() - rcTypeUpdateRequested > rcTypeTimeout) {
updateError(tr("Setting remote control timed out - is the system connected?"));
}
}
} }
...@@ -1530,10 +1746,10 @@ void QGCPX4VehicleConfig::updateRcWidgetValues() ...@@ -1530,10 +1746,10 @@ void QGCPX4VehicleConfig::updateRcWidgetValues()
ui->yawWidget->setValueAndRange(rcMappedValue[2],rcMappedMin[2],rcMappedMax[2]); ui->yawWidget->setValueAndRange(rcMappedValue[2],rcMappedMin[2],rcMappedMax[2]);
ui->throttleWidget->setValueAndRange(rcMappedValue[3],rcMappedMin[3],rcMappedMax[3]); ui->throttleWidget->setValueAndRange(rcMappedValue[3],rcMappedMin[3],rcMappedMax[3]);
ui->radio5Widget->setValueAndRange(rcMappedValue[4],rcMin[4],rcMax[4]); ui->radio5Widget->setValueAndRange(rcValueReversed[4],rcMin[4],rcMax[4]);
ui->radio6Widget->setValueAndRange(rcMappedValue[5],rcMin[5],rcMax[5]); ui->radio6Widget->setValueAndRange(rcValueReversed[5],rcMin[5],rcMax[5]);
ui->radio7Widget->setValueAndRange(rcMappedValue[6],rcMin[6],rcMax[6]); ui->radio7Widget->setValueAndRange(rcValueReversed[6],rcMin[6],rcMax[6]);
ui->radio8Widget->setValueAndRange(rcMappedValue[7],rcMin[7],rcMax[7]); ui->radio8Widget->setValueAndRange(rcValueReversed[7],rcMin[7],rcMax[7]);
} }
void QGCPX4VehicleConfig::updateRcChanLabels() void QGCPX4VehicleConfig::updateRcChanLabels()
...@@ -1544,7 +1760,7 @@ void QGCPX4VehicleConfig::updateRcChanLabels() ...@@ -1544,7 +1760,7 @@ void QGCPX4VehicleConfig::updateRcChanLabels()
ui->throttleChanLabel->setText(labelForRcValue(rcThrottle)); ui->throttleChanLabel->setText(labelForRcValue(rcThrottle));
QString blankLabel = tr("---"); QString blankLabel = tr("---");
if (rcValue[rcMapping[4] != UINT16_MAX]) { if (rcValue[rcMapping[4]] != UINT16_MAX) {
ui->modeChanLabel->setText(labelForRcValue(rcMode)); ui->modeChanLabel->setText(labelForRcValue(rcMode));
} }
else { else {
...@@ -1552,24 +1768,45 @@ void QGCPX4VehicleConfig::updateRcChanLabels() ...@@ -1552,24 +1768,45 @@ void QGCPX4VehicleConfig::updateRcChanLabels()
} }
if (rcValue[rcMapping[5]] != UINT16_MAX) { if (rcValue[rcMapping[5]] != UINT16_MAX) {
ui->aux1ChanLabel->setText(labelForRcValue(rcAux1)); ui->assistSwChanLabel->setText(labelForRcValue(rcAssist));
} }
else { else {
ui->aux1ChanLabel->setText(blankLabel); ui->assistSwChanLabel->setText(blankLabel);
} }
if (rcValue[rcMapping[6]] != UINT16_MAX) { if (rcValue[rcMapping[6]] != UINT16_MAX) {
ui->aux2ChanLabel->setText(labelForRcValue(rcAux2)); ui->missionSwChanLabel->setText(labelForRcValue(rcMission));
} }
else { else {
ui->aux2ChanLabel->setText(blankLabel); ui->missionSwChanLabel->setText(blankLabel);
} }
if (rcValue[rcMapping[7]] != UINT16_MAX) { if (rcValue[rcMapping[7]] != UINT16_MAX) {
ui->aux3ChanLabel->setText(labelForRcValue(rcAux3)); ui->returnSwChanLabel->setText(labelForRcValue(rcReturn));
}
else {
ui->returnSwChanLabel->setText(blankLabel);
}
if (rcValue[rcMapping[8]] != UINT16_MAX) {
ui->flapsChanLabel->setText(labelForRcValue(rcFlaps));
} }
else { else {
ui->aux3ChanLabel->setText(blankLabel); ui->flapsChanLabel->setText(blankLabel);
}
if (rcValue[rcMapping[9]] != UINT16_MAX) {
ui->aux1ChanLabel->setText(labelForRcValue(rcAux1));
}
else {
ui->aux1ChanLabel->setText(blankLabel);
}
if (rcValue[rcMapping[10]] != UINT16_MAX) {
ui->aux2ChanLabel->setText(labelForRcValue(rcAux2));
}
else {
ui->aux2ChanLabel->setText(blankLabel);
} }
} }
......
...@@ -61,9 +61,7 @@ public slots: ...@@ -61,9 +61,7 @@ public slots:
/** Set trim positions */ /** Set trim positions */
void setTrimPositions(); void setTrimPositions();
/** Detect which channels need to be inverted */ /** Detect which channels need to be inverted */
void detectChannelInversion(); void detectChannelInversion(int aert_index);
/** Change the mode setting of the control inputs */
void setRCModeIndex(int newRcMode);
/** Render the data updated */ /** Render the data updated */
void updateView(); void updateView();
...@@ -73,75 +71,113 @@ public slots: ...@@ -73,75 +71,113 @@ public slots:
/** Set the RC channel */ /** Set the RC channel */
void setRollChan(int channel) { void setRollChan(int channel) {
rcMapping[0] = channel - 1; rcMapping[0] = channel - 1;
updateInvertedCheckboxes(channel - 1); updateMappingView(0);
} }
/** Set the RC channel */ /** Set the RC channel */
void setPitchChan(int channel) { void setPitchChan(int channel) {
rcMapping[1] = channel - 1; rcMapping[1] = channel - 1;
updateInvertedCheckboxes(channel - 1); updateMappingView(1);
} }
/** Set the RC channel */ /** Set the RC channel */
void setYawChan(int channel) { void setYawChan(int channel) {
rcMapping[2] = channel - 1; rcMapping[2] = channel - 1;
updateInvertedCheckboxes(channel - 1); updateMappingView(2);
} }
/** Set the RC channel */ /** Set the RC channel */
void setThrottleChan(int channel) { void setThrottleChan(int channel) {
rcMapping[3] = channel - 1; rcMapping[3] = channel - 1;
updateInvertedCheckboxes(channel - 1); updateMappingView(3);
} }
/** Set the RC channel */ /** Set the RC channel */
void setModeChan(int channel) { void setModeChan(int channel) {
rcMapping[4] = channel - 1; rcMapping[4] = channel - 1;
updateInvertedCheckboxes(channel - 1); updateMappingView(4);
} }
/** Set the RC channel */ /** Set the RC channel */
void setAux1Chan(int channel) { void setAssistChan(int channel) {
rcMapping[5] = channel - 1; rcMapping[5] = channel - 1;
updateInvertedCheckboxes(channel - 1); updateMappingView(5);
} }
/** Set the RC channel */ /** Set the RC channel */
void setAux2Chan(int channel) { void setMissionChan(int channel) {
rcMapping[6] = channel - 1; rcMapping[6] = channel - 1;
updateInvertedCheckboxes(channel - 1); updateMappingView(6);
} }
/** Set the RC channel */ /** Set the RC channel */
void setAux3Chan(int channel) { void setReturnChan(int channel) {
rcMapping[7] = channel - 1; rcMapping[7] = channel - 1;
updateInvertedCheckboxes(channel - 1); updateMappingView(7);
}
/** Set the RC channel */
void setFlapsChan(int channel) {
rcMapping[8] = channel - 1;
updateMappingView(8);
}
/** Set the RC channel */
void setAux1Chan(int channel) {
rcMapping[9] = channel - 1;
updateMappingView(9);
}
/** Set the RC channel */
void setAux2Chan(int channel) {
rcMapping[10] = channel - 1;
updateMappingView(10);
} }
/** Set channel inversion status */ /** Set channel inversion status */
void setRollInverted(bool inverted) { void setRollInverted(bool inverted) {
rcRev[rcMapping[0]] = inverted; rcRev[rcMapping[0]] = inverted;
updateMappingView(0);
} }
/** Set channel inversion status */ /** Set channel inversion status */
void setPitchInverted(bool inverted) { void setPitchInverted(bool inverted) {
rcRev[rcMapping[1]] = inverted; rcRev[rcMapping[1]] = inverted;
updateMappingView(1);
} }
/** Set channel inversion status */ /** Set channel inversion status */
void setYawInverted(bool inverted) { void setYawInverted(bool inverted) {
rcRev[rcMapping[2]] = inverted; rcRev[rcMapping[2]] = inverted;
updateMappingView(2);
} }
/** Set channel inversion status */ /** Set channel inversion status */
void setThrottleInverted(bool inverted) { void setThrottleInverted(bool inverted) {
rcRev[rcMapping[3]] = inverted; rcRev[rcMapping[3]] = inverted;
updateMappingView(3);
} }
/** Set channel inversion status */ /** Set channel inversion status */
void setModeInverted(bool inverted) { void setModeInverted(bool inverted) {
rcRev[rcMapping[4]] = inverted; rcRev[rcMapping[4]] = inverted;
updateMappingView(4);
} }
/** Set channel inversion status */ /** Set channel inversion status */
void setAux1Inverted(bool inverted) { void setAssistInverted(bool inverted) {
rcRev[rcMapping[5]] = inverted; rcRev[rcMapping[5]] = inverted;
updateMappingView(5);
} }
/** Set channel inversion status */ /** Set channel inversion status */
void setAux2Inverted(bool inverted) { void setMissionInverted(bool inverted) {
rcRev[rcMapping[6]] = inverted; rcRev[rcMapping[6]] = inverted;
updateMappingView(6);
} }
/** Set channel inversion status */ /** Set channel inversion status */
void setAux3Inverted(bool inverted) { void setReturnInverted(bool inverted) {
rcRev[rcMapping[7]] = inverted; rcRev[rcMapping[7]] = inverted;
updateMappingView(7);
}
/** Set channel inversion status */
void setFlapsInverted(bool inverted) {
rcRev[rcMapping[8]] = inverted;
updateMappingView(8);
}
/** Set channel inversion status */
void setAux1Inverted(bool inverted) {
rcRev[rcMapping[9]] = inverted;
updateMappingView(9);
}
/** Set channel inversion status */
void setAux2Inverted(bool inverted) {
rcRev[rcMapping[10]] = inverted;
updateMappingView(10);
} }
/** Identify roll */ /** Identify roll */
...@@ -169,19 +205,34 @@ public slots: ...@@ -169,19 +205,34 @@ public slots:
identifyChannelMapping(4); identifyChannelMapping(4);
} }
/** Identify sub mode */ /** Identify assist channel */
void identifySubModeChannel() { void identifyAssistChannel() {
identifyChannelMapping(5); identifyChannelMapping(5);
} }
/** Identify mission channel */
void identifyMissionChannel() {
identifyChannelMapping(6);
}
/** Identify return channel */
void identifyReturnChannel() {
identifyChannelMapping(7);
}
/** Identify flaps channel */
void identifyFlapsChannel() {
identifyChannelMapping(8);
}
/** Identify aux 1 */ /** Identify aux 1 */
void identifyAux1Channel() { void identifyAux1Channel() {
identifyChannelMapping(6); identifyChannelMapping(9);
} }
/** Identify aux 2 */ /** Identify aux 2 */
void identifyAux2Channel() { void identifyAux2Channel() {
identifyChannelMapping(7); identifyChannelMapping(10);
} }
protected slots: protected slots:
...@@ -200,11 +251,12 @@ protected slots: ...@@ -200,11 +251,12 @@ protected slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value); void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void updateStatus(const QString& str); void updateStatus(const QString& str);
void updateError(const QString& str); void updateError(const QString& str);
void setRCType(int type);
/** Check timeouts */ /** Check timeouts */
void checktimeOuts(); void checktimeOuts();
/** Update checkbox status */ /** Update checkbox status */
void updateInvertedCheckboxes(int index); void updateAllInvertedCheckboxes();
/** Update mapping view state */
void updateMappingView(int index);
/** Update the displayed values */ /** Update the displayed values */
void updateRcWidgetValues(); void updateRcWidgetValues();
/** update the channel labels */ /** update the channel labels */
...@@ -215,42 +267,51 @@ protected slots: ...@@ -215,42 +267,51 @@ protected slots:
} }
protected: protected:
void setChannelToFunctionMapping(int function, int channel);
bool doneLoadingConfig; bool doneLoadingConfig;
UASInterface* mav; ///< The current MAV UASInterface* mav; ///< The current MAV
QGCUASParamManager* paramMgr; ///< params mgr for the mav QGCUASParamManager* paramMgr; ///< params mgr for the mav
static const unsigned int chanMax = 16; ///< Maximum number of channels static const unsigned int chanMax = 14; ///< Maximum number of channels
static const unsigned int chanMappedMax = 16; ///< Maximum number of mapped channels (can be higher than input channel count)
unsigned int chanCount; ///< Actual channels unsigned int chanCount; ///< Actual channels
int rcType; ///< Type of the remote control
quint64 rcTypeUpdateRequested; ///< Zero if not requested, non-zero if requested
static const unsigned int rcTypeTimeout = 5000; ///< 5 seconds timeout, in milliseconds
float rcMin[chanMax]; ///< Minimum values float rcMin[chanMax]; ///< Minimum values
float rcMax[chanMax]; ///< Maximum values float rcMax[chanMax]; ///< Maximum values
float rcTrim[chanMax]; ///< Zero-position (center for roll/pitch/yaw, 0 throttle for throttle) float rcTrim[chanMax]; ///< Zero-position (center for roll/pitch/yaw, 0 throttle for throttle)
int rcMapping[chanMax]; ///< PWM to function mappings int rcMapping[chanMappedMax]; ///< PWM to function mappings
int rcToFunctionMapping[chanMax];
float rcScaling[chanMax]; ///< Scaling of channel input to control commands float rcScaling[chanMax]; ///< Scaling of channel input to control commands
bool rcRev[chanMax]; ///< Channel reverse bool rcRev[chanMax]; ///< Channel reverse
int rcValue[chanMax]; ///< Last values int rcValue[chanMax]; ///< Last values, RAW
float rcMappedMin[chanMax]; ///< Mapped channels in default order float rcValueReversed[chanMax]; ///< Last values, accounted for reverse
float rcMappedMax[chanMax]; ///< Mapped channels in default order float rcMappedMin[chanMappedMax]; ///< Mapped channels in default order
float rcMappedValue[chanMax]; ///< Mapped channels in default order float rcMappedMax[chanMappedMax]; ///< Mapped channels in default order
float rcMappedValue[chanMappedMax]; ///< Mapped channels in default order
float rcMappedNormalizedValue[chanMappedMax]; ///< Mapped channels in default order
int channelWanted; ///< During channel assignment search the requested default index int channelWanted; ///< During channel assignment search the requested default index
int channelReverseStateWanted;
float channelWantedList[chanMax]; ///< During channel assignment search the start values float channelWantedList[chanMax]; ///< During channel assignment search the start values
float channelReverseStateWantedList[chanMax];
QStringList channelNames; ///< List of channel names in standard order QStringList channelNames; ///< List of channel names in standard order
float rcRoll; ///< PPM input channel used as roll control input float rcRoll; ///< PPM input channel used as roll control input
float rcPitch; ///< PPM input channel used as pitch control input float rcPitch; ///< PPM input channel used as pitch control input
float rcYaw; ///< PPM input channel used as yaw control input float rcYaw; ///< PPM input channel used as yaw control input
float rcThrottle; ///< PPM input channel used as throttle control input float rcThrottle; ///< PPM input channel used as throttle control input
float rcMode; ///< PPM input channel used as mode switch control input float rcMode; ///< PPM input channel used as mode switch control input
float rcAssist; ///< PPM input channel used as assist switch control input
float rcMission; ///< PPM input channel used as mission switch control input
float rcReturn; ///< PPM input channel used as return switch control input
float rcFlaps; ///< PPM input channel used as flaps control input
float rcAux1; ///< PPM input channel used as aux 1 input float rcAux1; ///< PPM input channel used as aux 1 input
float rcAux2; ///< PPM input channel used as aux 2 input float rcAux2; ///< PPM input channel used as aux 2 input
float rcAux3; ///< PPM input channel used as aux 3 input
bool rcCalChanged; ///< Set if the calibration changes (and needs to be written) bool rcCalChanged; ///< Set if the calibration changes (and needs to be written)
bool dataModelChanged; ///< Set if any of the input data changed bool dataModelChanged; ///< Set if any of the input data changed
QTimer updateTimer; ///< Controls update intervals QTimer updateTimer; ///< Controls update intervals
enum RC_MODE rc_mode; ///< Mode of the remote control, according to usual convention
QList<QGCToolWidget*> toolWidgets; ///< Configurable widgets QList<QGCToolWidget*> toolWidgets; ///< Configurable widgets
QMap<QString,QGCToolWidget*> toolWidgetsByName; ///< QMap<QString,QGCToolWidget*> toolWidgetsByName; ///<
bool calibrationEnabled; ///< calibration mode on / off bool calibrationEnabled; ///< calibration mode on / off
bool configEnabled; ///< config mode on / off
QMap<QString,QGCToolWidget*> paramToWidgetMap; ///< Holds the current active MAV's parameter widgets. QMap<QString,QGCToolWidget*> paramToWidgetMap; ///< Holds the current active MAV's parameter widgets.
QList<QWidget*> additionalTabs; ///< Stores additional tabs loaded for this vehicle/autopilot configuration. Used for cleaning up. QList<QWidget*> additionalTabs; ///< Stores additional tabs loaded for this vehicle/autopilot configuration. Used for cleaning up.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1256</width> <width>1256</width>
<height>783</height> <height>889</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>133</width> <width>133</width>
<height>757</height> <height>863</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_12"> <layout class="QVBoxLayout" name="verticalLayout_12">
...@@ -154,7 +154,7 @@ Config</string> ...@@ -154,7 +154,7 @@ Config</string>
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>5</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="firmwareTab"> <widget class="QWidget" name="firmwareTab">
<layout class="QVBoxLayout" name="firmwareLayout"> <layout class="QVBoxLayout" name="firmwareLayout">
...@@ -332,6 +332,13 @@ Config</string> ...@@ -332,6 +332,13 @@ Config</string>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QCheckBox" name="advancedCheckBox">
<property name="text">
<string>Show Advanced Configuration Options</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="advancedGroupBox"> <widget class="QGroupBox" name="advancedGroupBox">
<property name="title"> <property name="title">
...@@ -340,39 +347,35 @@ Config</string> ...@@ -340,39 +347,35 @@ Config</string>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
<item> <item>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="6" column="4"> <item row="6" column="0">
<widget class="QPushButton" name="subButton"> <widget class="QLabel" name="chanNameAssistSw">
<property name="text"> <property name="text">
<string>Identify Sub Mode Switch</string> <string>Assist Switch</string>
</property> </property>
</widget> <property name="alignment">
</item> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<item row="4" column="4">
<widget class="QPushButton" name="throttleButton">
<property name="text">
<string>Identify Throttle Channel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="1">
<widget class="QLabel" name="chanName_2"> <widget class="QLabel" name="yawChanLabel">
<property name="text"> <property name="text">
<string>Pitch / Elevator</string> <string>0000</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="2"> <item row="5" column="2">
<widget class="QCheckBox" name="invertCheckBox_4"> <widget class="QCheckBox" name="invertCheckBox_5">
<property name="text"> <property name="text">
<string>Reverse</string> <string>Reverse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3"> <item row="5" column="3">
<widget class="QSpinBox" name="rollSpinBox"> <widget class="QSpinBox" name="modeSpinBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
...@@ -384,21 +387,66 @@ Config</string> ...@@ -384,21 +387,66 @@ Config</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="3"> <item row="10" column="4">
<widget class="QSpinBox" name="throttleSpinBox"> <widget class="QPushButton" name="aux1Button">
<property name="enabled"> <property name="text">
<bool>false</bool> <string>Identify Aux 1 Channel</string>
</property> </property>
<property name="minimum"> </widget>
<number>0</number> </item>
<item row="0" column="3" colspan="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Mapping to Index of RC Channel used for (0 if not used)</string>
</property> </property>
<property name="maximum"> </widget>
<number>16</number> </item>
<item row="8" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Return Switch</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="3"> <item row="8" column="1">
<widget class="QSpinBox" name="yawSpinBox"> <widget class="QLabel" name="returnSwChanLabel">
<property name="text">
<string>0000</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="chanNameAux2_2">
<property name="text">
<string>Aux 1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QPushButton" name="modeButton">
<property name="text">
<string>Identify Mode Switch</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="yawButton">
<property name="text">
<string>Identify Yaw Channel</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QSpinBox" name="throttleSpinBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
...@@ -410,59 +458,65 @@ Config</string> ...@@ -410,59 +458,65 @@ Config</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="10" column="1">
<widget class="QLabel" name="chanName_3"> <widget class="QLabel" name="aux1ChanLabel">
<property name="text"> <property name="text">
<string>Yaw / Rudder</string> <string>0000</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="2" column="0">
<widget class="QLabel" name="chanName_4"> <widget class="QLabel" name="chanName_2">
<property name="text"> <property name="text">
<string>Throttle</string> <string>Pitch / Elevator</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="4"> <item row="0" column="2">
<widget class="QPushButton" name="aux2Button"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Identify Aux 2 Channel</string> <string>Reverse / Invert</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="3" column="0">
<widget class="QLabel" name="aux2ChanLabel"> <widget class="QLabel" name="chanName_3">
<property name="text"> <property name="text">
<string>0000</string> <string>Yaw / Rudder</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="4"> <item row="1" column="3">
<widget class="QPushButton" name="modeButton"> <widget class="QSpinBox" name="rollSpinBox">
<property name="text"> <property name="enabled">
<string>Identify Main Mode Switch</string> <bool>false</bool>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>16</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="4"> <item row="4" column="2">
<widget class="QPushButton" name="aux1Button"> <widget class="QCheckBox" name="invertCheckBox_4">
<property name="text"> <property name="text">
<string>Identify Aux 1 Channel</string> <string>Reverse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="5" column="1">
<widget class="QLabel" name="yawChanLabel"> <widget class="QLabel" name="modeChanLabel">
<property name="text"> <property name="text">
<string>0000</string> <string>0000</string>
</property> </property>
...@@ -471,43 +525,51 @@ Config</string> ...@@ -471,43 +525,51 @@ Config</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="11" column="1">
<widget class="QCheckBox" name="invertCheckBox"> <widget class="QLabel" name="aux2ChanLabel">
<property name="text"> <property name="text">
<string>Reverse</string> <string>0000</string>
</property> </property>
</widget> <property name="alignment">
</item> <set>Qt::AlignCenter</set>
<item row="1" column="4">
<widget class="QPushButton" name="rollButton">
<property name="text">
<string>Identify Roll Channel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="11" column="3">
<widget class="QLabel" name="label_3"> <widget class="QSpinBox" name="aux2SpinBox">
<property name="text"> <property name="enabled">
<string>Reverse Direction / Invert</string> <bool>false</bool>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>16</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="4"> <item row="10" column="3">
<widget class="QPushButton" name="yawButton"> <widget class="QSpinBox" name="aux1SpinBox">
<property name="text"> <property name="enabled">
<string>Identify Yaw Channel</string> <bool>false</bool>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>16</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="11" column="2">
<widget class="QCheckBox" name="invertCheckBox_2"> <widget class="QCheckBox" name="aux2InvertCheckBox">
<property name="text"> <property name="text">
<string>Reverse</string> <string>Reverse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="7" column="1">
<widget class="QLabel" name="rollChanLabel"> <widget class="QLabel" name="missionSwChanLabel">
<property name="text"> <property name="text">
<string>0000</string> <string>0000</string>
</property> </property>
...@@ -516,20 +578,33 @@ Config</string> ...@@ -516,20 +578,33 @@ Config</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="2"> <item row="5" column="0">
<widget class="QCheckBox" name="invertCheckBox_8"> <widget class="QLabel" name="chanName_5">
<property name="text"> <property name="text">
<string>Reverse</string> <string>Mode Switch</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="11" column="4">
<widget class="QLabel" name="aux1ChanLabel"> <widget class="QPushButton" name="aux2Button">
<property name="text"> <property name="text">
<string>0000</string> <string>Identify Aux 2 Channel</string>
</property> </property>
<property name="alignment"> </widget>
<set>Qt::AlignCenter</set> </item>
<item row="2" column="3">
<widget class="QSpinBox" name="pitchSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>16</number>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -543,29 +618,49 @@ Config</string> ...@@ -543,29 +618,49 @@ Config</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="4">
<widget class="QPushButton" name="throttleButton">
<property name="text">
<string>Identify Throttle Channel</string>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Control Channel Name</string> <string>Channel Name</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QCheckBox" name="assistSwInvertCheckBox">
<property name="text">
<string>Reverse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="rollChanLabel">
<property name="text"> <property name="text">
<string>Normalized Value</string> <string>0000</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="4"> <item row="6" column="4">
<widget class="QPushButton" name="pitchButton"> <widget class="QPushButton" name="assistSwButton">
<property name="text"> <property name="text">
<string>Identify Pitch Channel</string> <string>Identify Assist Switch</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="11" column="0">
<widget class="QLabel" name="chanName_7"> <widget class="QLabel" name="chanNameAux2">
<property name="text"> <property name="text">
<string>Aux 2</string> <string>Aux 2</string>
</property> </property>
...@@ -574,8 +669,15 @@ Config</string> ...@@ -574,8 +669,15 @@ Config</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2">
<widget class="QCheckBox" name="invertCheckBox">
<property name="text">
<string>Reverse</string>
</property>
</widget>
</item>
<item row="6" column="3"> <item row="6" column="3">
<widget class="QSpinBox" name="aux1SpinBox"> <widget class="QSpinBox" name="assistSwSpinBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
...@@ -587,38 +689,66 @@ Config</string> ...@@ -587,38 +689,66 @@ Config</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="2" column="1">
<widget class="QLabel" name="chanName_8"> <widget class="QLabel" name="pitchChanLabel">
<property name="text"> <property name="text">
<string>Aux 3</string> <string>0000</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="3" column="2">
<widget class="QSpinBox" name="pitchSpinBox"> <widget class="QCheckBox" name="invertCheckBox_3">
<property name="enabled"> <property name="text">
<bool>false</bool> <string>Reverse</string>
</property> </property>
<property name="minimum"> </widget>
<number>0</number> </item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Normalized Value</string>
</property> </property>
<property name="maximum"> <property name="alignment">
<number>16</number> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="2" column="2">
<widget class="QCheckBox" name="invertCheckBox_3"> <widget class="QCheckBox" name="invertCheckBox_2">
<property name="text"> <property name="text">
<string>Reverse</string> <string>Reverse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="3"> <item row="2" column="4">
<widget class="QSpinBox" name="modeSpinBox"> <widget class="QPushButton" name="pitchButton">
<property name="text">
<string>Identify Pitch Channel</string>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="QCheckBox" name="aux1InvertCheckBox">
<property name="text">
<string>Reverse</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="assistSwChanLabel">
<property name="text">
<string>0000</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QSpinBox" name="yawSpinBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
...@@ -630,42 +760,55 @@ Config</string> ...@@ -630,42 +760,55 @@ Config</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="2"> <item row="1" column="4">
<widget class="QCheckBox" name="invertCheckBox_5"> <widget class="QPushButton" name="rollButton">
<property name="text"> <property name="text">
<string>Reverse</string> <string>Identify Roll Channel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="7" column="0">
<widget class="QLabel" name="chanName_5"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Mode Switch</string> <string>Mission Switch</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="2"> <item row="4" column="1">
<widget class="QCheckBox" name="invertCheckBox_6"> <widget class="QLabel" name="throttleChanLabel">
<property name="text"> <property name="text">
<string>Reverse</string> <string>0000</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="4" column="0">
<widget class="QLabel" name="modeChanLabel"> <widget class="QLabel" name="chanName_4">
<property name="text"> <property name="text">
<string>0000</string> <string>Throttle</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="9" column="0">
<widget class="QLabel" name="aux3ChanLabel"> <widget class="QLabel" name="label_10">
<property name="text">
<string>Flaps</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="flapsChanLabel">
<property name="text"> <property name="text">
<string>0000</string> <string>0000</string>
</property> </property>
...@@ -675,72 +818,68 @@ Config</string> ...@@ -675,72 +818,68 @@ Config</string>
</widget> </widget>
</item> </item>
<item row="7" column="2"> <item row="7" column="2">
<widget class="QCheckBox" name="invertCheckBox_7"> <widget class="QCheckBox" name="missionSwInvertCheckBox">
<property name="text"> <property name="text">
<string>Reverse</string> <string>Reverse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="3"> <item row="8" column="2">
<widget class="QSpinBox" name="aux3SpinBox"> <widget class="QCheckBox" name="returnSwInvertCheckBox">
<property name="enabled"> <property name="text">
<bool>false</bool> <string>Reverse</string>
</property>
<property name="minimum">
<number>0</number>
</property> </property>
<property name="maximum"> </widget>
<number>16</number> </item>
<item row="9" column="2">
<widget class="QCheckBox" name="flapsInvertCheckBox">
<property name="text">
<string>Reverse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="3"> <item row="7" column="3">
<widget class="QSpinBox" name="aux2SpinBox"> <widget class="QSpinBox" name="missionSwSpinBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimum"> </widget>
<number>0</number> </item>
</property> <item row="8" column="3">
<property name="maximum"> <widget class="QSpinBox" name="returnSwSpinBox">
<number>16</number> <property name="enabled">
<bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="9" column="3">
<widget class="QLabel" name="chanName_6"> <widget class="QSpinBox" name="flapsSpinBox">
<property name="text"> <property name="enabled">
<string>Aux 1</string> <bool>false</bool>
</property> </property>
<property name="alignment"> <property name="cursor">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <cursorShape>ArrowCursor</cursorShape>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="7" column="4">
<widget class="QLabel" name="throttleChanLabel"> <widget class="QPushButton" name="missionSwButton">
<property name="text"> <property name="text">
<string>0000</string> <string>Identify Mission Switch</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="8" column="4">
<widget class="QLabel" name="pitchChanLabel"> <widget class="QPushButton" name="returnSwButton">
<property name="text"> <property name="text">
<string>0000</string> <string>Identify Return Switch</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3" colspan="2"> <item row="9" column="4">
<widget class="QLabel" name="label_4"> <widget class="QPushButton" name="flapsButton">
<property name="text"> <property name="text">
<string>Mapping to Index of RC Channel used for (0 if not used)</string> <string>Identify Flaps Channel</string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -881,8 +1020,8 @@ Config</string> ...@@ -881,8 +1020,8 @@ Config</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>16</width> <width>98</width>
<height>16</height> <height>28</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
...@@ -918,8 +1057,8 @@ Config</string> ...@@ -918,8 +1057,8 @@ Config</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>16</width> <width>98</width>
<height>16</height> <height>28</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
...@@ -1010,8 +1149,8 @@ Config</string> ...@@ -1010,8 +1149,8 @@ Config</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>597</width> <width>98</width>
<height>569</height> <height>28</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
......
...@@ -56,7 +56,7 @@ QGCPX4AirframeConfig::QGCPX4AirframeConfig(QWidget *parent) : ...@@ -56,7 +56,7 @@ QGCPX4AirframeConfig::QGCPX4AirframeConfig(QWidget *parent) :
connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(applyAndReboot())); connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(applyAndReboot()));
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS())); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
setActiveUAS(UASManager::instance()->getActiveUAS()); setActiveUAS(UASManager::instance()->getActiveUAS());
......
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