From 7f6591edadd07b75823fe3be92eadc9f51b2f938 Mon Sep 17 00:00:00 2001 From: Andre Bernet Date: Tue, 3 Dec 2013 14:56:55 +0100 Subject: [PATCH] Pot warning finished on Taranis, ready to merge once tested by more people :) --- radio/src/gui/menu_model.cpp | 2 +- radio/src/opentx.cpp | 46 ++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/radio/src/gui/menu_model.cpp b/radio/src/gui/menu_model.cpp index 06bb8a6a7..96a7c052a 100644 --- a/radio/src/gui/menu_model.cpp +++ b/radio/src/gui/menu_model.cpp @@ -953,7 +953,7 @@ void menuModelSetup(uint8_t event) #define PORT_CHANNELS_ROWS(x) (x==0 ? PORT1_CHANNELS_ROWS() : (x==1 ? PORT2_CHANNELS_ROWS() : TRAINER_CHANNELS_ROWS())) #define FAILSAFE_ROWS(x) ((g_model.moduleData[x].rfProtocol==RF_PROTO_X16 || g_model.moduleData[x].rfProtocol==RF_PROTO_LR12) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : HIDDEN_ROW) #define MODEL_SETUP_MAX_LINES (1+ITEM_MODEL_SETUP_MAX) - #define POT_WARN_ITEMS() (g_model.nPotsToWarn ? NUM_POTS : 0) + #define POT_WARN_ITEMS() ((g_model.nPotsToWarn >> 6) ? (uint8_t)NUM_POTS : (uint8_t)0) bool CURSOR_ON_CELL = (m_posHorz >= 0); MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 7, POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 0, IF_PORT1_ON(1), IF_PORT1_ON(IS_D8_RX(0) ? (uint8_t)1 : (uint8_t)2), IF_PORT1_ON(FAILSAFE_ROWS(0)), LABEL(ExternalModule), (g_model.externalModule==MODULE_TYPE_XJT || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, PORT2_CHANNELS_ROWS(), (IS_MODULE_XJT(1) && IS_D8_RX(1)) ? (uint8_t)1 : (IS_MODULE_PPM(1) || IS_MODULE_XJT(1) || IS_MODULE_DSM2(1)) ? (uint8_t)2 : HIDDEN_ROW, IF_PORT2_XJT(FAILSAFE_ROWS(1)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)}); diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index a87912aae..5191c1fb1 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -2181,7 +2181,7 @@ void checkSwitches() while (1) { -#if defined(TELEMETRY_MOD_14051) +#if defined(TELEMETRY_MOD_14051) || defined(PCBTARANIS) getADC(); #endif @@ -2196,16 +2196,16 @@ void checkSwitches() warn = true; } } - - perOut(e_perout_mode_inactive_phase, 0); uint8_t potMode = g_model.nPotsToWarn >> 6; - bad_pots = 0; - if(potMode) - for (uint8_t i=0; i> 3)) > 2)) { - warn = true; - bad_pots |= (1<> 3)) > 2)) { + warn = true; + bad_pots |= (1<> 3,0); - for (uint8_t i=0; i> 3)) > 2) { - lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > (getValue(MIXSRC_FIRST_POT+i) >> 3) ? 127 : 126); - flags = INVERS; + if(potMode) { + for (uint8_t i=0; i> 3)) > 2) { + switch (i) { + case 0: + case 1: + lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > (getValue(MIXSRC_FIRST_POT+i) >> 3) ? 126 : 127); + break; + case 2: + case 3: + lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > (getValue(MIXSRC_FIRST_POT+i) >> 3) ? '\300' : '\301'); + break; + } + flags = INVERS; + } + lcd_putsiAtt(60+i*(5*FW), 6*FH-2, STR_VSRCRAW, NUM_STICKS+1+i, flags); } - lcd_putsiAtt(60+i*(5*FW), 6*FH-2, STR_VSRCRAW, NUM_STICKS+1+i, flags); } } last_bad_pots = bad_pots;