1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 09:45:21 +03:00

Add BT mode handling (#5926)

Enable BT for Xlite and X7
This commit is contained in:
3djc 2018-06-02 18:15:37 +02:00 committed by Bertrand Songis
parent e3f2664440
commit a87722b078
5 changed files with 24 additions and 10 deletions

View file

@ -134,7 +134,6 @@ class GeneralSettings {
unsigned int mAhWarn; unsigned int mAhWarn;
unsigned int mAhUsed; unsigned int mAhUsed;
unsigned int globalTimer; unsigned int globalTimer;
bool bluetoothEnable;
char bluetoothName[10+1]; char bluetoothName[10+1];
unsigned int bluetoothBaudrate; unsigned int bluetoothBaudrate;
unsigned int bluetoothMode; unsigned int bluetoothMode;

View file

@ -3836,7 +3836,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name")); internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name"));
} }
else if (IS_TARANIS_X9E(board) && version >= 217) { else if (IS_TARANIS_X9E(board) && version >= 217) {
internalField.Append(new BoolField<8>(this, generalData.bluetoothEnable)); internalField.Append(new UnsignedField<8>(this, generalData.bluetoothMode));
internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name")); internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name"));
} }

View file

@ -157,8 +157,8 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
ui->txCurrentCalibrationLabel->hide(); ui->txCurrentCalibrationLabel->hide();
} }
if (IS_TARANIS_X9E(board) || IS_HORUS(board)) { if (IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board)|| IS_TARANIS_X9E(board) || IS_HORUS(board)) {
ui->bluetoothEnable->setChecked(generalSettings.bluetoothEnable); ui->bluetoothMode->setCurrentIndex(generalSettings.bluetoothMode);
ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this); ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this);
} }
else { else {
@ -238,9 +238,9 @@ void HardwarePanel::on_txCurrentCalibration_editingFinished()
} }
} }
void HardwarePanel::on_bluetoothEnable_stateChanged(int) void HardwarePanel::on_bluetoothMode_stateChanged(int index)
{ {
generalSettings.bluetoothEnable = ui->bluetoothEnable->isChecked(); generalSettings.bluetoothMode = index;
emit modified(); emit modified();
} }

View file

@ -48,7 +48,7 @@ class HardwarePanel : public GeneralPanel
void on_txCurrentCalibration_editingFinished(); void on_txCurrentCalibration_editingFinished();
void on_txVoltageCalibration_editingFinished(); void on_txVoltageCalibration_editingFinished();
void on_bluetoothEnable_stateChanged(int); void on_bluetoothMode_stateChanged(int);
void on_filterEnable_stateChanged(); void on_filterEnable_stateChanged();
void on_serialPortMode_currentIndexChanged(int index); void on_serialPortMode_currentIndexChanged(int index);

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>470</width> <width>470</width>
<height>1095</height> <height>1419</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -1099,10 +1099,25 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QCheckBox" name="bluetoothEnable"> <widget class="QComboBox" name="bluetoothMode">
<property name="text"> <property name="text" stdset="0">
<string/> <string/>
</property> </property>
<item>
<property name="text">
<string>OFF</string>
</property>
</item>
<item>
<property name="text">
<string>Telemetry</string>
</property>
</item>
<item>
<property name="text">
<string>Trainer</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item>