From 14f8d3e96886417ac75a9ce5379fb7f361cf1944 Mon Sep 17 00:00:00 2001 From: bsongis Date: Wed, 16 May 2012 17:59:11 +0000 Subject: [PATCH] SafetySwich function redesigned --- src/model_menus.cpp | 25 ++++++++++++++++++------- src/open9x.cpp | 4 ++-- src/translations/cz.h | 2 +- src/translations/en.h | 2 +- src/translations/fr.h | 2 +- src/translations/it.h | 2 +- src/translations/se.h | 2 +- 7 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/model_menus.cpp b/src/model_menus.cpp index e72baf6fa..c357ddd8b 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -2073,7 +2073,7 @@ void menuProcCustomSwitches(uint8_t event) void menuProcFunctionSwitches(uint8_t event) { - MENU(STR_MENUFUNCSWITCHES, menuTabModel, e_FunctionSwitches, NUM_FSW+1, {0, 2/*repeated*/}); + MENU(STR_MENUFUNCSWITCHES, menuTabModel, e_FunctionSwitches, NUM_FSW+1, {0, 3/*repeated*/}); uint8_t y = 0; uint8_t k = 0; @@ -2084,7 +2084,7 @@ void menuProcFunctionSwitches(uint8_t event) k=i+s_pgOfs; if(k==NUM_CHNOUT) break; FuncSwData *sd = &g_model.funcSw[k]; - for (uint8_t j=0; j<3; j++) { + for (uint8_t j=0; j<4; j++) { uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); uint8_t active = (attr && (s_editMode>0 || p1valdiff)); switch (j) { @@ -2099,7 +2099,7 @@ void menuProcFunctionSwitches(uint8_t event) uint8_t func_displayed; if (sd->func < 16) { func_displayed = 0; - putsChnRaw(14*FW-2, y, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+NUM_STICKS+2+3+NUM_PPM+sd->func+1, attr); + putsChnRaw(11*FW-2, y, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+NUM_STICKS+2+3+NUM_PPM+sd->func+1, attr); } else if (sd->func < 16 + NUM_STICKS + 1) { func_displayed = 1; @@ -2146,12 +2146,13 @@ void menuProcFunctionSwitches(uint8_t event) lcd_putsiAtt(15*FW, y, STR_VFSWRESET, sd->param, attr); } else if (sd->func <= FUNC_SAFETY_CH16) { - val_displayed = (int16_t)(int8_t)sd->param; - val_min = -125; - val_max = 125; - lcd_outdezAtt(21*FW, y, val_displayed, attr); + int8_t value = ((int8_t)sd->param >> 1); + lcd_outdezAtt(18*FW, y, value * 2, attr); + if (active) sd->param = (sd->param & 1) + (checkIncDecModel(event, value, -63, 63) << 1); + break; } else { + if (attr) m_posHorz = 0; break; } @@ -2163,6 +2164,16 @@ void menuProcFunctionSwitches(uint8_t event) m_posHorz = 0; } break; + + case 3: + if (sd->swtch && sd->func <= FUNC_SAFETY_CH16) { + menu_lcd_onoff(18*FW+2, y, (sd->param & 1), attr ) ; + if (active) sd->param = (sd->param & 0xfe) + checkIncDecModel(event,sd->param & 1, 0, 1); + } + else if (attr) { + m_posHorz = 0; + } + break; } } } diff --git a/src/open9x.cpp b/src/open9x.cpp index 15f4621e1..368579ff3 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -1436,8 +1436,8 @@ void evalFunctions() swtch += MAX_SWITCH+1; } if (getSwitch(swtch, 0)) { - if (sd->func < FUNC_TRAINER && (g_menuStack[g_menuStackPtr] != menuProcFunctionSwitches || m_posVert != (i+1) || m_posHorz > 1)) { - safetyCh[sd->func] = (int8_t)sd->param; + if (sd->func < FUNC_TRAINER && (sd->param & 1)) { + safetyCh[sd->func] = ((int8_t)sd->param >> 1) * 2; } if (~active_functions & function_mask) { diff --git a/src/translations/cz.h b/src/translations/cz.h index 58a22a4c3..aa5e02f5f 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -121,7 +121,7 @@ #else #define TR_TEST #endif -#define TR_VFSWFUNC "Bezpecny \0 ""Trener\0 ""Instant Trim " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "Bezpec.\0 ""Trener\0 ""Instant Trim " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""Vse ""Telem." diff --git a/src/translations/en.h b/src/translations/en.h index e7bf30a48..962497beb 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -121,7 +121,7 @@ #else #define TR_TEST #endif -#define TR_VFSWFUNC "Security \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "Safety\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""All ""Telem." diff --git a/src/translations/fr.h b/src/translations/fr.h index ef6a71b0b..f90d40f6b 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -121,7 +121,7 @@ #else #define TR_TEST #endif -#define TR_VFSWFUNC "Securite \0 ""Ecolage \0 ""Trim instant " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "Secur.\0 ""Ecolage \0 ""Trim instant " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""All ""Telem." diff --git a/src/translations/it.h b/src/translations/it.h index cb048fefc..ff9eb69ca 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -121,7 +121,7 @@ #else #define TR_TEST #endif -#define TR_VFSWFUNC "Blocco \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "Blocco\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""Tutto ""Telem." diff --git a/src/translations/se.h b/src/translations/se.h index 21cde799a..87fb850d3 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -121,7 +121,7 @@ #else #define TR_TEST #endif -#define TR_VFSWFUNC "S\201kerhet \0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST +#define TR_VFSWFUNC "S\201kerh.\0 ""Trainer \0 ""Instant Trim " TR_SOUND TR_HAPTIC TR_SOMO "Reset\0 " TR_VVARIO TR_SDCLOGS TR_TEST #define LEN_VFSWRESET "\006" #define TR_VFSWRESET "Timer1""Timer2""All ""Telem."