fix(bw212): main view sliders, omitted sensor count display (#5154)

This commit is contained in:
Peter Feerick
2024-06-12 09:55:36 +10:00
committed by GitHub
parent 1bc114d99f
commit 4be97eca96
2 changed files with 22 additions and 3 deletions
+21 -2
View File
@@ -110,6 +110,18 @@ void onDeleteAllSensorsConfirm(const char * result)
}
}
uint8_t getTelemetrySensorCount()
{
uint8_t count = 0;
for (uint8_t index = 0; index <= MAX_TELEMETRY_SENSORS; index++) {
if (isTelemetryFieldAvailable(index)) {
count++;
}
}
return count;
}
void menuModelTelemetry(event_t event)
{
MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY, HEADER_LINE+ITEM_TELEMETRY_MAX, { HEADER_LINE_COLUMNS SENSORS_ROWS RSSI_ROWS VARIO_ROWS });
@@ -171,15 +183,22 @@ void menuModelTelemetry(event_t event)
switch (k) {
case ITEM_TELEMETRY_SENSORS_LABEL:
{
telemExpandState.sensors = expandableSection(y, STR_TELEMETRY_SENSORS, telemExpandState.sensors, attr, event);
if (telemExpandState.sensors) {
uint8_t sensorCount = getTelemetrySensorCount();
if (sensorCount && !telemExpandState.sensors) {
lcdDrawChar(TELEM_COL3, y, '(', 0);
lcdDrawNumber(lcdNextPos, y, sensorCount, 0);
lcdDrawChar(lcdNextPos, y, ')', 0);
} else if (telemExpandState.sensors) {
lcdDrawText(TELEM_COL2, y, STR_VALUE, 0);
if (!g_model.ignoreSensorIds /*&& !IS_SPEKTRUM_PROTOCOL()*/) {
lcdDrawText(TELEM_COL3, y, STR_ID, 0);
}
}
break;
}
case ITEM_TELEMETRY_DISCOVER_SENSORS:
lcdDrawText(INDENT_WIDTH, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
+1 -1
View File
@@ -214,7 +214,7 @@ void drawSliders()
if (!IS_SLIDER(i)) continue;
#else
// Skip POT3
if (i == 2) continue;
if (i == 2 && !IS_SLIDER(i)) continue;
#endif
coord_t x = _pot_slots[slot_idx++];