Shift sensor display by +1 to match old display value (#6865)
Shift sensor display by +1 to match old display value
This commit is contained in:
@@ -1914,7 +1914,7 @@ class SensorField: public TransformedField {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||
_id = sensor.id;
|
||||
_subid = sensor.subid;
|
||||
_instance = (sensor.instance & 0x1F) | (sensor.rxIdx << 5) | (sensor.moduleIdx << 7);
|
||||
_instance = ((sensor.instance - 1) & 0x1F) | (sensor.rxIdx << 5) | (sensor.moduleIdx << 7);
|
||||
_ratio = sensor.ratio;
|
||||
_offset = sensor.offset;
|
||||
}
|
||||
@@ -1942,12 +1942,12 @@ class SensorField: public TransformedField {
|
||||
sensor.id = _id;
|
||||
sensor.subid = _subid;
|
||||
if (model.moduleData[0].isPxx1Module() || model.moduleData[1].isPxx1Module()) {
|
||||
sensor.instance = (_instance & 0x1F) + (version <= 218 ? -1 : 0); // 5 bits instance
|
||||
sensor.instance = (_instance & 0x1F) + (version <= 218 ? 0 : 1); // 5 bits instance
|
||||
sensor.rxIdx = 0x03; // 2 bits Rx idx
|
||||
sensor.moduleIdx = 0x01; // 1 bit module idx
|
||||
}
|
||||
else {
|
||||
sensor.instance = _instance & 0x1F;
|
||||
sensor.instance = (_instance & 0x1F) + 1;
|
||||
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx
|
||||
sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user