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) {
|
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||||
_id = sensor.id;
|
_id = sensor.id;
|
||||||
_subid = sensor.subid;
|
_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;
|
_ratio = sensor.ratio;
|
||||||
_offset = sensor.offset;
|
_offset = sensor.offset;
|
||||||
}
|
}
|
||||||
@@ -1942,12 +1942,12 @@ class SensorField: public TransformedField {
|
|||||||
sensor.id = _id;
|
sensor.id = _id;
|
||||||
sensor.subid = _subid;
|
sensor.subid = _subid;
|
||||||
if (model.moduleData[0].isPxx1Module() || model.moduleData[1].isPxx1Module()) {
|
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.rxIdx = 0x03; // 2 bits Rx idx
|
||||||
sensor.moduleIdx = 0x01; // 1 bit module idx
|
sensor.moduleIdx = 0x01; // 1 bit module idx
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sensor.instance = _instance & 0x1F;
|
sensor.instance = (_instance & 0x1F) + 1;
|
||||||
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx
|
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx
|
||||||
sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module 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) {
|
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
||||||
lcdDrawTextAlignedLeft(y, STR_ID);
|
lcdDrawTextAlignedLeft(y, STR_ID);
|
||||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
|
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) {
|
if (attr && s_editMode > 0) {
|
||||||
switch (menuHorizontalPosition) {
|
switch (menuHorizontalPosition) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ void menuModelSensor(event_t event)
|
|||||||
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
||||||
lcdDrawTextAlignedLeft(y, STR_ID);
|
lcdDrawTextAlignedLeft(y, STR_ID);
|
||||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
|
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) {
|
if (attr) {
|
||||||
switch (menuHorizontalPosition) {
|
switch (menuHorizontalPosition) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ bool menuModelSensor(event_t event)
|
|||||||
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ID);
|
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ID);
|
||||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
|
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) {
|
if (attr) {
|
||||||
switch (menuHorizontalPosition) {
|
switch (menuHorizontalPosition) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user