Added YAML serialPort
TODO: - restrict serial modes for VCP - allow a function to be assigned only to one port
This commit is contained in:
@@ -418,9 +418,12 @@ QString GeneralSettings::bluetoothModeToString() const
|
||||
return bluetoothModeToString(bluetoothMode);
|
||||
}
|
||||
|
||||
QString GeneralSettings::auxSerialModeToString() const
|
||||
QString GeneralSettings::serialPortModeToString(int port_nr) const
|
||||
{
|
||||
return auxSerialModeToString(auxSerialMode);
|
||||
if (port_nr < 0 || port_nr >= SP_COUNT)
|
||||
return QString();
|
||||
|
||||
return serialModeToString(serialPort[port_nr]);
|
||||
}
|
||||
|
||||
QString GeneralSettings::telemetryBaudrateToString() const
|
||||
@@ -467,7 +470,7 @@ QString GeneralSettings::bluetoothModeToString(int value)
|
||||
}
|
||||
|
||||
// static
|
||||
QString GeneralSettings::auxSerialModeToString(int value)
|
||||
QString GeneralSettings::serialModeToString(int value)
|
||||
{
|
||||
switch(value) {
|
||||
case AUX_SERIAL_OFF:
|
||||
@@ -480,6 +483,12 @@ QString GeneralSettings::auxSerialModeToString(int value)
|
||||
return tr("SBUS Trainer");
|
||||
case AUX_SERIAL_LUA:
|
||||
return tr("LUA");
|
||||
case AUX_SERIAL_CLI:
|
||||
return tr("CLI");
|
||||
case AUX_SERIAL_GPS:
|
||||
return tr("GPS");
|
||||
case AUX_SERIAL_DEBUG:
|
||||
return tr("Debug");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
@@ -546,13 +555,14 @@ AbstractStaticItemModel * GeneralSettings::bluetoothModeItemModel()
|
||||
}
|
||||
|
||||
// static
|
||||
AbstractStaticItemModel * GeneralSettings::auxSerialModeItemModel()
|
||||
AbstractStaticItemModel * GeneralSettings::serialModeItemModel(int port_nr)
|
||||
{
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName(AIM_GS_AUXSERIALMODE);
|
||||
mdl->setName(QString(AIM_GS_SERIALMODE).arg(port_nr));
|
||||
|
||||
for (int i = 0; i < AUX_SERIAL_COUNT; i++) {
|
||||
mdl->appendToItemList(auxSerialModeToString(i), i);
|
||||
// TODO: check if supported on 'port_nr'
|
||||
mdl->appendToItemList(serialModeToString(i), i);
|
||||
}
|
||||
|
||||
mdl->loadItemList();
|
||||
|
||||
Reference in New Issue
Block a user