added receiver display to sensors
This commit is contained in:
@@ -30,6 +30,20 @@ void ModuleData::convert(RadioDataConversionState & cstate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ModuleData::isPxx2Module() const
|
||||||
|
{
|
||||||
|
switch(protocol){
|
||||||
|
case PULSES_ACCESS_ISRM:
|
||||||
|
case PULSES_ACCESS_R9M:
|
||||||
|
case PULSES_ACCESS_R9M_LITE:
|
||||||
|
case PULSES_ACCESS_R9M_LITE_PRO:
|
||||||
|
case PULSES_XJT_LITE_X16:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString ModuleData::rfProtocolToString() const
|
QString ModuleData::rfProtocolToString() const
|
||||||
{
|
{
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
|
|||||||
@@ -175,11 +175,12 @@ class ModuleData {
|
|||||||
|
|
||||||
struct Access {
|
struct Access {
|
||||||
unsigned int receivers;
|
unsigned int receivers;
|
||||||
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME];
|
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1];
|
||||||
} access;
|
} access;
|
||||||
|
|
||||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||||
void convert(RadioDataConversionState & cstate);
|
void convert(RadioDataConversionState & cstate);
|
||||||
|
bool isPxx2Module() const;
|
||||||
QString polarityToString() const { return ppm.pulsePol ? tr("Positive") : tr("Negative"); }
|
QString polarityToString() const { return ppm.pulsePol ? tr("Positive") : tr("Negative"); }
|
||||||
QString rfProtocolToString() const;
|
QString rfProtocolToString() const;
|
||||||
QString subTypeToString(int type = -1) const;
|
QString subTypeToString(int type = -1) const;
|
||||||
|
|||||||
@@ -1868,7 +1868,8 @@ class SensorField: public TransformedField {
|
|||||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||||
_id = sensor.id;
|
_id = sensor.id;
|
||||||
_subid = sensor.subid;
|
_subid = sensor.subid;
|
||||||
_instance = sensor.instance;
|
// keep highest 3 bits from instance (rxIdx & moduleIdx are read-only)
|
||||||
|
_instance = (sensor.instance & 0x1F) | (_instance & 0xE0);
|
||||||
_ratio = sensor.ratio;
|
_ratio = sensor.ratio;
|
||||||
_offset = sensor.offset;
|
_offset = sensor.offset;
|
||||||
}
|
}
|
||||||
@@ -1891,7 +1892,9 @@ class SensorField: public TransformedField {
|
|||||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||||
sensor.id = _id;
|
sensor.id = _id;
|
||||||
sensor.subid = _subid;
|
sensor.subid = _subid;
|
||||||
sensor.instance = _instance;
|
sensor.instance = _instance & 0x1F; // 5 bits instance
|
||||||
|
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx
|
||||||
|
sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx
|
||||||
sensor.ratio = _ratio;
|
sensor.ratio = _ratio;
|
||||||
sensor.offset = _offset;
|
sensor.offset = _offset;
|
||||||
}
|
}
|
||||||
@@ -2056,7 +2059,7 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||||||
internalField.Append(new SpareBitsField<5>(this));
|
internalField.Append(new SpareBitsField<5>(this));
|
||||||
|
|
||||||
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, module.access.receiverName[i]));
|
internalField.Append(new CharField<8>(this, receiverName[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool select(const unsigned int& attr) const {
|
bool select(const unsigned int& attr) const {
|
||||||
@@ -2076,11 +2079,24 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
|||||||
if (module.protocol == PULSES_ACCESS_ISRM) {
|
if (module.protocol == PULSES_ACCESS_ISRM) {
|
||||||
module.protocol += module.subType;
|
module.protocol += module.subType;
|
||||||
}
|
}
|
||||||
|
for (int i=0; i<PXX2_MAX_RECEIVERS_PER_MODULE; i++) {
|
||||||
|
for (int pos=0; pos<PXX2_LEN_RX_NAME+1; pos++) {
|
||||||
|
|
||||||
|
if (pos == PXX2_LEN_RX_NAME || receiverName[i][pos] == ' '
|
||||||
|
|| receiverName[i][pos] == '\0') {
|
||||||
|
|
||||||
|
module.access.receiverName[i][pos] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
module.access.receiverName[i][pos] = receiverName[i][pos];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StructField internalField;
|
StructField internalField;
|
||||||
ModuleData& module;
|
ModuleData& module;
|
||||||
|
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1];
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ class SensorData {
|
|||||||
unsigned int id;
|
unsigned int id;
|
||||||
unsigned int subid;
|
unsigned int subid;
|
||||||
unsigned int instance;
|
unsigned int instance;
|
||||||
|
unsigned int rxIdx;
|
||||||
|
unsigned int moduleIdx;
|
||||||
unsigned int persistentValue;
|
unsigned int persistentValue;
|
||||||
unsigned int formula;
|
unsigned int formula;
|
||||||
char label[4+1];
|
char label[4+1];
|
||||||
|
|||||||
@@ -653,6 +653,9 @@ void TelemetrySensorPanel::update()
|
|||||||
ui->id->hide();
|
ui->id->hide();
|
||||||
ui->instanceLabel->hide();
|
ui->instanceLabel->hide();
|
||||||
ui->instance->hide();
|
ui->instance->hide();
|
||||||
|
ui->rxLabel->hide();
|
||||||
|
ui->moduleLabel->hide();
|
||||||
|
ui->rxOrMod->hide();
|
||||||
ui->formula->show();
|
ui->formula->show();
|
||||||
ui->formula->setCurrentIndex(sensor.formula);
|
ui->formula->setCurrentIndex(sensor.formula);
|
||||||
isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL);
|
isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL);
|
||||||
@@ -676,6 +679,29 @@ void TelemetrySensorPanel::update()
|
|||||||
ui->id->show();
|
ui->id->show();
|
||||||
ui->instanceLabel->show();
|
ui->instanceLabel->show();
|
||||||
ui->instance->show();
|
ui->instance->show();
|
||||||
|
|
||||||
|
const ModuleData& module = model->moduleData[sensor.moduleIdx];
|
||||||
|
if (module.isPxx2Module()) {
|
||||||
|
ui->rxLabel->show();
|
||||||
|
ui->moduleLabel->hide();
|
||||||
|
if (module.access.receivers & (1 << sensor.rxIdx)) {
|
||||||
|
ui->rxOrMod->setText(module.access.receiverName[sensor.rxIdx]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// receiver does not seem to be active
|
||||||
|
ui->rxOrMod->clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->rxLabel->hide();
|
||||||
|
ui->moduleLabel->show();
|
||||||
|
if (sensor.moduleIdx)
|
||||||
|
ui->rxOrMod->setText(tr("Internal Module"));
|
||||||
|
else
|
||||||
|
ui->rxOrMod->setText(tr("External Module"));
|
||||||
|
}
|
||||||
|
ui->rxOrMod->show();
|
||||||
|
|
||||||
ui->formula->hide();
|
ui->formula->hide();
|
||||||
isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL;
|
isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL;
|
||||||
ratioFieldsDisplayed = (sensor.unit < SensorData::UNIT_FIRST_VIRTUAL);
|
ratioFieldsDisplayed = (sensor.unit < SensorData::UNIT_FIRST_VIRTUAL);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,1,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -28,6 +28,12 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -114,6 +120,48 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="rxLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Rx</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="moduleLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Mod.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="rxOrMod">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="acceptDrops">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::RightToLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="formula">
|
<widget class="QComboBox" name="formula">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|||||||
Reference in New Issue
Block a user