Fixes #1919: Shortcuts keys for inverting values don't work correctly with GVs, disabled DBLKEYS for !ARM
This commit is contained in:
+19
-8
@@ -116,7 +116,7 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
|
||||
|
||||
#if defined(DBLKEYS)
|
||||
uint8_t in = KEYS_PRESSED();
|
||||
if (EVT_KEY_MASK(event)) {
|
||||
if (!(i_flags & NO_DBLKEYS) && (EVT_KEY_MASK(event))) {
|
||||
bool dblkey = true;
|
||||
if (DBLKEYS_PRESSED_RGT_LFT(in))
|
||||
newval = -val;
|
||||
@@ -137,10 +137,6 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
|
||||
else
|
||||
dblkey = false;
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
#endif
|
||||
|
||||
if (dblkey) {
|
||||
killEvents(KEY_UP);
|
||||
killEvents(KEY_DOWN);
|
||||
@@ -1128,6 +1124,10 @@ void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool noZero(int val) {
|
||||
return val != 0;
|
||||
}
|
||||
|
||||
#if defined(GVARS)
|
||||
#if defined(CPUARM)
|
||||
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event)
|
||||
@@ -1163,18 +1163,29 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
|
||||
#endif
|
||||
|
||||
int8_t idx = (int16_t) GV_INDEX_CALC_DELTA(value, delta);
|
||||
#if defined(CPUARM)
|
||||
if (idx >= 0) ++idx; // transform form idx=0=GV1 to idx=1=GV1 in order to handle double keys invert
|
||||
#endif
|
||||
if (invers) {
|
||||
CHECK_INCDEC_MODELVAR(event, idx, -MAX_GVARS, MAX_GVARS-1);
|
||||
#if defined(CPUARM)
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, idx, -MAX_GVARS, MAX_GVARS, noZero);
|
||||
if (idx == 0) idx = 1; // handle reset to zero, map to GV1
|
||||
#else
|
||||
idx = checkIncDec(event, idx, -MAX_GVARS, MAX_GVARS-1, EE_MODEL|NO_DBLKEYS); // disable double keys
|
||||
#endif
|
||||
}
|
||||
|
||||
if (idx < 0) {
|
||||
if (idx < 0) {
|
||||
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx, delta);
|
||||
idx = -idx;
|
||||
lcd_putcAtt(x-6, y, '-', attr);
|
||||
}
|
||||
else {
|
||||
#if defined(CPUARM)
|
||||
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx-1, delta);
|
||||
#else
|
||||
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx, delta);
|
||||
idx++;
|
||||
#endif
|
||||
}
|
||||
putsStrIdx(x, y, STR_GV, idx, attr);
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ extern int8_t s_editMode; // global editmode
|
||||
#define INCDEC_SOURCE 0x10
|
||||
#define DBLKEYS_1000 0x20
|
||||
#define INCDEC_REP10 0x40
|
||||
#define NO_DBLKEYS 0x80
|
||||
|
||||
// mawrow special values
|
||||
#define TITLE_ROW ((uint8_t)-1)
|
||||
|
||||
Reference in New Issue
Block a user