Skip to content

Commit

Permalink
feat: only use vario sensors for vario source (#4960)
Browse files Browse the repository at this point in the history
  • Loading branch information
3djc authored May 3, 2024
1 parent fcbd852 commit 27bef74
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion radio/src/gui/128x64/model_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void menuModelTelemetry(event_t event)
lcdDrawTextAlignedLeft(y, INDENT TR_SOURCE);
drawSource(TELEM_COL2, y, g_model.varioData.source ? MIXSRC_FIRST_TELEM+3*(g_model.varioData.source-1) : 0, attr);
if (attr) {
g_model.varioData.source = checkIncDec(event, g_model.varioData.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
g_model.varioData.source = checkIncDec(event, g_model.varioData.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isVarioSensorAvailable);
}
break;

Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/212x64/model_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void menuModelTelemetry(event_t event)
lcdDrawTextAlignedLeft(y, INDENT TR_SOURCE);
drawSource(TELEM_COL2, y, g_model.varioData.source ? MIXSRC_FIRST_TELEM+3*(g_model.varioData.source-1) : 0, attr);
if (attr) {
g_model.varioData.source = checkIncDec(event, g_model.varioData.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
g_model.varioData.source = checkIncDec(event, g_model.varioData.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isVarioSensorAvailable);
}
break;

Expand Down
2 changes: 1 addition & 1 deletion radio/src/gui/colorlcd/model_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ void ModelTelemetryPage::build(Window* window)
if (value == MIXSRC_NONE) return true;
if (value < MIXSRC_FIRST_TELEM) return false;
auto qr = div(value - MIXSRC_FIRST_TELEM, 3);
return qr.rem == 0 && isSensorAvailable(qr.quot + 1);
return qr.rem == 0 && isVarioSensorAvailable(qr.quot + 1);
});

line = window->newLine(grid5);
Expand Down
9 changes: 9 additions & 0 deletions radio/src/gui/gui_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ bool isRssiSensorAvailable(int sensor)
}
}

bool isVarioSensorAvailable(int sensor)
{
if (sensor == 0)
return true;
else {
return (isSensorAvailable(sensor) && (isSensorUnit(sensor, UNIT_METERS_PER_SECOND) || isSensorUnit(sensor, UNIT_FEET_PER_SECOND)));
}
}

bool isSensorAvailable(int sensor)
{
if (sensor == 0)
Expand Down
1 change: 1 addition & 0 deletions radio/src/gui/gui_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ uint8_t getTelemetrySensorsCount();
bool isTelemetryFieldComparisonAvailable(int index);
bool isSensorAvailable(int sensor);
bool isRssiSensorAvailable(int sensor);
bool isVarioSensorAvailable(int sensor);
bool hasSportPower();

bool modelHasNotes();
Expand Down

0 comments on commit 27bef74

Please sign in to comment.