mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
[Companion] Racing mode support added
This commit is contained in:
parent
d219397c60
commit
6299c35844
6 changed files with 40 additions and 30 deletions
|
@ -45,19 +45,6 @@ bool ModuleData::isPxx2Module() const
|
|||
}
|
||||
}
|
||||
|
||||
bool ModuleData::isPxx1Module() const
|
||||
{
|
||||
switch(protocol){
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_R9M:
|
||||
case PULSES_PXX_R9M_LITE:
|
||||
case PULSES_PXX_R9M_LITE_PRO:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ModuleData::supportRxNum() const
|
||||
{
|
||||
switch (protocol) {
|
||||
|
|
|
@ -215,12 +215,12 @@ class ModuleData {
|
|||
struct Access {
|
||||
unsigned int receivers;
|
||||
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1];
|
||||
unsigned int racingMode;
|
||||
} access;
|
||||
|
||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||
void convert(RadioDataConversionState & cstate);
|
||||
bool isPxx2Module() const;
|
||||
bool isPxx1Module() const;
|
||||
bool supportRxNum() const;
|
||||
QString polarityToString() const { return ppm.pulsePol ? tr("Positive") : tr("Negative"); }
|
||||
QString rfProtocolToString() const;
|
||||
|
|
|
@ -2158,15 +2158,16 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||
module(module)
|
||||
{
|
||||
internalField.Append(new UnsignedField<3>(this, module.access.receivers));
|
||||
internalField.Append(new SpareBitsField<5>(this));
|
||||
internalField.Append(new SpareBitsField<4>(this));
|
||||
internalField.Append(new UnsignedField<1>(this, module.access.racingMode));
|
||||
|
||||
for (int i=0; i<PXX2_MAX_RECEIVERS_PER_MODULE; i++)
|
||||
for (int i = 0; i < PXX2_MAX_RECEIVERS_PER_MODULE; i++)
|
||||
internalField.Append(new CharField<8>(this, receiverName[i]));
|
||||
|
||||
memset(receiverName, 0, sizeof(receiverName));
|
||||
}
|
||||
|
||||
bool select(const unsigned int& attr) const override
|
||||
bool select(const unsigned int & attr) const override
|
||||
{
|
||||
return attr >= PULSES_ACCESS_ISRM && attr <= PULSES_ACCESS_R9M_LITE_PRO;
|
||||
}
|
||||
|
|
|
@ -226,6 +226,7 @@ void TimerPanel::onItemModelUpdateComplete()
|
|||
#define MASK_ACCESS (1<<13)
|
||||
#define MASK_RX_FREQ (1<<14)
|
||||
#define MASK_RF_POWER (1<<15)
|
||||
#define MASK_RF_RACING_MODE (1<<16)
|
||||
|
||||
quint8 ModulePanel::failsafesValueDisplayType = ModulePanel::FAILSAFE_DISPLAY_PERCENT;
|
||||
|
||||
|
@ -415,9 +416,9 @@ void ModulePanel::setupFailsafes()
|
|||
|
||||
void ModulePanel::update()
|
||||
{
|
||||
const PulsesProtocol protocol = (PulsesProtocol)module.protocol;
|
||||
const Board::Type board = firmware->getBoard();
|
||||
const Multiprotocols::MultiProtocolDefinition & pdef = multiProtocols.getProtocol(module.multi.rfProtocol);
|
||||
const auto protocol = (PulsesProtocol)module.protocol;
|
||||
const auto board = firmware->getBoard();
|
||||
const auto & pdef = multiProtocols.getProtocol(module.multi.rfProtocol);
|
||||
unsigned int mask = 0;
|
||||
unsigned int max_rx_num = 63;
|
||||
|
||||
|
@ -450,6 +451,8 @@ void ModulePanel::update()
|
|||
mask |= MASK_RX_NUMBER | MASK_ACCESS;
|
||||
if (moduleIdx == 0 && HAS_EXTERNAL_ANTENNA(board) && generalSettings.antennaMode == 0 /* per model */)
|
||||
mask |= MASK_ANTENNA;
|
||||
if (protocol == PULSES_ACCESS_ISRM && module.channelsCount == 8)
|
||||
mask |= MASK_RF_RACING_MODE;
|
||||
break;
|
||||
case PULSES_LP45:
|
||||
case PULSES_DSM2:
|
||||
|
@ -491,8 +494,6 @@ void ModulePanel::update()
|
|||
mask |= MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT | MASK_FAILSAFES;
|
||||
mask |= MASK_SUBTYPES | MASK_RX_FREQ | MASK_RF_POWER;
|
||||
break;
|
||||
case PULSES_OFF:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -556,6 +557,14 @@ void ModulePanel::update()
|
|||
ui->antennaMode->hide();
|
||||
}
|
||||
|
||||
if (mask & MASK_RF_RACING_MODE) {
|
||||
ui->racingMode->show();
|
||||
ui->racingMode->setChecked(module.access.racingMode);
|
||||
}
|
||||
else {
|
||||
ui->racingMode->hide();
|
||||
}
|
||||
|
||||
// R9M options
|
||||
ui->r9mPower->setVisible(mask & MASK_RF_POWER);
|
||||
ui->label_r9mPower->setVisible(mask & MASK_RF_POWER);
|
||||
|
@ -845,6 +854,11 @@ void ModulePanel::on_disableChMap_stateChanged(int state)
|
|||
module.multi.disableMapping = (state == Qt::Checked);
|
||||
}
|
||||
|
||||
void ModulePanel::on_racingMode_stateChanged(int state)
|
||||
{
|
||||
module.access.racingMode = (state == Qt::Checked);
|
||||
}
|
||||
|
||||
void ModulePanel::on_autoBind_stateChanged(int state)
|
||||
{
|
||||
module.multi.autoBindMode = (state == Qt::Checked);
|
||||
|
|
|
@ -98,6 +98,7 @@ class ModulePanel : public ModelPanel
|
|||
void onSubTypeChanged();
|
||||
void on_autoBind_stateChanged(int state);
|
||||
void on_disableChMap_stateChanged(int state);
|
||||
void on_racingMode_stateChanged(int state);
|
||||
void on_disableTelem_stateChanged(int state);
|
||||
void on_lowPower_stateChanged(int state);
|
||||
void on_r9mPower_currentIndexChanged(int index);
|
||||
|
|
|
@ -1077,7 +1077,21 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="disableTelem">
|
||||
<property name="text">
|
||||
<string>Disable Telemetry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="racingMode">
|
||||
<property name="text">
|
||||
<string>Racing Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -1090,13 +1104,6 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="disableTelem">
|
||||
<property name="text">
|
||||
<string>Disable Telemetry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QCheckBox" name="disableChMap">
|
||||
<property name="text">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue