From 2a869185080c75d3b953ce6e33157ef10ab8be0d Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 10 Jun 2017 23:34:33 +0200 Subject: [PATCH] Add varioCenterSilent option to x7 and rework telem screen accordingly (#4923) --- radio/src/gui/128x64/model_telemetry.cpp | 51 +++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/radio/src/gui/128x64/model_telemetry.cpp b/radio/src/gui/128x64/model_telemetry.cpp index c6ac64e6a..ded21ad84 100644 --- a/radio/src/gui/128x64/model_telemetry.cpp +++ b/radio/src/gui/128x64/model_telemetry.cpp @@ -91,11 +91,12 @@ enum MenuModelTelemetryFrskyItems { ITEM_TELEMETRY_FAS_OFFSET, #endif #endif - CASE_VARIO(ITEM_TELEMETRY_VARIO_LABEL) #if defined(VARIO) + ITEM_TELEMETRY_VARIO_LABEL, ITEM_TELEMETRY_VARIO_SOURCE, + ITEM_TELEMETRY_VARIO_RANGE, + ITEM_TELEMETRY_VARIO_CENTER, #endif - CASE_VARIO(ITEM_TELEMETRY_VARIO_RANGE) #if !defined(CPUARM) // TODO check the cost of moving them to a new screen on the 9X ITEM_TELEMETRY_SCREEN_LABEL1, @@ -162,9 +163,11 @@ enum MenuModelTelemetryFrskyItems { #endif #if defined(PCBSTD) - #define VARIO_RANGE_ROWS 1 + #define VARIO_ROWS 1, +#elif defined(CPUARM) + #define VARIO_ROWS LABEL(Vario), 0, 1, 2, #else - #define VARIO_RANGE_ROWS (NAVIGATION_LINE_BY_LINE | 3) + #define VARIO_ROWS LABEL(Vario), 0, 1, 1, #endif @@ -480,7 +483,7 @@ void menuModelTelemetryFrsky(event_t event) } #endif - MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, HEADER_LINE+ITEM_TELEMETRY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) TELEMETRY_SCREENS_ROWS }); + MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, HEADER_LINE+ITEM_TELEMETRY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS VARIO_ROWS TELEMETRY_SCREENS_ROWS }); uint8_t sub = menuVerticalPosition - HEADER_LINE; @@ -787,9 +790,10 @@ void menuModelTelemetryFrsky(event_t event) #endif break; - case ITEM_TELEMETRY_VARIO_RANGE: - lcdDrawTextAlignedLeft(y, STR_LIMIT); #if defined(PCBSTD) + case ITEM_TELEMETRY_VARIO_RANGE: + lcdDrawTextAlignedLeft(y, STR_RANGE); + lcdDrawNumber(TELEM_COL2, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT); lcdDrawNumber(TELEM_COL2+8*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0)); if (attr && (s_editMode>0 || p1valdiff)) { @@ -802,33 +806,52 @@ void menuModelTelemetryFrsky(event_t event) break; } } + break; #else + case ITEM_TELEMETRY_VARIO_RANGE: + lcdDrawTextAlignedLeft(y, STR_RANGE); if (attr && CURSOR_ON_LINE()) { lcdDrawSolidFilledRect(TELEM_COL2-1, y-1, LCD_W-TELEM_COL2+1, FH+1); } lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, ((CURSOR_ON_LINE() || menuHorizontalPosition==0) ? attr : 0)|LEFT); - lcdDrawNumber(TELEM_COL2+4*FW-2, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0)|PREC1|LEFT); - lcdDrawNumber(TELEM_COL2+8*FW-1, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0)|PREC1|LEFT); - lcdDrawNumber(TELEM_COL2+12*FW-4, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==3) ? attr : 0)|LEFT); + lcdDrawNumber(TELEM_COL2+4*FW, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0)|LEFT); if (attr && (s_editMode>0 || p1valdiff)) { switch (menuHorizontalPosition) { case 0: CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMin, -7, 7); break; case 1: + CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMax, -7, 7); + break; + } + } + break; + + case ITEM_TELEMETRY_VARIO_CENTER: + lcdDrawTextAlignedLeft(y, STR_CENTER); + lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || menuHorizontalPosition==0) ? attr : 0)|PREC1|LEFT); + lcdDrawNumber(TELEM_COL2+4*FW, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0)|PREC1|LEFT); +#if defined(CPUARM) + lcdDrawTextAtIndex(TELEM_COL2+8*FW, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (menuHorizontalPosition==2 ? attr : 0)); +#endif + if (attr && (s_editMode>0 || p1valdiff)) { + switch (menuHorizontalPosition) { + case 0: CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMin, -16, 5+min(10, g_model.frsky.varioCenterMax+5)); break; - case 2: + case 1: CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMax, -5+max(-10, g_model.frsky.varioCenterMin-5), +15); break; - case 3: - CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMax, -7, 7); +#if defined(CPUARM) + case 2: + CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.varioCenterSilent, 1); break; +#endif } } -#endif break; #endif +#endif #if !defined(CPUARM) case ITEM_TELEMETRY_SCREEN_LABEL1: -- 2.11.4.GIT