Commit e4776615 authored by Michael Carpenter's avatar Michael Carpenter

Change for all config widgets to use the Parameter Manager for setting parameters

parent fad0c692
......@@ -1019,7 +1019,7 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
}
if (parameters.value(component)->value(parameterName) == value)
{
qDebug() << "Value not changed, not sending:" << parameterName << value;
statusLabel->setText(tr("REJ. %1 > max").arg(value.toDouble()));
return;
}
......
......@@ -56,11 +56,11 @@ void AirspeedConfig::useCheckBoxClicked(bool checked)
}
if (checked)
{
m_uas->setParameter(0,"ARSPD_USE",1);
m_uas->getParamManager()->setParameter(1,"ARSPD_USE",1);
}
else
{
m_uas->setParameter(0,"ARSPD_USE",0);
m_uas->getParamManager()->setParameter(1,"ARSPD_USE",0);
}
}
......@@ -73,10 +73,10 @@ void AirspeedConfig::enableCheckBoxClicked(bool checked)
}
if (checked)
{
m_uas->setParameter(0,"ARSPD_ENABLE",1);
m_uas->getParamManager()->setParameter(1,"ARSPD_ENABLE",1);
}
else
{
m_uas->setParameter(0,"ARSPD_ENABLE",0);
m_uas->getParamManager()->setParameter(1,"ARSPD_ENABLE",0);
}
}
......@@ -47,7 +47,7 @@ void BatteryMonitorConfig::calcDividerSet()
QMessageBox::information(0,"Error","Invalid number entered for voltage divider. Please try again");
return;
}
m_uas->setParameter(0,"VOLT_DIVIDER",newval);
m_uas->getParamManager()->setParameter(1,"VOLT_DIVIDER",newval);
}
void BatteryMonitorConfig::ampsPerVoltSet()
{
......@@ -64,7 +64,7 @@ void BatteryMonitorConfig::ampsPerVoltSet()
QMessageBox::information(0,"Error","Invalid number entered for amps per volts. Please try again");
return;
}
m_uas->setParameter(0,"AMPS_PER_VOLT",newval);
m_uas->getParamManager()->setParameter(1,"AMPS_PER_VOLT",newval);
}
void BatteryMonitorConfig::batteryCapacitySet()
{
......@@ -81,7 +81,7 @@ void BatteryMonitorConfig::batteryCapacitySet()
QMessageBox::information(0,"Error","Invalid number entered for amps per volts. Please try again");
return;
}
m_uas->setParameter(0,"BATT_CAPACITY",newval);
m_uas->getParamManager()->setParameter(1,"BATT_CAPACITY",newval);
}
void BatteryMonitorConfig::monitorCurrentIndexChanged(int index)
......@@ -93,9 +93,9 @@ void BatteryMonitorConfig::monitorCurrentIndexChanged(int index)
}
if (index == 0)
{
m_uas->setParameter(0,"BATT_VOLT_PIN",-1);
m_uas->setParameter(0,"BATT_CURR_PIN",-1);
m_uas->setParameter(0,"BATT_MONITOR",0);
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",-1);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",-1);
m_uas->getParamManager()->setParameter(1,"BATT_MONITOR",0);
ui.sensorComboBox->setEnabled(false);
ui.apmVerComboBox->setEnabled(false);
ui.measuredVoltsLineEdit->setEnabled(false);
......@@ -106,7 +106,7 @@ void BatteryMonitorConfig::monitorCurrentIndexChanged(int index)
}
else if (index == 1)
{
m_uas->setParameter(0,"BATT_MONITOR",3);
m_uas->getParamManager()->setParameter(1,"BATT_MONITOR",3);
ui.sensorComboBox->setEnabled(false);
ui.apmVerComboBox->setEnabled(true);
ui.measuredVoltsLineEdit->setEnabled(true);
......@@ -116,7 +116,7 @@ void BatteryMonitorConfig::monitorCurrentIndexChanged(int index)
}
else if (index == 2)
{
m_uas->setParameter(0,"BATT_MONITOR",4);
m_uas->getParamManager()->setParameter(1,"BATT_MONITOR",4);
ui.sensorComboBox->setEnabled(true);
ui.apmVerComboBox->setEnabled(true);
ui.measuredVoltsLineEdit->setEnabled(true);
......@@ -197,24 +197,24 @@ void BatteryMonitorConfig::apmVerCurrentIndexChanged(int index)
}
if (index == 0) //APM1
{
m_uas->setParameter(0,"BATT_VOLT_PIN",0);
m_uas->setParameter(0,"BATT_CURR_PIN",1);
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",0);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",1);
}
else if (index == 1) //APM2
{
m_uas->setParameter(0,"BATT_VOLT_PIN",1);
m_uas->setParameter(0,"BATT_CURR_PIN",2);
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",1);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",2);
}
else if (index == 2) //APM2.5
{
m_uas->setParameter(0,"BATT_VOLT_PIN",13);
m_uas->setParameter(0,"BATT_CURR_PIN",12);
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",13);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",12);
}
else if (index == 3) //PX4
{
m_uas->setParameter(0,"BATT_VOLT_PIN",100);
m_uas->setParameter(0,"BATT_CURR_PIN",101);
m_uas->setParameter(0,"VOLT_DIVIDER",1);
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",100);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",101);
m_uas->getParamManager()->setParameter(1,"VOLT_DIVIDER",1);
ui.calcDividerLineEdit->setText("1");
}
}
......
......@@ -71,7 +71,7 @@ void CompassConfig::enableClicked(bool enabled)
{
if (enabled)
{
m_uas->setParameter(0,"MAG_ENABLE",QVariant(1));
m_uas->getParamManager()->setParameter(1,"MAG_ENABLE",QVariant(1));
ui.autoDecCheckBox->setEnabled(true);
if (!ui.autoDecCheckBox->isChecked())
{
......@@ -80,7 +80,7 @@ void CompassConfig::enableClicked(bool enabled)
}
else
{
m_uas->setParameter(0,"MAG_ENABLE",QVariant(0));
m_uas->getParamManager()->setParameter(1,"MAG_ENABLE",QVariant(0));
ui.autoDecCheckBox->setEnabled(false);
ui.declinationLineEdit->setEnabled(false);
}
......@@ -93,11 +93,11 @@ void CompassConfig::autoDecClicked(bool enabled)
{
if (enabled)
{
m_uas->setParameter(0,"COMPASS_AUTODEC",QVariant(1));
m_uas->getParamManager()->setParameter(1,"COMPASS_AUTODEC",QVariant(1));
}
else
{
m_uas->setParameter(0,"COMPASS_AUTODEC",QVariant(0));
m_uas->getParamManager()->setParameter(1,"COMPASS_AUTODEC",QVariant(0));
}
}
}
......
......@@ -135,29 +135,29 @@ void FlightModeConfig::saveButtonClicked()
{
if (m_uas->getSystemType() == MAV_TYPE_FIXED_WING)
{
m_uas->setParameter(0,"FLTMODE1",(char)planeModeUiIndexToIndex[ui.mode1ComboBox->currentIndex()]);
m_uas->setParameter(0,"FLTMODE2",(char)planeModeUiIndexToIndex[ui.mode2ComboBox->currentIndex()]);
m_uas->setParameter(0,"FLTMODE3",(char)planeModeUiIndexToIndex[ui.mode3ComboBox->currentIndex()]);
m_uas->setParameter(0,"FLTMODE4",(char)planeModeUiIndexToIndex[ui.mode4ComboBox->currentIndex()]);
m_uas->setParameter(0,"FLTMODE5",(char)planeModeUiIndexToIndex[ui.mode5ComboBox->currentIndex()]);
m_uas->setParameter(0,"FLTMODE6",(char)planeModeUiIndexToIndex[ui.mode6ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"FLTMODE1",(char)planeModeUiIndexToIndex[ui.mode1ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"FLTMODE2",(char)planeModeUiIndexToIndex[ui.mode2ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"FLTMODE3",(char)planeModeUiIndexToIndex[ui.mode3ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"FLTMODE4",(char)planeModeUiIndexToIndex[ui.mode4ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"FLTMODE5",(char)planeModeUiIndexToIndex[ui.mode5ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"FLTMODE6",(char)planeModeUiIndexToIndex[ui.mode6ComboBox->currentIndex()]);
}
else if (m_uas->getSystemType() == MAV_TYPE_GROUND_ROVER)
{
m_uas->setParameter(0,"MODE1",(char)roverModeUiIndexToIndex[ui.mode1ComboBox->currentIndex()]);
m_uas->setParameter(0,"MODE2",(char)roverModeUiIndexToIndex[ui.mode2ComboBox->currentIndex()]);
m_uas->setParameter(0,"MODE3",(char)roverModeUiIndexToIndex[ui.mode3ComboBox->currentIndex()]);
m_uas->setParameter(0,"MODE4",(char)roverModeUiIndexToIndex[ui.mode4ComboBox->currentIndex()]);
m_uas->setParameter(0,"MODE5",(char)roverModeUiIndexToIndex[ui.mode5ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"MODE1",(char)roverModeUiIndexToIndex[ui.mode1ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"MODE2",(char)roverModeUiIndexToIndex[ui.mode2ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"MODE3",(char)roverModeUiIndexToIndex[ui.mode3ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"MODE4",(char)roverModeUiIndexToIndex[ui.mode4ComboBox->currentIndex()]);
m_uas->getParamManager()->setParameter(1,"MODE5",(char)roverModeUiIndexToIndex[ui.mode5ComboBox->currentIndex()]);
}
else if (m_uas->getSystemType() == MAV_TYPE_QUADROTOR)
{
m_uas->setParameter(0,"FLTMODE1",(char)ui.mode1ComboBox->currentIndex()+1);
m_uas->setParameter(0,"FLTMODE2",(char)ui.mode2ComboBox->currentIndex()+1);
m_uas->setParameter(0,"FLTMODE3",(char)ui.mode3ComboBox->currentIndex()+1);
m_uas->setParameter(0,"FLTMODE4",(char)ui.mode4ComboBox->currentIndex()+1);
m_uas->setParameter(0,"FLTMODE5",(char)ui.mode5ComboBox->currentIndex()+1);
m_uas->setParameter(0,"FLTMODE6",(char)ui.mode6ComboBox->currentIndex()+1);
m_uas->getParamManager()->setParameter(1,"FLTMODE1",(char)ui.mode1ComboBox->currentIndex()+1);
m_uas->getParamManager()->setParameter(1,"FLTMODE2",(char)ui.mode2ComboBox->currentIndex()+1);
m_uas->getParamManager()->setParameter(1,"FLTMODE3",(char)ui.mode3ComboBox->currentIndex()+1);
m_uas->getParamManager()->setParameter(1,"FLTMODE4",(char)ui.mode4ComboBox->currentIndex()+1);
m_uas->getParamManager()->setParameter(1,"FLTMODE5",(char)ui.mode5ComboBox->currentIndex()+1);
m_uas->getParamManager()->setParameter(1,"FLTMODE6",(char)ui.mode6ComboBox->currentIndex()+1);
}
}
......
......@@ -88,7 +88,7 @@ void FrameTypeConfig::xFrameSelected()
{
if (m_uas)
{
m_uas->setParameter(0,"FRAME",QVariant(1));
m_uas->getParamManager()->setParameter(1,"FRAME",QVariant(1));
}
}
......@@ -96,7 +96,7 @@ void FrameTypeConfig::plusFrameSelected()
{
if (m_uas)
{
m_uas->setParameter(0,"FRAME",QVariant(0));
m_uas->getParamManager()->setParameter(1,"FRAME",QVariant(0));
}
}
......@@ -104,6 +104,6 @@ void FrameTypeConfig::vFrameSelected()
{
if (m_uas)
{
m_uas->setParameter(0,"FRAME",QVariant(2));
m_uas->getParamManager()->setParameter(1,"FRAME",QVariant(2));
}
}
......@@ -32,5 +32,5 @@ void OpticalFlowConfig::enableCheckBoxClicked(bool checked)
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
m_uas->setParameter(0,"FLOW_ENABLE",checked ? 1 : 0);
m_uas->getParamManager()->setParameter(1,"FLOW_ENABLE",checked ? 1 : 0);
}
......@@ -17,21 +17,21 @@ void OsdConfig::enableButtonClicked()
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
m_uas->setParameter(0,"SR0_EXT_STAT",2);
m_uas->setParameter(0,"SR0_EXTRA1",10);
m_uas->setParameter(0,"SR0_EXTRA2",10);
m_uas->setParameter(0,"SR0_EXTRA3",2);
m_uas->setParameter(0,"SR0_POSITION",3);
m_uas->setParameter(0,"SR0_RAW_CTRL",2);
m_uas->setParameter(0,"SR0_RAW_SENS",2);
m_uas->setParameter(0,"SR0_RC_CHAN",2);
m_uas->getParamManager()->setParameter(1,"SR0_EXT_STAT",2);
m_uas->getParamManager()->setParameter(1,"SR0_EXTRA1",10);
m_uas->getParamManager()->setParameter(1,"SR0_EXTRA2",10);
m_uas->getParamManager()->setParameter(1,"SR0_EXTRA3",2);
m_uas->getParamManager()->setParameter(1,"SR0_POSITION",3);
m_uas->getParamManager()->setParameter(1,"SR0_RAW_CTRL",2);
m_uas->getParamManager()->setParameter(1,"SR0_RAW_SENS",2);
m_uas->getParamManager()->setParameter(1,"SR0_RC_CHAN",2);
m_uas->setParameter(0,"SR3_EXT_STAT",2);
m_uas->setParameter(0,"SR3_EXTRA1",10);
m_uas->setParameter(0,"SR3_EXTRA2",10);
m_uas->setParameter(0,"SR3_EXTRA3",2);
m_uas->setParameter(0,"SR3_POSITION",3);
m_uas->setParameter(0,"SR3_RAW_CTRL",2);
m_uas->setParameter(0,"SR3_RAW_SENS",2);
m_uas->setParameter(0,"SR3_RC_CHAN",2);
m_uas->getParamManager()->setParameter(1,"SR3_EXT_STAT",2);
m_uas->getParamManager()->setParameter(1,"SR3_EXTRA1",10);
m_uas->getParamManager()->setParameter(1,"SR3_EXTRA2",10);
m_uas->getParamManager()->setParameter(1,"SR3_EXTRA3",2);
m_uas->getParamManager()->setParameter(1,"SR3_POSITION",3);
m_uas->getParamManager()->setParameter(1,"SR3_RAW_CTRL",2);
m_uas->getParamManager()->setParameter(1,"SR3_RAW_SENS",2);
m_uas->getParamManager()->setParameter(1,"SR3_RC_CHAN",2);
}
......@@ -213,11 +213,11 @@ void RadioCalibrationConfig::calibrateButtonClicked()
{
qDebug() << "SENDING MIN" << minTpl.arg(i+1) << rcMin[i];
qDebug() << "SENDING MAX" << maxTpl.arg(i+1) << rcMax[i];
m_uas->setParameter(0, minTpl.arg(i+1), (float)rcMin[i]);
m_uas->getParamManager()->setParameter(1, minTpl.arg(i+1), (float)rcMin[i]);
QGC::SLEEP::usleep(50000);
//m_uas->setParameter(0, trimTpl.arg(i+1), rcTrim[i]);
//QGC::SLEEP::usleep(50000);
m_uas->setParameter(0, maxTpl.arg(i+1), (float)rcMax[i]);
m_uas->getParamManager()->setParameter(1, maxTpl.arg(i+1), (float)rcMax[i]);
QGC::SLEEP::usleep(50000);
}
ui.rollWidget->setMin(800);
......
......@@ -26,7 +26,7 @@ void SonarConfig::checkBoxToggled(bool enabled)
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
m_uas->setParameter(0,"SONAR_ENABLE",ui.enableCheckBox->isChecked() ? 1 : 0);
m_uas->getParamManager()->setParameter(1,"SONAR_ENABLE",ui.enableCheckBox->isChecked() ? 1 : 0);
}
void SonarConfig::sonarTypeChanged(int index)
{
......@@ -35,7 +35,7 @@ void SonarConfig::sonarTypeChanged(int index)
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
m_uas->setParameter(0,"SONAR_TYPE",ui.sonarTypeComboBox->currentIndex());
m_uas->getParamManager()->setParameter(1,"SONAR_TYPE",ui.sonarTypeComboBox->currentIndex());
}
void SonarConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
......
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