From 4b014c163ba15ec70663b40c1c25f21cdf1f489b Mon Sep 17 00:00:00 2001 From: "bsongis@gmail.com" Date: Sat, 8 Jun 2013 19:10:00 +0000 Subject: [PATCH] [Taranis] Mixer screen rearrangement (phases are displayed) [Taranis] Only 8 chars in Expos/Mixes names (instead of 10) --- src/gui/menu_model.cpp | 71 +++++++++++++++++++++++++++++------------- src/myeeprom.h | 42 +++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 25 deletions(-) diff --git a/src/gui/menu_model.cpp b/src/gui/menu_model.cpp index e42a62f8e..3953e5669 100644 --- a/src/gui/menu_model.cpp +++ b/src/gui/menu_model.cpp @@ -1606,8 +1606,13 @@ void displayFlightModes(uint8_t x, uint8_t y, FlightModesType value) do { --p; if (!(value & (1<= 212 - #define EXPO_LINE_WEIGHT_POS 7*FW-1 - #define EXPO_LINE_EXPO_POS 11*FW - #define EXPO_LINE_SWITCH_POS 11*FW+5 - #define EXPO_LINE_SIDE_POS 15*FW+2 + #define EXPO_LINE_WEIGHT_POS 7*FW+1 + #define EXPO_LINE_EXPO_POS 11*FW+5 + #define EXPO_LINE_SWITCH_POS 13*FW+3 + #define EXPO_LINE_SIDE_POS 17*FW+4 #define EXPO_LINE_SELECT_POS 18 + #define EXPO_LINE_FM_POS LCD_W-LEN_EXPOMIX_NAME*FW-MENUS_SCROLLBAR_WIDTH-FW-1 + #define EXPO_LINE_NAME_POS LCD_W-LEN_EXPOMIX_NAME*FW-MENUS_SCROLLBAR_WIDTH + #define MIX_LINE_SRC_POS 4*FW + #define MIX_LINE_WEIGHT_POS 11*FW+5 + #define MIX_LINE_CURVE_POS 12*FW+4 + #define MIX_LINE_SWITCH_POS 16*FW+2 + #define MIX_LINE_DELAY_POS 19*FW+5 #elif defined(CPUARM) #define EXPO_LINE_WEIGHT_POS 7*FW-1 #define EXPO_LINE_EXPO_POS 10*FW+5 #define EXPO_LINE_SWITCH_POS 11*FW+2 #define EXPO_LINE_SIDE_POS 14*FW+2 #define EXPO_LINE_SELECT_POS 24 + #define EXPO_LINE_FM_POS + #define EXPO_LINE_NAME_POS LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH + #define MIX_LINE_SRC_POS 4*FW + #define MIX_LINE_WEIGHT_POS 11*FW+3 + #define MIX_LINE_CURVE_POS 12*FW+2 + #define MIX_LINE_SWITCH_POS 16*FW + #define MIX_LINE_DELAY_POS 19*FW+7 #else #define EXPO_LINE_WEIGHT_POS 7*FW-1 #define EXPO_LINE_EXPO_POS 11*FW #define EXPO_LINE_SWITCH_POS 11*FW+4 #if MAX_PHASES == 6 - #define EXPO_LINE_SIDE_POS 15*FW + #define EXPO_LINE_SIDE_POS 15*FW #else - #define EXPO_LINE_SIDE_POS 15*FW+2 + #define EXPO_LINE_SIDE_POS 15*FW+2 #endif + #define EXPO_LINE_FM_POS LCD_W-FW-MENUS_SCROLLBAR_WIDTH #define EXPO_LINE_SELECT_POS 24 + #define MIX_LINE_SRC_POS 4*FW + #define MIX_LINE_WEIGHT_POS 11*FW+3 + #define MIX_LINE_CURVE_POS 12*FW+2 + #define MIX_LINE_SWITCH_POS 16*FW + #define MIX_LINE_DELAY_POS 19*FW+7 #endif #if defined(NAVIGATION_MENUS) @@ -3227,12 +3252,12 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) if (ed->mode!=3) lcd_putc(EXPO_LINE_SIDE_POS, y, ed->mode == 2 ? 126 : 127); #if defined(CPUARM) && LCD_W >= 212 - displayFlightModes(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH-FW-3, y, ed->phases); - if (ed->name[0]) lcd_putsnAtt(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0)); + displayFlightModes(EXPO_LINE_FM_POS, y, ed->phases); + if (ed->name[0]) lcd_putsnAtt(EXPO_LINE_NAME_POS, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0)); #elif defined(CPUARM) - if (ed->name[0]) lcd_putsnAtt(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0)); + if (ed->name[0]) lcd_putsnAtt(EXPO_LINE_NAME_POS, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0)); #else - displayFlightModes(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ed->phases); + displayFlightModes(EXPO_LINE_FM_POS, y, ed->phases); #endif } else { @@ -3242,16 +3267,19 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) } #endif - if (mixCnt > 0) - lcd_putsiAtt(1*FW+0, y, STR_VMLTPX2, md->mltpx, 0); + if (mixCnt > 0) lcd_putsiAtt(FW, y, STR_VMLTPX2, md->mltpx, 0); - putsMixerSource(4*FW+0, y, md->srcRaw, isMixActive(i) ? BOLD : 0); + putsMixerSource(MIX_LINE_SRC_POS, y, md->srcRaw, isMixActive(i) ? BOLD : 0); - gvarWeightItem(11*FW+3, y, md, attr, event); + gvarWeightItem(MIX_LINE_WEIGHT_POS, y, md, attr, event); + +#if LCD_W >= 212 + displayFlightModes(EXPO_LINE_FM_POS, y, md->phases); +#endif #if defined(CPUARM) if (md->name[0]) { - lcd_putsnAtt(LCD_W-sizeof(md->name)*FW-MENUS_SCROLLBAR_WIDTH, y, md->name, sizeof(md->name), ZCHAR | (isMixActive(i) ? BOLD : 0)); + lcd_putsnAtt(EXPO_LINE_NAME_POS, y, md->name, sizeof(md->name), ZCHAR | (isMixActive(i) ? BOLD : 0)); } #if LCD_W < 212 else @@ -3260,20 +3288,19 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) { if (md->curveParam) { if (md->curveMode == MODE_CURVE) - putsCurve(12*FW+2, y, md->curveParam); + putsCurve(MIX_LINE_CURVE_POS, y, md->curveParam); else - displayGVar(15*FW+2, y, md->curveParam, -100, 100); // open.20.fsguruh - // displayGVar(15*FW+2, y, md->curveParam, -125, 125); // only -100 to +100 is allowed now - // could be increased now, but is it useful? differentiate with more the +-100% is a fault, correct? + displayGVar(MIX_LINE_CURVE_POS+3*FW, y, md->curveParam, -100, 100); } - if (md->swtch) putsSwitches(16*FW, y, md->swtch); + + if (md->swtch) putsSwitches(MIX_LINE_SWITCH_POS, y, md->swtch); char cs = ' '; if (md->speedDown || md->speedUp) cs = 'S'; if ((md->delayUp || md->delayDown)) cs = (cs =='S' ? '*' : 'D'); - lcd_putc(19*FW+7, y, cs); + lcd_putc(MIX_LINE_DELAY_POS, y, cs); } } if (s_copyMode) { diff --git a/src/myeeprom.h b/src/myeeprom.h index b4910c98f..cc2f0245e 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -317,7 +317,7 @@ PACK(typedef struct t_EEGeneral { #if defined(PCBTARANIS) #define LEN_MODEL_NAME 12 #define LEN_BITMAP_NAME 10 -#define LEN_EXPOMIX_NAME 10 +#define LEN_EXPOMIX_NAME 8 #define LEN_FP_NAME 10 #elif defined(PCBSKY9X) #define LEN_MODEL_NAME 10 @@ -328,7 +328,19 @@ PACK(typedef struct t_EEGeneral { #define LEN_FP_NAME 6 #endif -#if defined(CPUARM) +#if defined(PCBTARANIS) +PACK(typedef struct t_ExpoData { + uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both + uint8_t chn; + int8_t swtch; + uint16_t phases; + int8_t weight; + uint8_t curveMode; + char name[LEN_EXPOMIX_NAME]; + uint8_t spare[2]; + int8_t curveParam; +}) ExpoData; +#elif defined(CPUARM) PACK(typedef struct t_ExpoData { uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both uint8_t chn; @@ -394,6 +406,30 @@ PACK(typedef struct t_LimitData { #define SLOW_STEP 10 #define DELAY_MAX (25*DELAY_STEP) /* 25 seconds */ #define SLOW_MAX (25*SLOW_STEP) /* 25 seconds */ +#if defined(PCBTARANIS) +PACK(typedef struct t_MixData { + uint8_t destCh; + uint16_t phases; + uint8_t curveMode:1; // O=curve, 1=differential + uint8_t noExpo:1; + int8_t carryTrim:3; + uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means := + uint8_t spare1:1; + int16_t weight; + int8_t swtch; + int8_t curveParam; + uint8_t mixWarn:4; // mixer warning + uint8_t srcVariant:4; + uint8_t delayUp; + uint8_t delayDown; + uint8_t speedUp; + uint8_t speedDown; + uint8_t srcRaw; + int16_t offset; + char name[LEN_EXPOMIX_NAME]; + uint8_t spare2[2]; +}) MixData; +#else PACK(typedef struct t_MixData { uint8_t destCh; uint16_t phases; @@ -415,7 +451,7 @@ PACK(typedef struct t_MixData { int16_t offset; char name[LEN_EXPOMIX_NAME]; }) MixData; - +#endif #define MD_WEIGHT(md) (md->weight) #define MD_WEIGHT_TO_UNION(md, var) var.word = md->weight #define MD_UNION_TO_WEIGHT(var, md) md->weight = var.word