Implement R9M Companion support (#5157)
also implement (like with multi) own pxx struct for pxx options
This commit is contained in:
committed by
Bertrand Songis
parent
2f7694dee7
commit
8e84724c62
@@ -3433,8 +3433,18 @@ void OpenTxModelData::beforeExport()
|
|||||||
// qDebug() << QString("before export model") << modelData.name;
|
// qDebug() << QString("before export model") << modelData.name;
|
||||||
|
|
||||||
for (int module=0; module<3; module++) {
|
for (int module=0; module<3; module++) {
|
||||||
if (modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12) {
|
if ((modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12) ||
|
||||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_PXX_XJT_X16;
|
modelData.moduleData[module].protocol == PULSES_PXX_R9M) {
|
||||||
|
if (! (modelData.moduleData[module].protocol == PULSES_PXX_R9M)) {
|
||||||
|
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_PXX_XJT_X16;
|
||||||
|
}
|
||||||
|
int pxxByte = (modelData.moduleData[module].pxx.power & 0x03)
|
||||||
|
| modelData.moduleData[module].pxx.receiver_telem_off << 4
|
||||||
|
| modelData.moduleData[module].pxx.receiver_channel_9_16 << 5;
|
||||||
|
modelData.moduleData[module].ppm.delay = 300 + 50 * pxxByte;
|
||||||
|
modelData.moduleData[module].ppm.pulsePol = modelData.moduleData[module].pxx.external_antenna;
|
||||||
|
modelData.moduleData[module].ppm.outputType = modelData.moduleData[module].pxx.sport_out;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (modelData.moduleData[module].protocol >= PULSES_LP45 && modelData.moduleData[module].protocol <= PULSES_DSMX) {
|
else if (modelData.moduleData[module].protocol >= PULSES_LP45 && modelData.moduleData[module].protocol <= PULSES_DSMX) {
|
||||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_LP45;
|
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_LP45;
|
||||||
@@ -3509,6 +3519,17 @@ void OpenTxModelData::afterImport()
|
|||||||
modelData.moduleData[module].multi.lowPowerMode = modelData.moduleData[module].ppm.outputType;
|
modelData.moduleData[module].multi.lowPowerMode = modelData.moduleData[module].ppm.outputType;
|
||||||
modelData.moduleData[module].multi.autoBindMode = modelData.moduleData[module].ppm.pulsePol;
|
modelData.moduleData[module].multi.autoBindMode = modelData.moduleData[module].ppm.pulsePol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12) ||
|
||||||
|
modelData.moduleData[module].protocol == PULSES_PXX_R9M) {
|
||||||
|
// Do the same for pxx
|
||||||
|
unsigned int pxxByte = (unsigned int)((modelData.moduleData[module].ppm.delay - 300) / 50);
|
||||||
|
modelData.moduleData[module].pxx.power = pxxByte & 0x03;
|
||||||
|
modelData.moduleData[module].pxx.receiver_telem_off = static_cast<bool>(pxxByte & (1 << 4));
|
||||||
|
modelData.moduleData[module].pxx.receiver_channel_9_16 = static_cast<bool>(pxxByte & (1 << 5));
|
||||||
|
modelData.moduleData[module].pxx.external_antenna = modelData.moduleData[module].ppm.outputType;
|
||||||
|
modelData.moduleData[module].pxx.sport_out = modelData.moduleData[module].ppm.pulsePol;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
|
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class ProtocolsConversionTable: public ConversionTable
|
|||||||
if (IS_HORUS_OR_TARANIS(board)) {
|
if (IS_HORUS_OR_TARANIS(board)) {
|
||||||
addConversion(PULSES_CROSSFIRE, val++);
|
addConversion(PULSES_CROSSFIRE, val++);
|
||||||
addConversion(PULSES_MULTIMODULE, val++);
|
addConversion(PULSES_MULTIMODULE, val++);
|
||||||
|
addConversion(PULSES_PXX_R9M, val++);
|
||||||
}
|
}
|
||||||
else if (IS_ARM(board)) {
|
else if (IS_ARM(board)) {
|
||||||
val++;
|
val++;
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ void TimerPanel::on_name_editingFinished()
|
|||||||
#define MASK_MULTIMODULE 128
|
#define MASK_MULTIMODULE 128
|
||||||
#define MASK_ANTENNA 256
|
#define MASK_ANTENNA 256
|
||||||
#define MASK_MULTIOPTION 512
|
#define MASK_MULTIOPTION 512
|
||||||
|
#define MASK_R9M 1024
|
||||||
|
|
||||||
quint8 ModulePanel::failsafesValueDisplayType = ModulePanel::FAILSAFE_DISPLAY_PERCENT;
|
quint8 ModulePanel::failsafesValueDisplayType = ModulePanel::FAILSAFE_DISPLAY_PERCENT;
|
||||||
|
|
||||||
@@ -366,11 +367,12 @@ void ModulePanel::update()
|
|||||||
if (moduleIdx >= 0) {
|
if (moduleIdx >= 0) {
|
||||||
mask |= MASK_PROTOCOL;
|
mask |= MASK_PROTOCOL;
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
|
case PULSES_PXX_R9M:
|
||||||
|
mask |= MASK_R9M;
|
||||||
case PULSES_PXX_XJT_X16:
|
case PULSES_PXX_XJT_X16:
|
||||||
case PULSES_PXX_XJT_D8:
|
case PULSES_PXX_XJT_D8:
|
||||||
case PULSES_PXX_XJT_LR12:
|
case PULSES_PXX_XJT_LR12:
|
||||||
case PULSES_PXX_DJT:
|
case PULSES_PXX_DJT:
|
||||||
case PULSES_PXX_R9M:
|
|
||||||
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||||
if (protocol==PULSES_PXX_XJT_X16 || protocol==PULSES_PXX_XJT_LR12 || protocol==PULSES_PXX_R9M)
|
if (protocol==PULSES_PXX_XJT_X16 || protocol==PULSES_PXX_XJT_LR12 || protocol==PULSES_PXX_R9M)
|
||||||
mask |= MASK_RX_NUMBER;
|
mask |= MASK_RX_NUMBER;
|
||||||
@@ -457,7 +459,17 @@ void ModulePanel::update()
|
|||||||
// Antenna slection on Horus
|
// Antenna slection on Horus
|
||||||
ui->label_antenna->setVisible(mask & MASK_ANTENNA);
|
ui->label_antenna->setVisible(mask & MASK_ANTENNA);
|
||||||
ui->antennaMode->setVisible(mask & MASK_ANTENNA);
|
ui->antennaMode->setVisible(mask & MASK_ANTENNA);
|
||||||
ui->antennaMode->setCurrentIndex(module.ppm.pulsePol);
|
ui->antennaMode->setCurrentIndex(module.pxx.external_antenna);
|
||||||
|
|
||||||
|
// R9M S.port output
|
||||||
|
ui->sportOut->setVisible(mask & MASK_R9M);
|
||||||
|
ui->label_sportOut->setVisible(mask & MASK_R9M);
|
||||||
|
ui->sportOut->setCurrentIndex(module.pxx.sport_out);
|
||||||
|
|
||||||
|
ui->r9mPower->setVisible(mask & MASK_R9M);
|
||||||
|
ui->label_r9mPower->setVisible(mask & MASK_R9M);
|
||||||
|
ui->r9mPower->setCurrentIndex(module.pxx.power);
|
||||||
|
|
||||||
|
|
||||||
// Multi settings fields
|
// Multi settings fields
|
||||||
ui->label_multiProtocol->setVisible(mask & MASK_MULTIMODULE);
|
ui->label_multiProtocol->setVisible(mask & MASK_MULTIMODULE);
|
||||||
@@ -561,7 +573,19 @@ void ModulePanel::on_ppmPolarity_currentIndexChanged(int index)
|
|||||||
|
|
||||||
void ModulePanel::on_antennaMode_currentIndexChanged(int index)
|
void ModulePanel::on_antennaMode_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
module.ppm.pulsePol = index;
|
module.pxx.external_antenna = index;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModulePanel::on_sportOut_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
module.pxx.sport_out = index;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModulePanel::on_r9mPower_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
module.pxx.power = index;
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ class ModulePanel : public ModelPanel
|
|||||||
void on_multiSubType_currentIndexChanged(int index);
|
void on_multiSubType_currentIndexChanged(int index);
|
||||||
void on_autoBind_stateChanged(int state);
|
void on_autoBind_stateChanged(int state);
|
||||||
void on_lowPower_stateChanged(int state);
|
void on_lowPower_stateChanged(int state);
|
||||||
|
void on_sportOut_currentIndexChanged(int index);
|
||||||
|
void on_r9mPower_currentIndexChanged(int index);
|
||||||
void setChannelFailsafeValue(const int channel, const int value, quint8 updtSb = 0);
|
void setChannelFailsafeValue(const int channel, const int value, quint8 updtSb = 0);
|
||||||
void onFailsafeComboIndexChanged(int index);
|
void onFailsafeComboIndexChanged(int index);
|
||||||
void onFailsafeUsecChanged(int value);
|
void onFailsafeUsecChanged(int value);
|
||||||
|
|||||||
@@ -667,6 +667,64 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_sportOut">
|
||||||
|
<property name="text">
|
||||||
|
<string>S.port output</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QComboBox" name="sportOut">
|
||||||
|
<property name="currentText">
|
||||||
|
<string>Disable</string>
|
||||||
|
</property>
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QComboBox::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_r9mPower">
|
||||||
|
<property name="text">
|
||||||
|
<string>RF Output Power</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QComboBox" name="r9mPower">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>10 mW</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>100 mW</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>500 mW</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1000 mW</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3">
|
<item row="1" column="0" colspan="3">
|
||||||
|
|||||||
@@ -850,6 +850,13 @@ class ModuleData {
|
|||||||
int optionValue;
|
int optionValue;
|
||||||
} multi;
|
} multi;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int power; // 0 10 mW, 1 100 mW, 2 500 mW, 3 1W
|
||||||
|
bool receiver_telem_off; // false = receiver telem enabled
|
||||||
|
bool receiver_channel_9_16; // false = pwm out 1-8, true 9-16
|
||||||
|
bool external_antenna; // false = internal antenna, true = external antenna
|
||||||
|
bool sport_out;
|
||||||
|
} pxx;
|
||||||
|
|
||||||
|
|
||||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||||
|
|||||||
Reference in New Issue
Block a user