[all] Some Global Variables bugs fixed (thanks again Gabriel!)
This commit is contained in:
+2
-12
@@ -631,11 +631,11 @@ int8_t gvarMenuItem(uint8_t x, uint8_t y, int8_t value, int8_t min, int8_t max,
|
||||
{
|
||||
bool invers = attr&INVERS;
|
||||
if (invers && event == EVT_KEY_LONG(KEY_MENU)) {
|
||||
value = ((value >= 126 || value <= -126) ? REG_VALUE((uint8_t)value-126) : 126);
|
||||
value = ((value >= 126 || value <= -126) ? REG(value, min, max) : 126);
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
if (value >= 126 || value <= -126) {
|
||||
putsStrIdx(attr&LEFT?x:x-FW-FWNUM, y, STR_GV, (uint8_t)value - 125, attr);
|
||||
putsStrIdx(attr&LEFT?x:x-2*FW-FWNUM, y, STR_GV, (uint8_t)value - 125, attr);
|
||||
if (invers) value = checkIncDec(event, (uint8_t)value, 126, 130, EE_MODEL);
|
||||
}
|
||||
else {
|
||||
@@ -644,16 +644,6 @@ int8_t gvarMenuItem(uint8_t x, uint8_t y, int8_t value, int8_t min, int8_t max,
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
void displayGVar(uint8_t x, uint8_t y, int8_t value)
|
||||
{
|
||||
if (value >= 126 || value <= -126) {
|
||||
putsStrIdx(x-FW-FWNUM, y, STR_GV, (uint8_t)value - 125, 0);
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(x, y, value, 0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
int8_t gvarMenuItem(uint8_t x, uint8_t y, int8_t value, int8_t min, int8_t max, uint8_t attr, uint8_t event)
|
||||
{
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ uint8_t onoffMenuItem(uint8_t value, uint8_t x, uint8_t y, const pm_char *label,
|
||||
int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, uint8_t attr, uint8_t event);
|
||||
int8_t gvarMenuItem(uint8_t x, uint8_t y, int8_t value, int8_t min, int8_t max, uint8_t attr, uint8_t event);
|
||||
#if defined(GVARS)
|
||||
void displayGVar(uint8_t x, uint8_t y, int8_t value);
|
||||
#define displayGVar(x, y, v) gvarMenuItem(x, y, v, 0, 0, 0, 0)
|
||||
#else
|
||||
#define displayGVar(x, y, v) lcd_outdez8(x, y, v)
|
||||
#endif
|
||||
|
||||
+1
-14
@@ -933,20 +933,7 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
|
||||
#if defined(GVARS)
|
||||
int8_t REG(int8_t x, int8_t min, int8_t max)
|
||||
{
|
||||
int8_t result = x;
|
||||
if (x >= 126 || x <= -126) {
|
||||
x = (uint8_t)x - 126;
|
||||
result = REG_VALUE(x);
|
||||
if (result < min) {
|
||||
REG_VALUE(x) = result = min;
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
if (result > max) {
|
||||
REG_VALUE(x) = result = max;
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return (x >= 126 || x <= -126) ? limit(min, REG_VALUE((uint8_t)x - 126), max) : x;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user