fix(bw212): main view sliders, omitted sensor count display (#5154)
This commit is contained in:
@@ -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)
|
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 });
|
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) {
|
switch (k) {
|
||||||
case ITEM_TELEMETRY_SENSORS_LABEL:
|
case ITEM_TELEMETRY_SENSORS_LABEL:
|
||||||
|
{
|
||||||
telemExpandState.sensors = expandableSection(y, STR_TELEMETRY_SENSORS, telemExpandState.sensors, attr, event);
|
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);
|
lcdDrawText(TELEM_COL2, y, STR_VALUE, 0);
|
||||||
if (!g_model.ignoreSensorIds /*&& !IS_SPEKTRUM_PROTOCOL()*/) {
|
if (!g_model.ignoreSensorIds /*&& !IS_SPEKTRUM_PROTOCOL()*/) {
|
||||||
lcdDrawText(TELEM_COL3, y, STR_ID, 0);
|
lcdDrawText(TELEM_COL3, y, STR_ID, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ITEM_TELEMETRY_DISCOVER_SENSORS:
|
case ITEM_TELEMETRY_DISCOVER_SENSORS:
|
||||||
lcdDrawText(INDENT_WIDTH, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
lcdDrawText(INDENT_WIDTH, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
||||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ void drawSliders()
|
|||||||
if (!IS_SLIDER(i)) continue;
|
if (!IS_SLIDER(i)) continue;
|
||||||
#else
|
#else
|
||||||
// Skip POT3
|
// Skip POT3
|
||||||
if (i == 2) continue;
|
if (i == 2 && !IS_SLIDER(i)) continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
coord_t x = _pot_slots[slot_idx++];
|
coord_t x = _pot_slots[slot_idx++];
|
||||||
|
|||||||
Reference in New Issue
Block a user