mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-24 00:35:14 +03:00
[Taranis X9E] Bluetooth can be stopped and device name is now
configurable
This commit is contained in:
parent
a3c267b9be
commit
be24ff122b
11 changed files with 345 additions and 249 deletions
|
@ -1095,6 +1095,10 @@ GeneralSettings::GeneralSettings()
|
||||||
speakerVolume = 12;
|
speakerVolume = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_TARANIS_X9E(board)) {
|
||||||
|
strcpy(bluetoothName, "Taranis");
|
||||||
|
}
|
||||||
|
|
||||||
templateSetup = g.profile[g.id()].channelOrder();
|
templateSetup = g.profile[g.id()].channelOrder();
|
||||||
stickMode = g.profile[g.id()].defaultMode();
|
stickMode = g.profile[g.id()].defaultMode();
|
||||||
|
|
||||||
|
|
|
@ -1174,6 +1174,8 @@ 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];
|
||||||
unsigned int btBaudrate;
|
unsigned int btBaudrate;
|
||||||
unsigned int sticksGain;
|
unsigned int sticksGain;
|
||||||
unsigned int rotarySteps;
|
unsigned int rotarySteps;
|
||||||
|
|
|
@ -3444,6 +3444,11 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
||||||
internalField.Append(new ZCharField<3>(generalData.sliderName[i]));
|
internalField.Append(new ZCharField<3>(generalData.sliderName[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_TARANIS_X9E(board) && version >= 217) {
|
||||||
|
internalField.Append(new BoolField<8>(generalData.bluetoothEnable));
|
||||||
|
internalField.Append(new ZCharField<10>(generalData.bluetoothName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,16 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
|
||||||
ui->serialPortLabel->hide();
|
ui->serialPortLabel->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_TARANIS_X9E(firmware->getBoard())) {
|
||||||
|
ui->bluetoothEnable->setChecked(generalSettings.bluetoothEnable);
|
||||||
|
ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->bluetoothLabel->hide();
|
||||||
|
ui->bluetoothEnable->hide();
|
||||||
|
ui->bluetoothName->hide();
|
||||||
|
}
|
||||||
|
|
||||||
disableMouseScrolling();
|
disableMouseScrolling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +218,12 @@ void CalibrationPanel::on_CurrentCalib_SB_editingFinished()
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalibrationPanel::on_bluetoothEnable_stateChanged(int)
|
||||||
|
{
|
||||||
|
generalSettings.bluetoothEnable = ui->bluetoothEnable->isChecked();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
|
||||||
void CalibrationPanel::setValues()
|
void CalibrationPanel::setValues()
|
||||||
{
|
{
|
||||||
ui->battCalibDSB->setValue((double)generalSettings.vBatCalib/10);
|
ui->battCalibDSB->setValue((double)generalSettings.vBatCalib/10);
|
||||||
|
|
|
@ -29,6 +29,7 @@ class CalibrationPanel : public GeneralPanel
|
||||||
void on_PPM_MultiplierDSB_editingFinished();
|
void on_PPM_MultiplierDSB_editingFinished();
|
||||||
|
|
||||||
void on_CurrentCalib_SB_editingFinished();
|
void on_CurrentCalib_SB_editingFinished();
|
||||||
|
void on_bluetoothEnable_stateChanged(int);
|
||||||
|
|
||||||
void on_ana1Neg_editingFinished();
|
void on_ana1Neg_editingFinished();
|
||||||
void on_ana2Neg_editingFinished();
|
void on_ana2Neg_editingFinished();
|
||||||
|
|
|
@ -7,13 +7,36 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>805</width>
|
<width>805</width>
|
||||||
<height>1188</height>
|
<height>1269</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,0,0,0,0,0,0">
|
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,0,0,0,0,0,0">
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QSpinBox" name="ana4Mid">
|
||||||
|
<property name="statusTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-9999</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>9999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="40" column="0" alignment="Qt::AlignLeft">
|
||||||
|
<widget class="QLabel" name="serialPortLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Serial Port</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="35" column="0">
|
<item row="35" column="0">
|
||||||
<widget class="QLabel" name="sqLabel">
|
<widget class="QLabel" name="sqLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -83,13 +106,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="36" column="1">
|
|
||||||
<widget class="AutoLineEdit" name="srName">
|
|
||||||
<property name="maxLength">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="33" column="0">
|
<item row="33" column="0">
|
||||||
<widget class="QLabel" name="soLabel">
|
<widget class="QLabel" name="soLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -138,13 +154,23 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="38" column="0" alignment="Qt::AlignLeft">
|
<item row="2" column="6">
|
||||||
<widget class="QLabel" name="serialPortLabel">
|
<widget class="QSpinBox" name="ana6Neg">
|
||||||
<property name="text">
|
<property name="statusTip">
|
||||||
<string>Serial Port</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="minimum">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<number>-9999</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>9999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_17">
|
||||||
|
<property name="text">
|
||||||
|
<string>Stick 3</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -206,7 +232,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="38" column="1">
|
<item row="40" column="1">
|
||||||
<widget class="QComboBox" name="serialPortMode">
|
<widget class="QComboBox" name="serialPortMode">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -347,20 +373,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="43" column="0">
|
<item row="45" column="0">
|
||||||
<widget class="QLabel" name="label_23">
|
<widget class="QLabel" name="label_23">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>PPM 1</string>
|
<string>PPM 1</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_17">
|
|
||||||
<property name="text">
|
|
||||||
<string>Stick 3</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="label_24">
|
<widget class="QLabel" name="label_24">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -427,7 +446,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="45" column="0">
|
<item row="47" column="0">
|
||||||
<widget class="QLabel" name="label_33">
|
<widget class="QLabel" name="label_33">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>PPM 2</string>
|
<string>PPM 2</string>
|
||||||
|
@ -529,19 +548,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
|
||||||
<widget class="QSpinBox" name="ana4Mid">
|
|
||||||
<property name="statusTip">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-9999</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>9999</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="3">
|
<item row="4" column="3">
|
||||||
<widget class="QSpinBox" name="ana4Pos">
|
<widget class="QSpinBox" name="ana4Pos">
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
|
@ -555,14 +561,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="40" column="0">
|
<item row="42" column="0">
|
||||||
<widget class="QLabel" name="label_22">
|
<widget class="QLabel" name="label_22">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Battery</string>
|
<string>Battery</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="40" column="1">
|
<item row="42" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="battCalibDSB">
|
<widget class="QDoubleSpinBox" name="battCalibDSB">
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
<string/>
|
<string/>
|
||||||
|
@ -584,14 +590,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="48" column="0">
|
<item row="50" column="0">
|
||||||
<widget class="QLabel" name="label_30">
|
<widget class="QLabel" name="label_30">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>PPM Multiplier</string>
|
<string>PPM Multiplier</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="45" column="1">
|
<item row="47" column="1">
|
||||||
<widget class="QSpinBox" name="PPM2">
|
<widget class="QSpinBox" name="PPM2">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string/>
|
||||||
|
@ -610,7 +616,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="46" column="1">
|
<item row="48" column="1">
|
||||||
<widget class="QSpinBox" name="PPM3">
|
<widget class="QSpinBox" name="PPM3">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string/>
|
||||||
|
@ -629,7 +635,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="47" column="1">
|
<item row="49" column="1">
|
||||||
<widget class="QSpinBox" name="PPM4">
|
<widget class="QSpinBox" name="PPM4">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string/>
|
||||||
|
@ -648,7 +654,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="43" column="1">
|
<item row="45" column="1">
|
||||||
<widget class="QSpinBox" name="PPM1">
|
<widget class="QSpinBox" name="PPM1">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string/>
|
||||||
|
@ -667,21 +673,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="46" column="0">
|
<item row="43" column="1">
|
||||||
<widget class="QLabel" name="label_34">
|
|
||||||
<property name="text">
|
|
||||||
<string>PPM 3</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="47" column="0">
|
|
||||||
<widget class="QLabel" name="label_35">
|
|
||||||
<property name="text">
|
|
||||||
<string>PPM 4</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="41" column="1">
|
|
||||||
<widget class="QSpinBox" name="CurrentCalib_SB">
|
<widget class="QSpinBox" name="CurrentCalib_SB">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>-49</number>
|
<number>-49</number>
|
||||||
|
@ -691,7 +683,21 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="41" column="0">
|
<item row="48" column="0">
|
||||||
|
<widget class="QLabel" name="label_34">
|
||||||
|
<property name="text">
|
||||||
|
<string>PPM 3</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="49" column="0">
|
||||||
|
<widget class="QLabel" name="label_35">
|
||||||
|
<property name="text">
|
||||||
|
<string>PPM 4</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="43" column="0">
|
||||||
<widget class="QLabel" name="label_CurrentCalib">
|
<widget class="QLabel" name="label_CurrentCalib">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Current</string>
|
<string>Current</string>
|
||||||
|
@ -711,30 +717,17 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="6">
|
<item row="30" column="2">
|
||||||
<widget class="QSpinBox" name="ana6Neg">
|
<widget class="AutoComboBox" name="slType">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="whatsThis">
|
||||||
<number>-9999</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>9999</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="7">
|
|
||||||
<widget class="QSpinBox" name="ana6Mid">
|
|
||||||
<property name="statusTip">
|
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
|
||||||
<number>-9999</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>9999</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="8">
|
<item row="2" column="8">
|
||||||
|
@ -763,6 +756,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="7">
|
||||||
|
<widget class="QSpinBox" name="ana6Mid">
|
||||||
|
<property name="statusTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-9999</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>9999</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="4" column="7">
|
<item row="4" column="7">
|
||||||
<widget class="QSpinBox" name="ana8Mid">
|
<widget class="QSpinBox" name="ana8Mid">
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
|
@ -815,16 +821,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="6">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Negative span</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" colspan="4">
|
<item row="5" column="0" colspan="4">
|
||||||
<widget class="Line" name="potsTypeSeparator">
|
<widget class="Line" name="potsTypeSeparator">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
|
@ -838,6 +834,23 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="6">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Negative span</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="AutoLineEdit" name="rudName">
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="8">
|
<item row="0" column="8">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -855,13 +868,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="AutoLineEdit" name="rudName">
|
|
||||||
<property name="maxLength">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="0">
|
<item row="11" column="0">
|
||||||
<widget class="QLabel" name="pot2Label">
|
<widget class="QLabel" name="pot2Label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -876,6 +882,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="AutoLineEdit" name="eleName">
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="19" column="0">
|
<item row="19" column="0">
|
||||||
<widget class="QLabel" name="saLabel">
|
<widget class="QLabel" name="saLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -890,8 +903,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="AutoLineEdit" name="eleName">
|
<widget class="AutoLineEdit" name="ailName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -904,20 +917,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
|
||||||
<widget class="AutoLineEdit" name="ailName">
|
|
||||||
<property name="maxLength">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="thrLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Thr</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="AutoLineEdit" name="thrName">
|
<widget class="AutoLineEdit" name="thrName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
|
@ -932,6 +931,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="thrLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Thr</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="15" column="1">
|
||||||
|
<widget class="AutoLineEdit" name="rsName">
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="21" column="0">
|
<item row="21" column="0">
|
||||||
<widget class="QLabel" name="scLabel">
|
<widget class="QLabel" name="scLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -939,8 +952,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="1">
|
<item row="21" column="1">
|
||||||
<widget class="AutoLineEdit" name="rsName">
|
<widget class="AutoLineEdit" name="scName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -953,8 +966,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="21" column="1">
|
<item row="22" column="1">
|
||||||
<widget class="AutoLineEdit" name="scName">
|
<widget class="AutoLineEdit" name="sdName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -973,8 +986,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="22" column="1">
|
<item row="23" column="1">
|
||||||
<widget class="AutoLineEdit" name="sdName">
|
<widget class="AutoLineEdit" name="seName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1000,8 +1013,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="23" column="1">
|
<item row="24" column="1">
|
||||||
<widget class="AutoLineEdit" name="seName">
|
<widget class="AutoLineEdit" name="sfName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1027,8 +1040,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="24" column="1">
|
<item row="25" column="1">
|
||||||
<widget class="AutoLineEdit" name="sfName">
|
<widget class="AutoLineEdit" name="sgName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1054,8 +1067,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="25" column="1">
|
<item row="26" column="1">
|
||||||
<widget class="AutoLineEdit" name="sgName">
|
<widget class="AutoLineEdit" name="shName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1081,8 +1094,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="26" column="1">
|
<item row="27" column="1">
|
||||||
<widget class="AutoLineEdit" name="shName">
|
<widget class="AutoLineEdit" name="siName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1095,8 +1108,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="27" column="1">
|
<item row="28" column="1">
|
||||||
<widget class="AutoLineEdit" name="siName">
|
<widget class="AutoLineEdit" name="sjName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1109,8 +1122,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="28" column="1">
|
<item row="29" column="1">
|
||||||
<widget class="AutoLineEdit" name="sjName">
|
<widget class="AutoLineEdit" name="skName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1123,8 +1136,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="29" column="1">
|
<item row="30" column="1">
|
||||||
<widget class="AutoLineEdit" name="skName">
|
<widget class="AutoLineEdit" name="slName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1137,8 +1150,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="30" column="1">
|
<item row="31" column="1">
|
||||||
<widget class="AutoLineEdit" name="slName">
|
<widget class="AutoLineEdit" name="smName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1151,8 +1164,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="31" column="1">
|
<item row="32" column="1">
|
||||||
<widget class="AutoLineEdit" name="smName">
|
<widget class="AutoLineEdit" name="snName">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1165,20 +1178,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="32" column="1">
|
|
||||||
<widget class="AutoLineEdit" name="snName">
|
|
||||||
<property name="maxLength">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="32" column="0">
|
|
||||||
<widget class="QLabel" name="snLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>SN</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="37" column="0" colspan="4">
|
<item row="37" column="0" colspan="4">
|
||||||
<widget class="Line" name="potsTypeSeparator_3">
|
<widget class="Line" name="potsTypeSeparator_3">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
|
@ -1192,7 +1191,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="42" column="0" colspan="4">
|
<item row="44" column="0" colspan="4">
|
||||||
<widget class="Line" name="potsTypeSeparator_4">
|
<widget class="Line" name="potsTypeSeparator_4">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -1205,7 +1204,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="48" column="1">
|
<item row="32" column="0">
|
||||||
|
<widget class="QLabel" name="snLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>SN</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="50" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="PPM_MultiplierDSB">
|
<widget class="QDoubleSpinBox" name="PPM_MultiplierDSB">
|
||||||
<property name="decimals">
|
<property name="decimals">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
|
@ -1218,6 +1224,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="17" column="1">
|
||||||
|
<widget class="AutoLineEdit" name="rs2Name">
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="17" column="0">
|
<item row="17" column="0">
|
||||||
<widget class="QLabel" name="rs2Label">
|
<widget class="QLabel" name="rs2Label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -1232,15 +1245,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="17" column="1">
|
<item row="27" column="2">
|
||||||
<widget class="AutoLineEdit" name="rs2Name">
|
<widget class="AutoComboBox" name="siType">
|
||||||
<property name="maxLength">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="26" column="2">
|
|
||||||
<widget class="AutoComboBox" name="shType">
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1252,8 +1258,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="27" column="2">
|
<item row="26" column="2">
|
||||||
<widget class="AutoComboBox" name="siType">
|
<widget class="AutoComboBox" name="shType">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1291,19 +1297,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="30" column="2">
|
|
||||||
<widget class="AutoComboBox" name="slType">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="statusTip">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="whatsThis">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="31" column="2">
|
<item row="31" column="2">
|
||||||
<widget class="AutoComboBox" name="smType">
|
<widget class="AutoComboBox" name="smType">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -1534,6 +1527,41 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="38" column="0">
|
||||||
|
<widget class="QLabel" name="bluetoothLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bluetooth</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="38" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="bluetoothEnable">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="AutoLineEdit" name="bluetoothName">
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="36" column="1">
|
||||||
|
<widget class="AutoLineEdit" name="srName">
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -70,6 +70,7 @@ enum menuGeneralHwItems {
|
||||||
CASE_REV9E(ITEM_SETUP_HW_SP)
|
CASE_REV9E(ITEM_SETUP_HW_SP)
|
||||||
CASE_REV9E(ITEM_SETUP_HW_SQ)
|
CASE_REV9E(ITEM_SETUP_HW_SQ)
|
||||||
CASE_REV9E(ITEM_SETUP_HW_SR)
|
CASE_REV9E(ITEM_SETUP_HW_SR)
|
||||||
|
CASE_REV9E(ITEM_SETUP_HW_BLUETOOTH)
|
||||||
ITEM_SETUP_HW_UART3_MODE,
|
ITEM_SETUP_HW_UART3_MODE,
|
||||||
ITEM_SETUP_HW_MAX
|
ITEM_SETUP_HW_MAX
|
||||||
};
|
};
|
||||||
|
@ -86,13 +87,15 @@ enum menuGeneralHwItems {
|
||||||
|
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
|
#define BLUETOOTH_ROWS 1,
|
||||||
#else
|
#else
|
||||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
|
#define BLUETOOTH_ROWS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void menuGeneralHardware(uint8_t event)
|
void menuGeneralHardware(uint8_t event)
|
||||||
{
|
{
|
||||||
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0 });
|
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, { LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
|
||||||
|
|
||||||
uint8_t sub = m_posVert;
|
uint8_t sub = m_posVert;
|
||||||
|
|
||||||
|
@ -205,6 +208,14 @@ void menuGeneralHardware(uint8_t event)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if defined(REV9E)
|
||||||
|
case ITEM_SETUP_HW_BLUETOOTH:
|
||||||
|
lcd_putsLeft(y, "Bluetooth");
|
||||||
|
menu_lcd_onoff(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, m_posHorz == 0 ? attr : 0);
|
||||||
|
if (m_posHorz == 0) g_eeGeneral.bluetoothEnable = checkIncDecGen(event, g_eeGeneral.bluetoothEnable, 0, 1);
|
||||||
|
editName(HW_SETTINGS_COLUMN+5*FW, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, m_posHorz == 1 ? attr : 0);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case ITEM_SETUP_HW_UART3_MODE:
|
case ITEM_SETUP_HW_UART3_MODE:
|
||||||
g_eeGeneral.uart3Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.uart3Mode, 0, UART_MODE_MAX, attr, event);
|
g_eeGeneral.uart3Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.uart3Mode, 0, UART_MODE_MAX, attr, event);
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
|
|
|
@ -381,10 +381,19 @@ enum BeeperMode {
|
||||||
UART_MODE_MAX = UART_MODE_COUNT-1
|
UART_MODE_MAX = UART_MODE_COUNT-1
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LEN_SWITCH_NAME 3
|
#define LEN_SWITCH_NAME 3
|
||||||
#define LEN_ANA_NAME 3
|
#define LEN_ANA_NAME 3
|
||||||
|
#define LEN_BLUETOOTH_NAME 10
|
||||||
#define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.uart3Mode==UART_MODE_SBUS_TRAINER/* || g_eeGeneral.uart3Mode==UART_MODE_CPPM_TRAINER*/)
|
#define HAS_WIRELESS_TRAINER_HARDWARE() (g_eeGeneral.uart3Mode==UART_MODE_SBUS_TRAINER/* || g_eeGeneral.uart3Mode==UART_MODE_CPPM_TRAINER*/)
|
||||||
|
|
||||||
|
#if defined(REV9E)
|
||||||
|
#define BLUETOOTH_FIELDS \
|
||||||
|
uint8_t bluetoothEnable; \
|
||||||
|
char bluetoothName[LEN_BLUETOOTH_NAME];
|
||||||
|
#else
|
||||||
|
#define BLUETOOTH_FIELDS
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EXTRA_GENERAL_FIELDS \
|
#define EXTRA_GENERAL_FIELDS \
|
||||||
EXTRA_GENERAL_FIELDS_ARM \
|
EXTRA_GENERAL_FIELDS_ARM \
|
||||||
uint8_t uart3Mode:6; \
|
uint8_t uart3Mode:6; \
|
||||||
|
@ -395,7 +404,8 @@ enum BeeperMode {
|
||||||
CustomFunctionData customFn[NUM_CFN]; \
|
CustomFunctionData customFn[NUM_CFN]; \
|
||||||
swconfig_t switchConfig; \
|
swconfig_t switchConfig; \
|
||||||
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
||||||
char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME];
|
char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME]; \
|
||||||
|
BLUETOOTH_FIELDS
|
||||||
#elif defined(CPUARM)
|
#elif defined(CPUARM)
|
||||||
#define EXTRA_GENERAL_FIELDS \
|
#define EXTRA_GENERAL_FIELDS \
|
||||||
EXTRA_GENERAL_FIELDS_ARM \
|
EXTRA_GENERAL_FIELDS_ARM \
|
||||||
|
|
|
@ -306,6 +306,11 @@ void generalDefault()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBTARANIS) && defined(REV9E)
|
||||||
|
const int8_t defaultName[] = { 20, -1, -18, -1, -14, -9, -19 };
|
||||||
|
memcpy(g_eeGeneral.bluetoothName, defaultName, sizeof(defaultName));
|
||||||
|
#endif
|
||||||
|
|
||||||
g_eeGeneral.chkSum = 0xFFFF;
|
g_eeGeneral.chkSum = 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,25 @@
|
||||||
Fifo<64> btTxFifo;
|
Fifo<64> btTxFifo;
|
||||||
Fifo<64> btRxFifo;
|
Fifo<64> btRxFifo;
|
||||||
|
|
||||||
|
enum BluetoothState
|
||||||
|
{
|
||||||
|
BLUETOOTH_INIT,
|
||||||
|
BLUETOOTH_WAIT_TTM,
|
||||||
|
BLUETOOTH_WAIT_BAUDRATE_CHANGE,
|
||||||
|
BLUETOOTH_OK,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BluetoothWriteState
|
||||||
|
{
|
||||||
|
BLUETOOTH_WRITE_IDLE,
|
||||||
|
BLUETOOTH_WRITE_INIT,
|
||||||
|
BLUETOOTH_WRITING,
|
||||||
|
BLUETOOTH_WRITE_DONE
|
||||||
|
};
|
||||||
|
|
||||||
|
volatile uint8_t bluetoothState = BLUETOOTH_INIT;
|
||||||
|
volatile uint8_t bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
|
||||||
|
|
||||||
void bluetoothInit(uint32_t baudrate)
|
void bluetoothInit(uint32_t baudrate)
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
@ -48,6 +67,7 @@ void bluetoothInit(uint32_t baudrate)
|
||||||
GPIO_PinAFConfig(BT_GPIO_TXRX, BT_GPIO_PinSource_TX, BT_GPIO_AF);
|
GPIO_PinAFConfig(BT_GPIO_TXRX, BT_GPIO_PinSource_TX, BT_GPIO_AF);
|
||||||
GPIO_PinAFConfig(BT_GPIO_TXRX, BT_GPIO_PinSource_RX, BT_GPIO_AF);
|
GPIO_PinAFConfig(BT_GPIO_TXRX, BT_GPIO_PinSource_RX, BT_GPIO_AF);
|
||||||
|
|
||||||
|
USART_DeInit(BT_USART);
|
||||||
USART_InitStructure.USART_BaudRate = baudrate;
|
USART_InitStructure.USART_BaudRate = baudrate;
|
||||||
USART_InitStructure.USART_Parity = USART_Parity_No;
|
USART_InitStructure.USART_Parity = USART_Parity_No;
|
||||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
||||||
|
@ -69,24 +89,10 @@ void bluetoothInit(uint32_t baudrate)
|
||||||
GPIO_ResetBits(BT_GPIO_EN, BT_GPIO_PIN_EN); // open bluetooth
|
GPIO_ResetBits(BT_GPIO_EN, BT_GPIO_PIN_EN); // open bluetooth
|
||||||
}
|
}
|
||||||
|
|
||||||
enum BluetoothState
|
void bluetoothDone()
|
||||||
{
|
{
|
||||||
BLUETOOTH_INIT,
|
GPIO_SetBits(BT_GPIO_EN, BT_GPIO_PIN_EN); // close bluetooth
|
||||||
BLUETOOTH_WAIT_TTM,
|
}
|
||||||
BLUETOOTH_WAIT_BAUDRATE_CHANGE,
|
|
||||||
BLUETOOTH_OK,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum BluetoothWriteState
|
|
||||||
{
|
|
||||||
BLUETOOTH_WRITE_IDLE,
|
|
||||||
BLUETOOTH_WRITE_INIT,
|
|
||||||
BLUETOOTH_WRITING,
|
|
||||||
BLUETOOTH_WRITE_DONE
|
|
||||||
};
|
|
||||||
|
|
||||||
volatile uint8_t bluetoothState = BLUETOOTH_INIT;
|
|
||||||
volatile uint8_t bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
|
|
||||||
|
|
||||||
extern "C" void USART6_IRQHandler(void)
|
extern "C" void USART6_IRQHandler(void)
|
||||||
{
|
{
|
||||||
|
@ -144,54 +150,66 @@ void bluetoothWriteWakeup(void)
|
||||||
|
|
||||||
void bluetoothWakeup(void)
|
void bluetoothWakeup(void)
|
||||||
{
|
{
|
||||||
if (bluetoothState != BLUETOOTH_OK) {
|
if (!g_eeGeneral.bluetoothEnable) {
|
||||||
static tmr10ms_t waitEnd = 0;
|
if (bluetoothState != BLUETOOTH_INIT) {
|
||||||
|
bluetoothDone();
|
||||||
if (bluetoothState == BLUETOOTH_INIT) {
|
bluetoothState = BLUETOOTH_INIT;
|
||||||
const char btMessage[] = "TTM:REN-Taranis";
|
|
||||||
bluetoothWriteString(btMessage);
|
|
||||||
bluetoothState = BLUETOOTH_WAIT_TTM;
|
|
||||||
waitEnd = get_tmr10ms() + 25/*250*s*/;
|
|
||||||
}
|
|
||||||
else if (bluetoothState == BLUETOOTH_WAIT_TTM) {
|
|
||||||
if (get_tmr10ms() > waitEnd) {
|
|
||||||
char ttm[] = "TTM:REN";
|
|
||||||
int index = 0;
|
|
||||||
uint8_t c;
|
|
||||||
bool found = false;
|
|
||||||
while (btRxFifo.pop(c)) {
|
|
||||||
if (c == ttm[index]) {
|
|
||||||
index++;
|
|
||||||
if (index == sizeof(ttm)-1) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
bluetoothState = BLUETOOTH_OK;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bluetoothInit(9600);
|
|
||||||
const char btMessage[] = "TTM:BPS-115200";
|
|
||||||
bluetoothWriteString(btMessage);
|
|
||||||
bluetoothState = BLUETOOTH_WAIT_BAUDRATE_CHANGE;
|
|
||||||
waitEnd = get_tmr10ms() + 250;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (bluetoothState == BLUETOOTH_WAIT_BAUDRATE_CHANGE) {
|
|
||||||
if (get_tmr10ms() > waitEnd) {
|
|
||||||
bluetoothInit(115200);
|
|
||||||
bluetoothState = BLUETOOTH_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (bluetoothState != BLUETOOTH_OK) {
|
||||||
|
static tmr10ms_t waitEnd = 0;
|
||||||
|
|
||||||
bluetoothWriteWakeup();
|
if (bluetoothState == BLUETOOTH_INIT) {
|
||||||
|
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
|
||||||
|
const char btMessage[] = "TTM:REN-";
|
||||||
|
bluetoothWriteString(btMessage);
|
||||||
|
uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
|
||||||
|
for (int i=0; i<len; i++) {
|
||||||
|
btTxFifo.push(idx2char(g_eeGeneral.bluetoothName[i]));
|
||||||
|
}
|
||||||
|
bluetoothState = BLUETOOTH_WAIT_TTM;
|
||||||
|
waitEnd = get_tmr10ms() + 25; // 250ms
|
||||||
|
}
|
||||||
|
else if (bluetoothState == BLUETOOTH_WAIT_TTM) {
|
||||||
|
if (get_tmr10ms() > waitEnd) {
|
||||||
|
char ttm[] = "TTM:REN";
|
||||||
|
int index = 0;
|
||||||
|
uint8_t c;
|
||||||
|
bool found = false;
|
||||||
|
while (btRxFifo.pop(c)) {
|
||||||
|
if (c == ttm[index]) {
|
||||||
|
index++;
|
||||||
|
if (index == sizeof(ttm)-1) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
bluetoothState = BLUETOOTH_OK;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bluetoothInit(BLUETOOTH_FACTORY_BAUDRATE);
|
||||||
|
const char btMessage[] = "TTM:BPS-115200";
|
||||||
|
bluetoothWriteString(btMessage);
|
||||||
|
bluetoothState = BLUETOOTH_WAIT_BAUDRATE_CHANGE;
|
||||||
|
waitEnd = get_tmr10ms() + 250; // 2.5s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bluetoothState == BLUETOOTH_WAIT_BAUDRATE_CHANGE) {
|
||||||
|
if (get_tmr10ms() > waitEnd) {
|
||||||
|
bluetoothState = BLUETOOTH_INIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bluetoothWriteWakeup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t bluetoothReady()
|
uint8_t bluetoothReady()
|
||||||
|
@ -212,8 +230,3 @@ int bluetoothRead(void * buffer, int len)
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bluetoothDone()
|
|
||||||
{
|
|
||||||
GPIO_SetBits(BT_GPIO_EN, BT_GPIO_PIN_EN); // close bluetooth
|
|
||||||
}
|
|
||||||
|
|
|
@ -330,6 +330,7 @@ void uart3Stop(void);
|
||||||
|
|
||||||
// BT driver
|
// BT driver
|
||||||
#define BLUETOOTH_DEFAULT_BAUDRATE 115200
|
#define BLUETOOTH_DEFAULT_BAUDRATE 115200
|
||||||
|
#define BLUETOOTH_FACTORY_BAUDRATE 9600
|
||||||
uint8_t bluetoothReady();
|
uint8_t bluetoothReady();
|
||||||
void bluetoothInit(uint32_t baudrate);
|
void bluetoothInit(uint32_t baudrate);
|
||||||
void bluetoothWrite(const void * buffer, int len);
|
void bluetoothWrite(const void * buffer, int len);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue