mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 08:15:17 +03:00
[MENU long] on a switch in Function Switches screen converts a screen to his correspondant momentary switch (THR <=> THRm, !THR <=> !THRm)
This commit is contained in:
parent
77571bd9cd
commit
c14da4fdbe
3 changed files with 21 additions and 3 deletions
|
@ -120,7 +120,23 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
|
|||
#if defined(AUTOSWITCH)
|
||||
if (s_editMode>0 && (i_flags & INCDEC_SWITCH)) {
|
||||
int8_t swtch = getMovedSwitch();
|
||||
if (swtch) newval = swtch;
|
||||
if (swtch) {
|
||||
if (newval == DSW_TRN && swtch == DSW_TRN)
|
||||
newval = -newval;
|
||||
else
|
||||
newval = swtch;
|
||||
}
|
||||
}
|
||||
if (event == EVT_KEY_LONG(KEY_MENU) && i_max > SWITCH_ON) {
|
||||
s_editMode = !s_editMode;
|
||||
if (newval > SWITCH_ON)
|
||||
newval -= (MAX_SWITCH+1);
|
||||
else if (newval > 0)
|
||||
newval += (MAX_SWITCH+1);
|
||||
else if (newval < SWITCH_OFF)
|
||||
newval += (MAX_SWITCH+1);
|
||||
else if (newval < 0)
|
||||
newval -= (MAX_SWITCH+1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -111,9 +111,11 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
|||
var = checkIncDecModel(event,var,min,max)
|
||||
|
||||
#if defined(AUTOSWITCH)
|
||||
#define AUTOSWITCH_MENU_LONG() (attr && event==EVT_KEY_LONG(KEY_MENU))
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH)
|
||||
#else
|
||||
#define AUTOSWITCH_MENU_LONG() (0)
|
||||
#define CHECK_INCDEC_MODELSWITCH CHECK_INCDEC_MODELVAR
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2618,8 +2618,8 @@ void menuProcFunctionSwitches(uint8_t event)
|
|||
if (sd->swtch < -MAX_SWITCH-1) sd->swtch += (MAX_SWITCH+1);
|
||||
}
|
||||
putsSwitches(3, y, sd->swtch, SWONOFF | attr | ((abs(sd->swtch) <= (MAX_SWITCH+1) && getSwitch(sd->swtch, 0) && (sd->func > FUNC_INSTANT_TRIM || sd->delay)) ? BOLD : 0));
|
||||
if (active) {
|
||||
CHECK_INCDEC_MODELSWITCH( event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH+1);
|
||||
if (active || AUTOSWITCH_MENU_LONG()) {
|
||||
CHECK_INCDEC_MODELSWITCH(event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH+1);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue