[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;
if (invers && event == EVT_KEY_LONG(KEY_MENU)) {
s_editMode = !s_editMode;
value = ((value >= 126 || value <= -126) ? REG(value, min, max) : 126);
eeDirty(EE_MODEL);
}
+5 -5
View File
@@ -2620,11 +2620,11 @@ void menuModelFunctionSwitches(uint8_t event)
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
switch (j) {
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);
}
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 defined(PCBSKY9X)
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:
if (sd->swtch && sd->func <= FUNC_INSTANT_TRIM) {
#if defined(GRAPHICS)
menu_lcd_onoff(20*FW, y, sd->delay, attr);
menu_lcd_onoff(20*FW, y, sd->active, attr);
#else
menu_lcd_onoff(18*FW+2, y, sd->delay, attr) ;
menu_lcd_onoff(18*FW+2, y, sd->active, attr) ;
#endif
if (active) CHECK_INCDEC_MODELVAR(event, sd->delay, 0, 1);
if (active) CHECK_INCDEC_MODELVAR(event, sd->active, 0, 1);
}
else if (attr) {
m_posHorz = 0;
+3 -3
View File
@@ -389,15 +389,15 @@ PACK(typedef struct t_FuncSwData { // Function Switches data
int8_t swtch; //input
uint8_t func;
char param[6];
uint8_t delay;
uint8_t active;
uint8_t spare;
}) FuncSwData;
#define FSW_PARAM(p) (*((uint32_t*)(p)->param))
#else
PACK(typedef struct t_FuncSwData { // Function Switches data
int8_t swtch; //input
uint8_t func:5;
uint8_t delay:3;
uint8_t func:7;
uint8_t active:1;
uint8_t param;
}) FuncSwData;
#define FSW_PARAM(p) ((p)->param)
+1 -1
View File
@@ -1982,7 +1982,7 @@ void evalFunctions()
#else
if (getSwitch(swtch, 0)) {
#endif
if (sd->delay) {
if (sd->active) {
if (sd->func < FUNC_TRAINER) {
safetyCh[sd->func] = FSW_PARAM(sd);
}