[all] Another Global Variables bug fixed (thanks again Gabriel!)

This commit is contained in:
bsongis
2012-10-16 08:30:19 +00:00
parent e52ef22269
commit 7526f4f5b4
4 changed files with 10 additions and 9 deletions
+1
View File
@@ -634,6 +634,7 @@ int8_t gvarMenuItem(uint8_t x, uint8_t y, int8_t value, int8_t min, int8_t max,
{ {
bool invers = attr&INVERS; bool invers = attr&INVERS;
if (invers && event == EVT_KEY_LONG(KEY_MENU)) { if (invers && event == EVT_KEY_LONG(KEY_MENU)) {
s_editMode = !s_editMode;
value = ((value >= 126 || value <= -126) ? REG(value, min, max) : 126); value = ((value >= 126 || value <= -126) ? REG(value, min, max) : 126);
eeDirty(EE_MODEL); eeDirty(EE_MODEL);
} }
+5 -5
View File
@@ -2620,11 +2620,11 @@ void menuModelFunctionSwitches(uint8_t event)
uint8_t active = (attr && (s_editMode>0 || p1valdiff)); uint8_t active = (attr && (s_editMode>0 || p1valdiff));
switch (j) { switch (j) {
case 0: case 0:
if (sd->func <= FUNC_TRAINER_AIL && sd->delay) { if (sd->func <= FUNC_TRAINER_AIL && sd->active) {
if (sd->swtch > MAX_SWITCH+1) sd->swtch -= (MAX_SWITCH+1); if (sd->swtch > MAX_SWITCH+1) sd->swtch -= (MAX_SWITCH+1);
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->active)) ? BOLD : 0));
if (active || AUTOSWITCH_MENU_LONG()) { if (active || AUTOSWITCH_MENU_LONG()) {
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
CHECK_INCDEC_MODELSWITCH(event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH+1+2*MAX_PSWITCH); CHECK_INCDEC_MODELSWITCH(event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH+1+2*MAX_PSWITCH);
@@ -2769,11 +2769,11 @@ void menuModelFunctionSwitches(uint8_t event)
case 3: case 3:
if (sd->swtch && sd->func <= FUNC_INSTANT_TRIM) { if (sd->swtch && sd->func <= FUNC_INSTANT_TRIM) {
#if defined(GRAPHICS) #if defined(GRAPHICS)
menu_lcd_onoff(20*FW, y, sd->delay, attr); menu_lcd_onoff(20*FW, y, sd->active, attr);
#else #else
menu_lcd_onoff(18*FW+2, y, sd->delay, attr) ; menu_lcd_onoff(18*FW+2, y, sd->active, attr) ;
#endif #endif
if (active) CHECK_INCDEC_MODELVAR(event, sd->delay, 0, 1); if (active) CHECK_INCDEC_MODELVAR(event, sd->active, 0, 1);
} }
else if (attr) { else if (attr) {
m_posHorz = 0; m_posHorz = 0;
+3 -3
View File
@@ -389,15 +389,15 @@ PACK(typedef struct t_FuncSwData { // Function Switches data
int8_t swtch; //input int8_t swtch; //input
uint8_t func; uint8_t func;
char param[6]; char param[6];
uint8_t delay; uint8_t active;
uint8_t spare; uint8_t spare;
}) FuncSwData; }) FuncSwData;
#define FSW_PARAM(p) (*((uint32_t*)(p)->param)) #define FSW_PARAM(p) (*((uint32_t*)(p)->param))
#else #else
PACK(typedef struct t_FuncSwData { // Function Switches data PACK(typedef struct t_FuncSwData { // Function Switches data
int8_t swtch; //input int8_t swtch; //input
uint8_t func:5; uint8_t func:7;
uint8_t delay:3; uint8_t active:1;
uint8_t param; uint8_t param;
}) FuncSwData; }) FuncSwData;
#define FSW_PARAM(p) ((p)->param) #define FSW_PARAM(p) ((p)->param)
+1 -1
View File
@@ -1982,7 +1982,7 @@ void evalFunctions()
#else #else
if (getSwitch(swtch, 0)) { if (getSwitch(swtch, 0)) {
#endif #endif
if (sd->delay) { if (sd->active) {
if (sd->func < FUNC_TRAINER) { if (sd->func < FUNC_TRAINER) {
safetyCh[sd->func] = FSW_PARAM(sd); safetyCh[sd->func] = FSW_PARAM(sd);
} }