[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:
+17
-1
@@ -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 defined(AUTOSWITCH)
|
||||||
if (s_editMode>0 && (i_flags & INCDEC_SWITCH)) {
|
if (s_editMode>0 && (i_flags & INCDEC_SWITCH)) {
|
||||||
int8_t swtch = getMovedSwitch();
|
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
|
#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)
|
var = checkIncDecModel(event,var,min,max)
|
||||||
|
|
||||||
#if defined(AUTOSWITCH)
|
#if defined(AUTOSWITCH)
|
||||||
|
#define AUTOSWITCH_MENU_LONG() (attr && event==EVT_KEY_LONG(KEY_MENU))
|
||||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max) \
|
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max) \
|
||||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH)
|
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH)
|
||||||
#else
|
#else
|
||||||
|
#define AUTOSWITCH_MENU_LONG() (0)
|
||||||
#define CHECK_INCDEC_MODELSWITCH CHECK_INCDEC_MODELVAR
|
#define CHECK_INCDEC_MODELSWITCH CHECK_INCDEC_MODELVAR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2618,8 +2618,8 @@ void menuProcFunctionSwitches(uint8_t event)
|
|||||||
if (sd->swtch < -MAX_SWITCH-1) sd->swtch += (MAX_SWITCH+1);
|
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));
|
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) {
|
if (active || AUTOSWITCH_MENU_LONG()) {
|
||||||
CHECK_INCDEC_MODELSWITCH( event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH+1);
|
CHECK_INCDEC_MODELSWITCH(event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH+1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user