mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 08:15:17 +03:00
Pot warning finished on Taranis, ready to merge once tested by more people :)
This commit is contained in:
parent
43b0c00e11
commit
7f6591edad
2 changed files with 29 additions and 19 deletions
|
@ -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)});
|
||||
|
|
|
@ -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;
|
||||
if(potMode) {
|
||||
perOut(e_perout_mode_normal, 0);
|
||||
bad_pots = 0;
|
||||
if(potMode)
|
||||
for (uint8_t i=0; i<NUM_POTS; i++)
|
||||
if(!(g_model.nPotsToWarn & (1 << i)) && (abs(g_model.potPosition[i] - (getValue(MIXSRC_FIRST_POT+i) >> 3)) > 2)) {
|
||||
warn = true;
|
||||
bad_pots |= (1<<i);
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (uint8_t i=0; i<MAX_PSWITCH-2; i++)
|
||||
if (!(g_model.nSwToWarn & (1<<(i-1))))
|
||||
|
@ -2228,17 +2228,27 @@ void checkSwitches()
|
|||
lcd_putcAtt(60+i*(2*FW+FW/2)+FW, 4*FH+3, c, attr);
|
||||
}
|
||||
}
|
||||
lcd_outdezAtt(195,4*FH+3,getValue(MIXSRC_FIRST_POT) >> 3,0);
|
||||
if(potMode) {
|
||||
for (uint8_t i=0; i<NUM_POTS; i++) {
|
||||
if (!(g_model.nPotsToWarn & (1 << i))) {
|
||||
uint8_t flags = 0;
|
||||
if (abs(g_model.potPosition[i] - (getValue(MIXSRC_FIRST_POT+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);
|
||||
if (abs(g_model.potPosition[i] - (calibratedStick[NUM_STICKS+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);
|
||||
}
|
||||
}
|
||||
}
|
||||
last_bad_pots = bad_pots;
|
||||
#else
|
||||
if (last_bad_switches != switches_states) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue