From 7526f4f5b49196b7905dd0588d1beafeee26c962 Mon Sep 17 00:00:00 2001 From: bsongis Date: Tue, 16 Oct 2012 08:30:19 +0000 Subject: [PATCH] [all] Another Global Variables bug fixed (thanks again Gabriel!) --- src/menus.cpp | 1 + src/model_menus.cpp | 10 +++++----- src/myeeprom.h | 6 +++--- src/open9x.cpp | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/menus.cpp b/src/menus.cpp index 15198c875..303bd6b24 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -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); } diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 66fb630a3..c89a0dd33 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -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; diff --git a/src/myeeprom.h b/src/myeeprom.h index 8bff32107..db18cd97a 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -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) diff --git a/src/open9x.cpp b/src/open9x.cpp index dd2a4d0e3..934cd74b4 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -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); }