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
|
||||
{
|
||||
switch (protocol) {
|
||||
|
||||
@@ -175,11 +175,12 @@ class ModuleData {
|
||||
|
||||
struct Access {
|
||||
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;
|
||||
|
||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||
void convert(RadioDataConversionState & cstate);
|
||||
bool isPxx2Module() const;
|
||||
QString polarityToString() const { return ppm.pulsePol ? tr("Positive") : tr("Negative"); }
|
||||
QString rfProtocolToString() const;
|
||||
QString subTypeToString(int type = -1) const;
|
||||
|
||||
@@ -1868,7 +1868,8 @@ class SensorField: public TransformedField {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||
_id = sensor.id;
|
||||
_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;
|
||||
_offset = sensor.offset;
|
||||
}
|
||||
@@ -1891,7 +1892,9 @@ class SensorField: public TransformedField {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||
sensor.id = _id;
|
||||
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.offset = _offset;
|
||||
}
|
||||
@@ -2056,7 +2059,7 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
||||
internalField.Append(new SpareBitsField<5>(this));
|
||||
|
||||
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 {
|
||||
@@ -2076,11 +2079,24 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
||||
if (module.protocol == PULSES_ACCESS_ISRM) {
|
||||
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:
|
||||
StructField internalField;
|
||||
ModuleData& module;
|
||||
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1];
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
@@ -111,6 +111,8 @@ class SensorData {
|
||||
unsigned int id;
|
||||
unsigned int subid;
|
||||
unsigned int instance;
|
||||
unsigned int rxIdx;
|
||||
unsigned int moduleIdx;
|
||||
unsigned int persistentValue;
|
||||
unsigned int formula;
|
||||
char label[4+1];
|
||||
|
||||
Reference in New Issue
Block a user