[all] Now 5 Global Variables available on all boards

This commit is contained in:
bsongis
2012-10-15 20:13:06 +00:00
parent cd995aa975
commit bca4660742
4 changed files with 18 additions and 18 deletions
+6 -6
View File
@@ -631,12 +631,12 @@ 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 ? REG_VALUE(value-126) : 126);
value = ((value >= 126 || value <= -126) ? REG_VALUE((uint8_t)value-126) : 126);
eeDirty(EE_MODEL);
}
if (value >= 126) {
putsStrIdx(attr&LEFT?x:x-FW-FWNUM, y, STR_GV, value - 126 + 1, attr);
if (invers) CHECK_INCDEC_MODELVAR(event, value, 126, 127);
if (value >= 126 || value <= -126) {
putsStrIdx(attr&LEFT?x:x-FW-FWNUM, y, STR_GV, (uint8_t)value - 125, attr);
if (invers) value = checkIncDec(event, (uint8_t)value, 126, 130, EE_MODEL);
}
else {
lcd_outdezAtt(x, y, value, attr);
@@ -647,8 +647,8 @@ int8_t gvarMenuItem(uint8_t x, uint8_t y, int8_t value, int8_t min, int8_t max,
void displayGVar(uint8_t x, uint8_t y, int8_t value)
{
if (value > 125) {
putsStrIdx(x-FW-FWNUM, y, STR_GV, value - 125, 0);
if (value >= 126 || value <= -126) {
putsStrIdx(x-FW-FWNUM, y, STR_GV, (uint8_t)value - 125, 0);
}
else {
lcd_outdezAtt(x, y, value, 0);
+4 -4
View File
@@ -2651,9 +2651,9 @@ void menuModelFunctionSwitches(uint8_t event)
}
#endif
#if defined(GVARS)
else if (sd->func >= FUNC_GVAR_X1) {
func_displayed = FUNC_GVAR_X1 - 16 - NUM_STICKS + 1;
putsStrIdx(12*FW-2, y, STR_GV, sd->func-FUNC_GVAR_X1+1, attr);
else if (sd->func >= FUNC_ADJUST_GV1) {
func_displayed = FUNC_ADJUST_GV1 - 16 - NUM_STICKS + 1;
putsStrIdx(12*FW-2, y, STR_GV, sd->func-FUNC_ADJUST_GV1+1, attr);
}
#endif
else {
@@ -2743,7 +2743,7 @@ void menuModelFunctionSwitches(uint8_t event)
lcd_outdezAtt(18*FW, y, val_displayed, attr);
}
#if defined(GVARS)
else if (sd->func >= FUNC_GVAR_X1
else if (sd->func >= FUNC_ADJUST_GV1
#if defined(DEBUG)
&& sd->func != FUNC_TEST
#endif
+3 -3
View File
@@ -375,8 +375,8 @@ enum Functions {
FUNC_BACKGND_MUSIC_PAUSE,
#endif
#if defined(GVARS)
FUNC_GVAR_X1,
FUNC_GVAR_X2,
FUNC_ADJUST_GV1,
FUNC_ADJUST_GV5 = FUNC_ADJUST_GV1 + 4,
#endif
#if defined(DEBUG)
FUNC_TEST, // should remain the last before MAX as not added in companion9x
@@ -736,7 +736,7 @@ typedef int8_t model_gvar_t;
#endif
#if defined(GVARS)
#define MAX_GVARS 2
#define MAX_GVARS 5
#define EXTRA_GVARS model_gvar_t gvars[MAX_GVARS]
#else
#define MAX_GVARS 0
+5 -5
View File
@@ -934,8 +934,8 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
int8_t REG(int8_t x, int8_t min, int8_t max)
{
int8_t result = x;
if (x >= 126) {
x -= 126;
if (x >= 126 || x <= -126) {
x = (uint8_t)x - 126;
result = REG_VALUE(x);
if (result < min) {
REG_VALUE(x) = result = min;
@@ -2112,12 +2112,12 @@ void evalFunctions()
#endif
#if defined(GVARS)
else if (sd->func >= FUNC_GVAR_X1) {
else if (sd->func >= FUNC_ADJUST_GV1) {
if (FSW_PARAM(sd) >= MIXSRC_TrimRud-1 && FSW_PARAM(sd) <= MIXSRC_TrimAil-1) {
trimPtr[FSW_PARAM(sd)-MIXSRC_TrimRud+1] = &REG_VALUE(sd->func-FUNC_GVAR_X1);
trimPtr[FSW_PARAM(sd)-MIXSRC_TrimRud+1] = &REG_VALUE(sd->func-FUNC_ADJUST_GV1);
}
else {
REG_VALUE(sd->func-FUNC_GVAR_X1) = limit((int16_t)-1250, getValue(FSW_PARAM(sd)), (int16_t)1250) / 10;
REG_VALUE(sd->func-FUNC_ADJUST_GV1) = limit((int16_t)-1250, getValue(FSW_PARAM(sd)), (int16_t)1250) / 10;
}
}
#endif