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:
3djc
2019-09-30 15:45:38 +02:00
committed by Bertrand Songis
parent d1f5d8a283
commit c5f13b1a17
4 changed files with 6 additions and 6 deletions
@@ -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
}
@@ -104,7 +104,7 @@ void menuModelSensor(event_t event)
if (sensor->type == TELEM_TYPE_CUSTOM) {
lcdDrawTextAlignedLeft(y, STR_ID);
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
lcdDrawHexChar(SENSOR_3RD_COLUMN, y, sensor->instance & 0x1f, LEFT|(menuHorizontalPosition==1 ? attr : 0));
lcdDrawHexChar(SENSOR_3RD_COLUMN, y, (sensor->instance & 0x1F) + 1, LEFT|(menuHorizontalPosition==1 ? attr : 0));
if (attr && s_editMode > 0) {
switch (menuHorizontalPosition) {
case 0:
@@ -114,7 +114,7 @@ void menuModelSensor(event_t event)
if (sensor->type == TELEM_TYPE_CUSTOM) {
lcdDrawTextAlignedLeft(y, STR_ID);
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0));
lcdDrawNumber(SENSOR_3RD_COLUMN, y, (sensor->instance & 0x1F) + 1, LEFT|(menuHorizontalPosition==1 ? attr : 0));
if (attr) {
switch (menuHorizontalPosition) {
case 0:
@@ -115,7 +115,7 @@ bool menuModelSensor(event_t event)
if (sensor->type == TELEM_TYPE_CUSTOM) {
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ID);
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(menuHorizontalPosition==1 ? attr : 0));
lcdDrawNumber(SENSOR_3RD_COLUMN, y, (sensor->instance & 0x1F) + 1, LEFT|(menuHorizontalPosition==1 ? attr : 0));
if (attr) {
switch (menuHorizontalPosition) {
case 0: