chore(dsmp): separate DSMP and DSM2, cleanup code, add DSMP status display and Enable AETR option (#6932)
Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
@@ -259,6 +259,7 @@ Node convert<ModuleData>::encode(const ModuleData& rhs)
|
||||
case PULSES_LEMON_DSMP: {
|
||||
Node dsmp;
|
||||
dsmp["flags"] = rhs.dsmp.flags;
|
||||
dsmp["enableAETR"] = (int)rhs.dsmp.enableAETR;
|
||||
mod["dsmp"] = dsmp;
|
||||
} break;
|
||||
case PULSES_FLYSKY_AFHDS2A: {
|
||||
@@ -419,6 +420,7 @@ bool convert<ModuleData>::decode(const Node& node, ModuleData& rhs)
|
||||
} else if (mod["dsmp"]) {
|
||||
Node dsmp = mod["dsmp"];
|
||||
dsmp["flags"] >> rhs.dsmp.flags;
|
||||
dsmp["enableAETR"] >> rhs.dsmp.enableAETR;
|
||||
} else if (mod["flysky"]) {
|
||||
Node flysky = mod["flysky"];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
@@ -213,6 +213,7 @@ class ModuleData {
|
||||
|
||||
struct DSMP {
|
||||
unsigned int flags;
|
||||
bool enableAETR;
|
||||
} dsmp;
|
||||
|
||||
void clear();
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#define MASK_AFHDS (1<<22)
|
||||
#define MASK_CSRF_ARMING_MODE (1<<23)
|
||||
#define MASK_CSRF_ARMING_TRIGGER (1<<24)
|
||||
#define MASK_ENABLE_AETR (1<<25)
|
||||
|
||||
quint8 ModulePanel::failsafesValueDisplayType = ModulePanel::FAILSAFE_DISPLAY_PERCENT;
|
||||
|
||||
@@ -409,7 +410,7 @@ void ModulePanel::update()
|
||||
mask |= MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT | MASK_FAILSAFES | MASK_AFHDS;
|
||||
break;
|
||||
case PULSES_LEMON_DSMP:
|
||||
mask |= MASK_CHANNELS_RANGE;
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_ENABLE_AETR;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -448,6 +449,8 @@ void ModulePanel::update()
|
||||
ui->channelsCount->setMaximum(module.getMaxChannelCount());
|
||||
ui->channelsCount->setValue(module.channelsCount);
|
||||
ui->channelsCount->setSingleStep(firmware->getCapability(HasPPMStart) ? 1 : 2);
|
||||
|
||||
// CRSF
|
||||
ui->label_crsfArmingMode->setVisible(mask & MASK_CSRF_ARMING_MODE);
|
||||
ui->crsfArmingMode->setVisible(mask & MASK_CSRF_ARMING_MODE);
|
||||
ui->crsfArmingTrigger->setVisible(mask & MASK_CSRF_ARMING_TRIGGER);
|
||||
@@ -611,6 +614,12 @@ void ModulePanel::update()
|
||||
ui->raw12bits->setChecked(module.ghost.raw12bits);
|
||||
}
|
||||
|
||||
// DSMP settings fields
|
||||
ui->enableAETR->setVisible(mask & MASK_ENABLE_AETR);
|
||||
if (mask & MASK_ENABLE_AETR) {
|
||||
ui->enableAETR->setChecked(module.dsmp.enableAETR);
|
||||
}
|
||||
|
||||
if (mask & MASK_ACCESS) {
|
||||
ui->rx1->setText(module.access.receiverName[0]);
|
||||
ui->rx2->setText(module.access.receiverName[1]);
|
||||
@@ -632,7 +641,7 @@ void ModulePanel::update()
|
||||
ui->clearRx3->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1 << 2)));
|
||||
ui->rx3->setVisible((mask & MASK_ACCESS) && (module.access.receivers & (1 << 2)));
|
||||
|
||||
// AFHFS
|
||||
// AFHDS2A / AFHDS3
|
||||
if (mask & MASK_AFHDS) {
|
||||
if (protocol == PULSES_FLYSKY_AFHDS2A) {
|
||||
ui->label_afhds->setText(tr("Options"));
|
||||
@@ -915,6 +924,11 @@ void ModulePanel::on_raw12bits_stateChanged(int state)
|
||||
module.ghost.raw12bits = (state == Qt::Checked);
|
||||
}
|
||||
|
||||
void ModulePanel::on_enableAETR_stateChanged(int state)
|
||||
{
|
||||
module.dsmp.enableAETR = (state == Qt::Checked);
|
||||
}
|
||||
|
||||
void ModulePanel::on_racingMode_stateChanged(int state)
|
||||
{
|
||||
module.access.racingMode = (state == Qt::Checked);
|
||||
|
||||
@@ -70,6 +70,7 @@ class ModulePanel : public ModelPanel
|
||||
void on_autoBind_stateChanged(int state);
|
||||
void on_disableChMap_stateChanged(int state);
|
||||
void on_raw12bits_stateChanged(int state);
|
||||
void on_enableAETR_stateChanged(int state);
|
||||
void on_racingMode_stateChanged(int state);
|
||||
void on_disableTelem_stateChanged(int state);
|
||||
void on_lowPower_stateChanged(int state);
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0" colspan="2">
|
||||
<item row="17" column="0" colspan="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -429,14 +429,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="label_crsfArmingMode">
|
||||
<property name="text">
|
||||
<string>Arm using</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<item row="16" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_crsfarm">
|
||||
<item>
|
||||
<widget class="QComboBox" name="crsfArmingMode"/>
|
||||
@@ -446,6 +446,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QCheckBox" name="enableAETR">
|
||||
<property name="text">
|
||||
<string>Enable AETR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
|
||||
@@ -234,6 +234,9 @@ QString ModelPrinter::printModule(int idx)
|
||||
if (module.protocol == PULSES_GHOST) {
|
||||
str << printLabelValue(tr("Raw 12 bits"), printBoolean(module.ghost.raw12bits, BOOLEAN_YN));
|
||||
}
|
||||
if (module.protocol == PULSES_LEMON_DSMP) {
|
||||
str << printLabelValue(tr("Enable AETR"), printBoolean(module.dsmp.enableAETR, BOOLEAN_YN));
|
||||
}
|
||||
if (module.protocol == PULSES_CROSSFIRE) {
|
||||
str << printLabelValue(tr("Arming mode"), module.crsfArmingModeToString());
|
||||
if (module.crsf.crsfArmingMode == ModuleData::CRSF_ARMING_MODE_SWITCH) {
|
||||
|
||||
Reference in New Issue
Block a user