diff --git a/ground/openpilotgcs/src/plugins/config/airframe.ui b/ground/openpilotgcs/src/plugins/config/airframe.ui index 36ec7f122..9609b357a 100644 --- a/ground/openpilotgcs/src/plugins/config/airframe.ui +++ b/ground/openpilotgcs/src/plugins/config/airframe.ui @@ -20,13 +20,13 @@ - 9 + 0 - 9 + 0 - 9 + 0 9 @@ -61,7 +61,7 @@ - + 0 @@ -78,10 +78,10 @@ - 10 + 20 - Enter name of vehicle. Max 10 characters. + Enter name of vehicle. Max 20 characters. @@ -242,7 +242,7 @@ 0 0 820 - 427 + 435 diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp index c2f64300d..7b227db28 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp @@ -121,6 +121,10 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi m_aircraft->saveAircraftToRAM->setVisible(false); } + SystemSettings *syssettings = SystemSettings::GetInstance(getObjectManager()); + Q_ASSERT(syssettings); + m_aircraft->nameEdit->setMaxLength(syssettings->VEHICLENAME_NUMELEM); + addApplySaveButtons(m_aircraft->saveAircraftToRAM, m_aircraft->saveAircraftToSD); addUAVObject("SystemSettings"); @@ -158,6 +162,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi addWidget(m_aircraft->ffTestBox1); addWidget(m_aircraft->ffTestBox2); addWidget(m_aircraft->ffTestBox3); + addWidget(m_aircraft->nameEdit); disableMouseWheelEvents(); updateEnableControls(); @@ -224,6 +229,19 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject *o) } } + field = system->getField(QString("VehicleName")); + Q_ASSERT(field); + QString name; + for (uint i = 0; i < field->getNumElements(); ++i) { + QChar chr = field->getValue(i).toChar(); + if (chr != 0) { + name.append(chr); + } else { + break; + } + } + m_aircraft->nameEdit->setText(name); + updateFeedForwardUI(); setDirty(dirty); @@ -270,6 +288,17 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets() vconfig->setMixerValue(mixer, "DecelTime", m_aircraft->decelTime->value()); vconfig->setMixerValue(mixer, "MaxAccel", m_aircraft->maxAccelSlider->value()); + field = system->getField(QString("VehicleName")); + Q_ASSERT(field); + QString name = m_aircraft->nameEdit->text(); + for (uint i = 0; i < field->getNumElements(); ++i) { + if (i < name.length()) { + field->setValue(name.at(i).toLatin1(), i); + } else { + field->setValue(0, i); + } + } + // call refreshWidgetsValues() to reflect actual saved values refreshWidgetsValues(); updateFeedForwardUI(); diff --git a/shared/uavobjectdefinition/systemsettings.xml b/shared/uavobjectdefinition/systemsettings.xml index 720b0786d..8f86537d7 100644 --- a/shared/uavobjectdefinition/systemsettings.xml +++ b/shared/uavobjectdefinition/systemsettings.xml @@ -2,7 +2,7 @@ Select airframe type. Currently used by @ref ActuatorModule to choose mixing from @ref ActuatorDesired to @ref ActuatorCommand - +