From 4a9c87cc9cae79b49151d8ca9607425d07f254c0 Mon Sep 17 00:00:00 2001 From: bsongis Date: Thu, 5 Feb 2015 21:56:28 +0100 Subject: [PATCH 1/4] Fixes #2032 --- companion/src/eeprominterface.h | 2 + .../src/firmwares/opentx/opentxeeprom.cpp | 4 + radio/src/gui/9X/helpers.cpp | 5 - radio/src/gui/9X/menu_model_heli.cpp | 2 +- radio/src/gui/9X/menu_model_inputs_mixes.cpp | 16 +-- radio/src/gui/9X/menu_model_setup.cpp | 2 +- radio/src/gui/Taranis/menu_model_heli.cpp | 36 +++-- .../gui/Taranis/menu_model_inputs_mixes.cpp | 8 +- radio/src/gui/Taranis/menu_model_setup.cpp | 4 +- radio/src/gui/Taranis/view_main.cpp | 2 +- radio/src/mixer.cpp | 124 ++++++++---------- radio/src/myeeprom.h | 17 ++- radio/src/translations.cpp | 4 +- radio/src/translations.h | 4 +- radio/src/translations/cz.h.txt | 4 +- radio/src/translations/de.h.txt | 4 +- radio/src/translations/en.h.txt | 28 ++-- radio/src/translations/es.h.txt | 4 +- radio/src/translations/fi.h.txt | 6 +- radio/src/translations/fr.h.txt | 6 +- radio/src/translations/it.h.txt | 4 +- radio/src/translations/pl.h.txt | 4 +- radio/src/translations/pt.h.txt | 4 +- radio/src/translations/se.h.txt | 4 +- 24 files changed, 173 insertions(+), 125 deletions(-) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index f34c9f4a2..35a03e197 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -689,6 +689,8 @@ class SwashRingData { // Swash Ring data bool invertCOL; unsigned int type; RawSource collectiveSource; + RawSource aileronSource; + RawSource elevatorSource; unsigned int value; void clear() { memset(this, 0, sizeof(SwashRingData)); } }; diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 93510b2a2..e2685a69a 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -730,6 +730,10 @@ class HeliField: public StructField { Append(new BoolField<1>(heli.invertCOL)); Append(new UnsignedField<5>(heli.type)); Append(new SourceField<8>(heli.collectiveSource, board, version, variant)); + if (IS_TARANIS(board) && version >= 217) { + Append(new SourceField<8>(heli.aileronSource, board, version, variant)); + Append(new SourceField<8>(heli.elevatorSource, board, version, variant)); + } //, FLAG_NOSWITCHES)); Fix shift in collective Append(new UnsignedField<8>(heli.value)); } diff --git a/radio/src/gui/9X/helpers.cpp b/radio/src/gui/9X/helpers.cpp index 68c73e750..ba3cc6624 100755 --- a/radio/src/gui/9X/helpers.cpp +++ b/radio/src/gui/9X/helpers.cpp @@ -208,11 +208,6 @@ bool isSwitchAvailableInTimers(int swtch) return isSwitchAvailable(swtch, TimersContext); } -bool isThrottleSourceAvailable(int source) -{ - return true; -} - bool isLogicalSwitchFunctionAvailable(int function) { return function != LS_FUNC_RANGE; diff --git a/radio/src/gui/9X/menu_model_heli.cpp b/radio/src/gui/9X/menu_model_heli.cpp index 5a79194e7..a6df1749d 100755 --- a/radio/src/gui/9X/menu_model_heli.cpp +++ b/radio/src/gui/9X/menu_model_heli.cpp @@ -61,7 +61,7 @@ void menuModelHeli(uint8_t event) break; case ITEM_HELI_COLLECTIVE: - g_model.swashR.collectiveSource = selectMenuItem(HELI_PARAM_OFS, y, STR_COLLECTIVE, NULL, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH, attr, event); + g_model.swashR.collectiveSource = selectMenuItem(HELI_PARAM_OFS, y, STR_COLLECTIVE_SOURCE, NULL, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH, attr, event); putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.collectiveSource, attr); break; diff --git a/radio/src/gui/9X/menu_model_inputs_mixes.cpp b/radio/src/gui/9X/menu_model_inputs_mixes.cpp index 77cbbc8ec..c55fd4761 100644 --- a/radio/src/gui/9X/menu_model_inputs_mixes.cpp +++ b/radio/src/gui/9X/menu_model_inputs_mixes.cpp @@ -282,7 +282,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up) enum ExposFields { CASE_CPUARM(EXPO_FIELD_NAME) EXPO_FIELD_WEIGHT, - CASE_9X(EXPO_FIELD_EXPO) + EXPO_FIELD_EXPO, CASE_CURVES(EXPO_FIELD_CURVE) CASE_FLIGHT_MODES(EXPO_FIELD_FLIGHT_MODES) EXPO_FIELD_SWITCH, @@ -311,7 +311,7 @@ void menuModelExpoOne(uint8_t event) { #if defined(CPUARM) case EXPO_FIELD_NAME: - editSingleName(EXPO_ONE_2ND_COLUMN-IF_9X(sizeof(ed->name)*FW), y, STR_EXPONAME, ed->name, sizeof(ed->name), event, attr); + editSingleName(EXPO_ONE_2ND_COLUMN-sizeof(ed->name)*FW, y, STR_EXPONAME, ed->name, sizeof(ed->name), event, attr); break; #endif @@ -353,16 +353,16 @@ void menuModelExpoOne(uint8_t event) #if defined(FLIGHT_MODES) case EXPO_FIELD_FLIGHT_MODES: - ed->flightModes = editFlightModes(EXPO_ONE_2ND_COLUMN-IF_9X(EXPO_ONE_FM_WIDTH), y, event, ed->flightModes, attr); + ed->flightModes = editFlightModes(EXPO_ONE_2ND_COLUMN-EXPO_ONE_FM_WIDTH, y, event, ed->flightModes, attr); break; #endif case EXPO_FIELD_SWITCH: - ed->swtch = switchMenuItem(EXPO_ONE_2ND_COLUMN-IF_9X(3*FW), y, ed->swtch, attr, event); + ed->swtch = switchMenuItem(EXPO_ONE_2ND_COLUMN-3*FW, y, ed->swtch, attr, event); break; case EXPO_FIELD_SIDE: - ed->mode = 4 - selectMenuItem(EXPO_ONE_2ND_COLUMN-IF_9X(3*FW), y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, attr, event); + ed->mode = 4 - selectMenuItem(EXPO_ONE_2ND_COLUMN-3*FW, y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, attr, event); break; } y += FH; @@ -474,11 +474,11 @@ void menuModelMixOne(uint8_t event) #else if (m_posVert == MIX_FIELD_TRIM && md2->srcRaw > NUM_STICKS) #endif - SUBMENU_NOTITLE(MIX_FIELD_COUNT, {CASE_CPUARM(0) 0, 0, 0, CASE_9X(0) CASE_CURVES(0) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0, 0 /*, ...*/}) + SUBMENU_NOTITLE(MIX_FIELD_COUNT, {CASE_CPUARM(0) 0, 0, 0, 0, CASE_CURVES(0) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0, 0 /*, ...*/}) else - SUBMENU_NOTITLE(MIX_FIELD_COUNT, {CASE_CPUARM(0) 0, 0, 0, CASE_9X(1) CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0, 0 /*, ...*/}); + SUBMENU_NOTITLE(MIX_FIELD_COUNT, {CASE_CPUARM(0) 0, 0, 0, 1, CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0, 0 /*, ...*/}); #else - SUBMENU_NOTITLE(MIX_FIELD_COUNT, {CASE_CPUARM(0) 0, 0, 0, CASE_9X(1) CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0, 0 /*, ...*/}); + SUBMENU_NOTITLE(MIX_FIELD_COUNT, {CASE_CPUARM(0) 0, 0, 0, 1, CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0, 0 /*, ...*/}); #endif #if MENU_COLUMNS > 1 diff --git a/radio/src/gui/9X/menu_model_setup.cpp b/radio/src/gui/9X/menu_model_setup.cpp index dbd46e702..efa855336 100644 --- a/radio/src/gui/9X/menu_model_setup.cpp +++ b/radio/src/gui/9X/menu_model_setup.cpp @@ -351,7 +351,7 @@ void menuModelSetup(uint8_t event) case ITEM_MODEL_THROTTLE_TRACE: { lcd_putsLeft(y, STR_TTRACE); - if (attr) CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, g_model.thrTraceSrc, NUM_POTS+NUM_CHNOUT, isThrottleSourceAvailable); + if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.thrTraceSrc, NUM_POTS+NUM_CHNOUT); uint8_t idx = g_model.thrTraceSrc + MIXSRC_Thr; if (idx > MIXSRC_Thr) idx += 1; diff --git a/radio/src/gui/Taranis/menu_model_heli.cpp b/radio/src/gui/Taranis/menu_model_heli.cpp index 6fa309780..e489569a1 100755 --- a/radio/src/gui/Taranis/menu_model_heli.cpp +++ b/radio/src/gui/Taranis/menu_model_heli.cpp @@ -37,31 +37,49 @@ enum menuModelHeliItems { ITEM_HELI_SWASHTYPE, - ITEM_HELI_COLLECTIVE, + ITEM_HELI_ELESOURCE, + ITEM_HELI_AILSOURCE, + ITEM_HELI_COLSOURCE, ITEM_HELI_SWASHRING, ITEM_HELI_ELEDIRECTION, ITEM_HELI_AILDIRECTION, - ITEM_HELI_COLDIRECTION + ITEM_HELI_COLDIRECTION, + ITEM_HELI_MAX }; #define HELI_PARAM_OFS (23*FW) void menuModelHeli(uint8_t event) { - SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, 7); + SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, ITEM_HELI_MAX); - uint8_t sub = m_posVert - 1; + int sub = m_posVert; - for (uint8_t i=0; i<6; i++) { + for (unsigned int i=0; i0) ? BLINK|INVERS : INVERS) : 0); - switch(i) { + int k = i+s_pgOfs; + LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS); + LcdFlags attr = (sub == k ? blink : 0); + + switch(k) { case ITEM_HELI_SWASHTYPE: g_model.swashR.type = selectMenuItem(HELI_PARAM_OFS, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event); break; - case ITEM_HELI_COLLECTIVE: - lcd_putsLeft(y, STR_COLLECTIVE); + case ITEM_HELI_ELESOURCE: + lcd_putsLeft(y, STR_ELEVATOR_SOURCE); + if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.elevatorSource, 0, MIXSRC_LAST_CH); + putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.elevatorSource, attr); + break; + + case ITEM_HELI_AILSOURCE: + lcd_putsLeft(y, STR_AILERON_SOURCE); + if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.aileronSource, 0, MIXSRC_LAST_CH); + putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.aileronSource, attr); + break; + + case ITEM_HELI_COLSOURCE: + lcd_putsLeft(y, STR_COLLECTIVE_SOURCE); if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH); putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.collectiveSource, attr); break; diff --git a/radio/src/gui/Taranis/menu_model_inputs_mixes.cpp b/radio/src/gui/Taranis/menu_model_inputs_mixes.cpp index f398dcfd0..09e6506d1 100644 --- a/radio/src/gui/Taranis/menu_model_inputs_mixes.cpp +++ b/radio/src/gui/Taranis/menu_model_inputs_mixes.cpp @@ -335,7 +335,7 @@ void menuModelExpoOne(uint8_t event) break; case EXPO_FIELD_NAME: - editSingleName(EXPO_ONE_2ND_COLUMN-IF_9X(sizeof(ed->name)*FW), y, STR_EXPONAME, ed->name, sizeof(ed->name), event, attr); + editSingleName(EXPO_ONE_2ND_COLUMN, y, STR_EXPONAME, ed->name, sizeof(ed->name), event, attr); break; case EXPO_FIELD_SOURCE: @@ -369,16 +369,16 @@ void menuModelExpoOne(uint8_t event) #if defined(FLIGHT_MODES) case EXPO_FIELD_FLIGHT_MODES: - ed->flightModes = editFlightModes(EXPO_ONE_2ND_COLUMN-IF_9X(EXPO_ONE_FM_WIDTH), y, event, ed->flightModes, attr); + ed->flightModes = editFlightModes(EXPO_ONE_2ND_COLUMN, y, event, ed->flightModes, attr); break; #endif case EXPO_FIELD_SWITCH: - ed->swtch = switchMenuItem(EXPO_ONE_2ND_COLUMN-IF_9X(3*FW), y, ed->swtch, attr, event); + ed->swtch = switchMenuItem(EXPO_ONE_2ND_COLUMN, y, ed->swtch, attr, event); break; case EXPO_FIELD_SIDE: - ed->mode = 4 - selectMenuItem(EXPO_ONE_2ND_COLUMN-IF_9X(3*FW), y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, attr, event); + ed->mode = 4 - selectMenuItem(EXPO_ONE_2ND_COLUMN, y, STR_SIDE, STR_VSIDE, 4-ed->mode, 1, 3, attr, event); break; case EXPO_FIELD_TRIM: diff --git a/radio/src/gui/Taranis/menu_model_setup.cpp b/radio/src/gui/Taranis/menu_model_setup.cpp index 1e9449c94..590702af6 100644 --- a/radio/src/gui/Taranis/menu_model_setup.cpp +++ b/radio/src/gui/Taranis/menu_model_setup.cpp @@ -43,13 +43,13 @@ enum menuModelSetupItems { ITEM_MODEL_BITMAP, ITEM_MODEL_TIMER1, ITEM_MODEL_TIMER1_NAME, - CASE_PERSISTENT_TIMERS(ITEM_MODEL_TIMER1_PERSISTENT) + ITEM_MODEL_TIMER1_PERSISTENT, ITEM_MODEL_TIMER1_MINUTE_BEEP, ITEM_MODEL_TIMER1_COUNTDOWN_BEEP, #if TIMERS > 1 ITEM_MODEL_TIMER2, ITEM_MODEL_TIMER2_NAME, - CASE_PERSISTENT_TIMERS(ITEM_MODEL_TIMER2_PERSISTENT) + ITEM_MODEL_TIMER2_PERSISTENT, ITEM_MODEL_TIMER2_MINUTE_BEEP, ITEM_MODEL_TIMER2_COUNTDOWN_BEEP, #endif diff --git a/radio/src/gui/Taranis/view_main.cpp b/radio/src/gui/Taranis/view_main.cpp index 9f0ae1d9c..11577538b 100755 --- a/radio/src/gui/Taranis/view_main.cpp +++ b/radio/src/gui/Taranis/view_main.cpp @@ -446,7 +446,7 @@ bool isMenuAvailable(int index) } } -#define GRAPHICAL_MENUS 1 +#define GRAPHICAL_MENUS 0 #if GRAPHICAL_MENUS == 1 #define DECLARE_MAIN_MENU() static int currentMenuIndex = -1 diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index 01b264c3b..039e71948 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -63,20 +63,11 @@ int16_t ex_chans[NUM_CHNOUT] = {0}; // Outputs (before LIMITS) of the last perMa #if defined(HELI) int16_t cyc_anas[3] = {0}; - #if defined(PCBTARANIS) - int16_t heliAnas[4] = {0}; - int8_t heliTrims[4] = {0}; - #endif #endif void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) { -#if defined(PCBTARANIS) -#if defined(HELI) - int16_t heliAnasCopy[4]; - memcpy(heliAnasCopy, heliAnas, sizeof(heliAnasCopy)); -#endif -#else +#if !defined(PCBTARANIS) int16_t anas2[NUM_INPUTS]; // values before expo, to ensure same expo base when multiple expo lines are used memcpy(anas2, anas, sizeof(anas2)); #endif @@ -96,14 +87,9 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) if (getSwitch(ed->swtch)) { #if defined(PCBTARANIS) int v; - if (ed->srcRaw == ovwrIdx) + if (ed->srcRaw == ovwrIdx) { v = ovwrValue; -#if defined(HELI) - else if (ed->srcRaw == MIXSRC_Ele) - v = heliAnasCopy[ELE_STICK]; - else if (ed->srcRaw == MIXSRC_Ail) - v = heliAnasCopy[AIL_STICK]; -#endif + } else { v = getValue(ed->srcRaw); if (ed->srcRaw >= MIXSRC_FIRST_TELEM && ed->scale > 0) { @@ -152,17 +138,6 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) virtualInputsTrims[cur_chn] = ed->srcRaw - MIXSRC_Rud; else virtualInputsTrims[cur_chn] = -1; - -#if defined(HELI) - if (ed->srcRaw == MIXSRC_Ele) { - heliAnas[ELE_STICK] = v; - heliTrims[ELE_STICK] = virtualInputsTrims[cur_chn]; - } - else if (ed->srcRaw == MIXSRC_Ail) { - heliAnas[AIL_STICK] = v; - heliTrims[AIL_STICK] = virtualInputsTrims[cur_chn]; - } -#endif #endif anas[cur_chn] = v; @@ -426,7 +401,13 @@ void evalInputs(uint8_t mode) #if defined(HELI) uint16_t d = 0; if (g_model.swashR.value) { +#if defined(PCBTARANIS) + int ele = (int16_t)anaIn(ELE_STICK); + int ail = (int16_t)anaIn(AIL_STICK); + uint32_t v = (ele*ele) + (ail*ail); +#else uint32_t v = (int32_t(calibratedStick[ELE_STICK])*calibratedStick[ELE_STICK] + int32_t(calibratedStick[AIL_STICK])*calibratedStick[AIL_STICK]); +#endif uint32_t q = calc100toRESX(g_model.swashR.value); q *= q; if (v > q) { @@ -514,7 +495,7 @@ void evalInputs(uint8_t mode) if (ch < NUM_STICKS) { //only do this for sticks #if defined(PCBTARANIS) if (mode & e_perout_mode_nosticks) { - v = calibratedStick[ch] = 0; + v = 0; } #endif @@ -536,9 +517,6 @@ void evalInputs(uint8_t mode) v = vStud; break; } -#if defined(PCBTARANIS) - calibratedStick[ch] = v; -#endif } } @@ -546,12 +524,11 @@ void evalInputs(uint8_t mode) if (d && (ch==ELE_STICK || ch==AIL_STICK)) { v = (int32_t(v) * calc100toRESX(g_model.swashR.value)) / int32_t(d); } -#if defined(PCBTARANIS) - heliAnas[ch] = v; -#endif #endif -#if !defined(PCBTARANIS) +#if defined(PCBTARANIS) + calibratedStick[ch] = v; +#else rawAnas[ch] = v; anas[ch] = v; // set values for mixer #endif @@ -567,18 +544,38 @@ void evalInputs(uint8_t mode) if (mode == e_perout_mode_normal) { #if !defined(CPUARM) anaCenter &= g_model.beepANACenter; - if(((bpanaCenter ^ anaCenter) & anaCenter)) AUDIO_POT_MIDDLE(); + if (((bpanaCenter ^ anaCenter) & anaCenter)) AUDIO_POT_MIDDLE(); #endif bpanaCenter = anaCenter; } } #if defined(PCBTARANIS) - #define HELI_ANAS_ARRAY(x) heliAnas[x] - #define HELI_TRIMS_ARRAY(x) ((heliTrims[x]>=0) ? trims[heliTrims[x]] : 0) -#else - #define HELI_ANAS_ARRAY(x) anas[x] - #define HELI_TRIMS_ARRAY(x) trims[x] +int getStickTrimValue(int stick) +{ + int trim = trims[stick]; + if (stick == THR_STICK) { + if (g_model.thrTrim) { + int trimMin = g_model.extendedTrims ? 2*TRIM_EXTENDED_MIN : 2*TRIM_MIN; + int v = calibratedStick[THR_STICK]; + trim = (((g_model.throttleReversed)?(trim+trimMin):(trim-v)) * (RESX-v)) >> (RESX_SHIFT+1); + } + if (g_model.throttleReversed) { + trim = -trim; + } + } + return trim; +} + +int getSourceTrimValue(int source) +{ + if (source >= MIXSRC_Rud && source <= MIXSRC_Ail) + return getStickTrimValue(source - MIXSRC_Rud); + else if (source >= MIXSRC_FIRST_INPUT && source <= MIXSRC_LAST_INPUT) + return getStickTrimValue(virtualInputsTrims[source - MIXSRC_FIRST_INPUT]); + else + return 0; +} #endif uint8_t mixerCurrentFlightMode; @@ -593,15 +590,22 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) #endif #if defined(HELI) +#if defined(PCBTARANIS) + int heliEleValue = getValue(g_model.swashR.elevatorSource); + int heliAilValue = getValue(g_model.swashR.aileronSource); +#else + int16_t heliEleValue = anas[ELE_STICK]; + int16_t heliAilValue = anas[AIL_STICK]; +#endif if (g_model.swashR.value) { - uint32_t v = ((int32_t)HELI_ANAS_ARRAY(ELE_STICK)*HELI_ANAS_ARRAY(ELE_STICK) + (int32_t)HELI_ANAS_ARRAY(AIL_STICK)*HELI_ANAS_ARRAY(AIL_STICK)); + uint32_t v = ((int32_t)heliEleValue*heliEleValue + (int32_t)heliAilValue*heliAilValue); uint32_t q = calc100toRESX(g_model.swashR.value); q *= q; if (v>q) { uint16_t d = isqrt32(v); int16_t tmp = calc100toRESX(g_model.swashR.value); - HELI_ANAS_ARRAY(ELE_STICK) = (int32_t) HELI_ANAS_ARRAY(ELE_STICK)*tmp/d; - HELI_ANAS_ARRAY(AIL_STICK) = (int32_t) HELI_ANAS_ARRAY(AIL_STICK)*tmp/d; + heliEleValue = (int32_t) heliEleValue*tmp/d; + heliAilValue = (int32_t) heliAilValue*tmp/d; } } @@ -609,8 +613,13 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) #define REZ_SWASH_Y(x) ((x)) // 1024 => 1024 if (g_model.swashR.type) { - getvalue_t vp = HELI_ANAS_ARRAY(ELE_STICK) + HELI_TRIMS_ARRAY(ELE_STICK); - getvalue_t vr = HELI_ANAS_ARRAY(AIL_STICK) + HELI_TRIMS_ARRAY(AIL_STICK); +#if defined(PCBTARANIS) + getvalue_t vp = heliEleValue + getSourceTrimValue(g_model.swashR.elevatorSource); + getvalue_t vr = heliAilValue + getSourceTrimValue(g_model.swashR.aileronSource); +#else + getvalue_t vp = heliEleValue + trims[ELE_STICK]; + getvalue_t vr = heliAilValue + trims[AIL_STICK]; +#endif getvalue_t vc = 0; if (g_model.swashR.collectiveSource) vc = getValue(g_model.swashR.collectiveSource); @@ -797,26 +806,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) if (!(mode & e_perout_mode_notrims)) { #if defined(PCBTARANIS) if (md->carryTrim == 0) { - int8_t mix_trim; - if (stickIndex < NUM_STICKS) - mix_trim = stickIndex; - else if (md->srcRaw <= MIXSRC_LAST_INPUT) - mix_trim = virtualInputsTrims[md->srcRaw-1]; - else - mix_trim = -1; - if (mix_trim >= 0) { - int32_t trim = trims[mix_trim]; - if (mix_trim == THR_STICK) { - if (g_model.thrTrim) { - int16_t trimMin = g_model.extendedTrims ? 2*TRIM_EXTENDED_MIN : 2*TRIM_MIN; - trim = (((g_model.throttleReversed)?(trim+trimMin):(trim-trimMin)) * (RESX-v)) >> (RESX_SHIFT+1); - } - if (g_model.throttleReversed) { - trim = -trim; - } - } - v += trim; - } + v += getSourceTrimValue(md->srcRaw); } #else int8_t mix_trim = md->carryTrim; diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index b78ab5803..669ee3144 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -1502,7 +1502,19 @@ enum SwashType { SWASH_TYPE_MAX = SWASH_TYPE_90 }; -PACK(typedef struct t_SwashRingData { // Swash Ring data +#if defined(PCBTARANIS) +PACK(typedef struct { + uint8_t invertELE:1; + uint8_t invertAIL:1; + uint8_t invertCOL:1; + uint8_t type:5; + uint8_t collectiveSource; + uint8_t aileronSource; + uint8_t elevatorSource; + uint8_t value; +}) SwashRingData; +#else +PACK(typedef struct { uint8_t invertELE:1; uint8_t invertAIL:1; uint8_t invertCOL:1; @@ -1510,6 +1522,7 @@ PACK(typedef struct t_SwashRingData { // Swash Ring data uint8_t collectiveSource; uint8_t value; }) SwashRingData; +#endif #define TRIM_EXTENDED_MAX 500 #define TRIM_EXTENDED_MIN (-TRIM_EXTENDED_MAX) @@ -1673,7 +1686,7 @@ enum SwitchSources { SWSRC_LAST_SWITCH = SWSRC_TRN, #endif -#if defined(PCBTARANIS) +#if NUM_XPOTS > 0 SWSRC_FIRST_MULTIPOS_SWITCH, SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_XPOTS*XPOTS_MULTIPOS_COUNT) - 1, #endif diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index f652b3a65..e61e6eabb 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -155,7 +155,9 @@ const pm_char STR_DEFAULT[] PROGMEM = TR_DEFAULT; const pm_char STR_CHECKTRIMS[] PROGMEM = TR_CHECKTRIMS; #ifdef HELI const pm_char STR_SWASHTYPE[] PROGMEM = TR_SWASHTYPE; -const pm_char STR_COLLECTIVE[] PROGMEM = TR_COLLECTIVE; +const pm_char STR_COLLECTIVE_SOURCE[] PROGMEM = TR_COLLECTIVE_SOURCE; +const pm_char STR_AILERON_SOURCE[] PROGMEM = TR_AILERON_SOURCE; +const pm_char STR_ELEVATOR_SOURCE[] PROGMEM = TR_ELEVATOR_SOURCE; const pm_char STR_SWASHRING[] PROGMEM = TR_SWASHRING; const pm_char STR_ELEDIRECTION[] PROGMEM = TR_ELEDIRECTION; const pm_char STR_AILDIRECTION[] PROGMEM = TR_AILDIRECTION; diff --git a/radio/src/translations.h b/radio/src/translations.h index e4ca9ec85..cb868718e 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -333,7 +333,9 @@ extern const pm_char STR_FADEOUT[]; extern const pm_char STR_DEFAULT[]; extern const pm_char STR_CHECKTRIMS[]; extern const pm_char STR_SWASHTYPE[]; -extern const pm_char STR_COLLECTIVE[]; +extern const pm_char STR_COLLECTIVE_SOURCE[]; +extern const pm_char STR_AILERON_SOURCE[]; +extern const pm_char STR_ELEVATOR_SOURCE[]; extern const pm_char STR_SWASHRING[]; extern const pm_char STR_ELEDIRECTION[]; extern const pm_char STR_AILDIRECTION[]; diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 963ff6d2a..819beee60 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -547,7 +547,9 @@ #define TR_CHECKTRIMS "\011Kont.\010Trimy" #define OFS_CHECKTRIMS (9*FW) #define TR_SWASHTYPE "Typ cykliky" -#define TR_COLLECTIVE "Kolektiv" +#define TR_COLLECTIVE_SOURCE "Kolektiv" +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING "Cyklika" #define TR_ELEDIRECTION "Směr:Výškovka" #define TR_AILDIRECTION "\012Křidélka" diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index 41ea2d44c..d7c1777a7 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -551,7 +551,9 @@ #define TR_CHECKTRIMS CENTER"\006Trims\012Prüfen" #define OFS_CHECKTRIMS CENTER_OFS+(9*FW) #define TR_SWASHTYPE TR("Typ Taumelsch","Typ Taumelscheibe") -#define TR_COLLECTIVE TR("Kollekt. Pitch","Kollekt. Pitch Kanal") +#define TR_COLLECTIVE_SOURCE TR("Kollekt. Pitch","Kollekt. Pitch Kanal") +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING TR("Ring Begrenz","Ring Taumelscheibe") #define TR_ELEDIRECTION TR("Nick Richtung","Nick Servo Richtung") #define TR_AILDIRECTION TR("Roll Richtung","Roll Servo Richtung") diff --git a/radio/src/translations/en.h.txt b/radio/src/translations/en.h.txt index d4cd9d818..feb87cf1c 100644 --- a/radio/src/translations/en.h.txt +++ b/radio/src/translations/en.h.txt @@ -174,7 +174,7 @@ #define LEN_VMIXTRIMS "\003" #define TR_VMIXTRIMS "OFF""ON\0""Rud""Ele""Thr""Ail" -#if defined(PCBTARANIS) +#if LCD_W >= 212 #define TR_CSWTIMER "Timer" #define TR_CSWSTICKY "Stcky" #define TR_CSWRANGE "Range" @@ -298,7 +298,7 @@ #define TR_FSW_RESET_ROTENC #endif -#if defined(PCBTARANIS) +#if LCD_W >= 212 #define TR_FSW_RESET_TIMERS "Timer 1\0 ""Timer 2\0 ""Timer 3\0 " #elif defined(CPUARM) #define TR_FSW_RESET_TIMERS "Tmr1""Tmr2""Tmr3" @@ -331,7 +331,7 @@ #define TR_ASPD_MAX TR("ASp+", "ASpd+") -#if defined(PCBTARANIS) +#if LCD_W >= 212 #define TR_TELEM_RSSI_RX "RSSI\0" #else #define TR_TELEM_RSSI_RX TR("Rx\0 ", "Rx\0 ") @@ -472,9 +472,9 @@ #if defined(PCBTARANIS) #if defined(REV9E) - #define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46" + #define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36""S41""S42""S43""S44""S45""S46" #else - #define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36" + #define TR_6POS_POTS "S11""S12""S13""S14""S15""S16""S21""S22""S23""S24""S25""S26""S31""S32""S33""S34""S35""S36" #endif #define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_6POS_POTS TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One" #else @@ -519,10 +519,12 @@ #define INDENT "\007" #define LEN_INDENT 1 #define INDENT_WIDTH 12 + #define BREAKSPACE "\036" #else #define INDENT "\001" #define LEN_INDENT 1 #define INDENT_WIDTH (FW/2) + #define BREAKSPACE " " #endif #if defined(PCBTARANIS) @@ -542,7 +544,7 @@ #define TR_MENUWHENDONE CENTER "\006" TR_ENTER " WHEN DONE" #define TR_FREE "free" -#define TR_DELETEMODEL "DELETE MODEL" +#define TR_DELETEMODEL "DELETE" BREAKSPACE "MODEL" #define TR_COPYINGMODEL "Copying model..." #define TR_MOVINGMODEL "Moving model..." #define TR_LOADINGMODEL "Loading model..." @@ -551,7 +553,7 @@ #define TR_PHASENAME "Mode Name" #define TR_MIXNAME "Mix Name" #define TR_INPUTNAME "Input Name" -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) #define TR_EXPONAME "Line Name" #else #define TR_EXPONAME "Expo Name" @@ -579,7 +581,9 @@ #define TR_CHECKTRIMS CENTER "\006Check\012Trims" #define OFS_CHECKTRIMS CENTER_OFS+(9*FW) #define TR_SWASHTYPE "Swash Type" -#define TR_COLLECTIVE TR("Collective","Collective source") +#define TR_COLLECTIVE_SOURCE TR("Collective", "Collective source") +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING "Swash Ring" #define TR_ELEDIRECTION TR("ELE Direction","Long. cyc. direction") #define TR_AILDIRECTION TR("AIL Direction","Lateral cyc. direction") @@ -792,10 +796,10 @@ #define TR_DELAY "Delay" #define TR_SD_CARD "SD CARD" #define TR_SDHC_CARD "SD-HC CARD" -#define TR_NO_SOUNDS_ON_SD "No Sounds on SD" -#define TR_NO_MODELS_ON_SD "No Models on SD" -#define TR_NO_BITMAPS_ON_SD "No Bitmaps on SD" -#define TR_NO_SCRIPTS_ON_SD "No Scripts on SD" +#define TR_NO_SOUNDS_ON_SD "No Sounds" BREAKSPACE "on SD" +#define TR_NO_MODELS_ON_SD "No Models" BREAKSPACE "on SD" +#define TR_NO_BITMAPS_ON_SD "No Bitmaps" BREAKSPACE "on SD" +#define TR_NO_SCRIPTS_ON_SD "No Scripts" BREAKSPACE "on SD" #define TR_PLAY_FILE "Play" #define TR_DELETE_FILE "Delete" #define TR_COPY_FILE "Copy" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index e815c468b..ae1e9abba 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -544,7 +544,9 @@ #define TR_CHECKTRIMS CENTER "\006Check\012Trims" #define OFS_CHECKTRIMS CENTER_OFS+(9*FW) #define TR_SWASHTYPE "Tipo ciclico" -#define TR_COLLECTIVE TR("Colectivo","Fuente Colectivo") +#define TR_COLLECTIVE_SOURCE TR("Colectivo", "Fuente Colectivo") +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING "Ciclico" #define TR_ELEDIRECTION TR("ELE Direccion","Largo cyc. direccion") #define TR_AILDIRECTION TR("AIL Direccion","Lateral cyc. direccion") diff --git a/radio/src/translations/fi.h.txt b/radio/src/translations/fi.h.txt index 7d77e8d94..365f55654 100644 --- a/radio/src/translations/fi.h.txt +++ b/radio/src/translations/fi.h.txt @@ -1,4 +1,4 @@ -/* +/* * Authors (alphabetical order) * - Bertrand Songis * - Bernet Andre @@ -544,7 +544,9 @@ #define TR_CHECKTRIMS CENTER "\006Check\012Trims" #define OFS_CHECKTRIMS CENTER_OFS+(9*FW) #define TR_SWASHTYPE "Swash Type" -#define TR_COLLECTIVE TR("Collective","Collective source") +#define TR_COLLECTIVE_SOURCE TR("Collective","Collective source") +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING "Swash Ring" #define TR_ELEDIRECTION TR("ELE Direction","Long. cyc. direction") #define TR_AILDIRECTION TR("AIL Direction","Lateral cyc. direction") diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index 03a2c1d08..2c19071fa 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -1,4 +1,4 @@ -/* +/* * Authors (alphabetical order) * - Andre Bernet * - Bertrand Songis @@ -544,7 +544,9 @@ #define TR_CHECKTRIMS "\006Vérif\012Trims" #define OFS_CHECKTRIMS (9*FW) #define TR_SWASHTYPE TR("Type de Plat.", "Type de plateau") -#define TR_COLLECTIVE TR("Collectif", "Voie du pas collectif") +#define TR_COLLECTIVE_SOURCE TR("Collectif", "Voie du pas collectif") +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING TR("Limite Cycl.", "Limite du cyclique") #define TR_ELEDIRECTION TR("Inv. longitud.", "Inversion longitudinal") #define TR_AILDIRECTION TR("Inv. latéral", "Inversion latéral") diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index bfefb8543..d6ebc2750 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -544,7 +544,9 @@ #define TR_CHECKTRIMS "\003Contr.\004Trim" #define OFS_CHECKTRIMS (9*FW) #define TR_SWASHTYPE "Tipo Ciclico" -#define TR_COLLECTIVE TR("Collettivo","Origine Collettivo") +#define TR_COLLECTIVE_SOURCE TR("Collettivo","Origine Collettivo") +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING "Anello Ciclico" #define TR_ELEDIRECTION TR("Direzione ELE","Direzione Long. cyc.") #define TR_AILDIRECTION TR("Direzione AIL","Direzione Lateral cyc.") diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index 615e346dd..3fbf0646a 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -542,7 +542,9 @@ #define TR_CHECKTRIMS CENTER "\006Spr \012Trymy" #define OFS_CHECKTRIMS CENTER_OFS+(9*FW) #define TR_SWASHTYPE "Typ tarczy" -#define TR_COLLECTIVE TR("Kolektyw ","Źródło Kolektywu ") +#define TR_COLLECTIVE_SOURCE TR("Kolektyw", "Źródło Kolektywu") +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING "Tarcza " #define TR_ELEDIRECTION TR("Ster Wysokośc","Dług. Kierunku cyklu") #define TR_AILDIRECTION TR("Kierunek Lotk","Lateral cyc. direction") diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index cc3a7b015..74103dc7f 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -544,7 +544,9 @@ #define TR_CHECKTRIMS "\006Check\012Trims" #define OFS_CHECKTRIMS (9*FW) #define TR_SWASHTYPE "Ciclico Tipo" -#define TR_COLLECTIVE "Coletivo" +#define TR_COLLECTIVE_SOURCE "Coletivo" +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING "Anel Coletivo" #define TR_ELEDIRECTION "PFD Sentido" #define TR_AILDIRECTION "AIL Sentido" diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index 1993d3663..8cbe43b3e 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -544,7 +544,9 @@ #define TR_CHECKTRIMS CENTER "\006Kolla\012Trimmar" #define OFS_CHECKTRIMS CENTER_OFS+(9*FW) #define TR_SWASHTYPE "Swashtyp" -#define TR_COLLECTIVE "Kollektiv" +#define TR_COLLECTIVE_SOURCE "Kollektiv" +#define TR_AILERON_SOURCE "Aileron Source" +#define TR_ELEVATOR_SOURCE "Elevator Source" #define TR_SWASHRING "Swashring" #define TR_ELEDIRECTION "HöJD Riktning" #define TR_AILDIRECTION "SKEV Riktning" From 88f85aef0633952454a576ce6f2bd0781fe055ac Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 14 Feb 2015 17:22:33 +0100 Subject: [PATCH 2/4] #2032 fixed --- companion/src/eeprominterface.h | 6 +- companion/src/modeledit/heli.cpp | 74 ++++++--- companion/src/modeledit/heli.ui | 184 +++++++++++++++++----- radio/src/gui/Taranis/menu_model_heli.cpp | 75 +++++---- radio/src/mixer.cpp | 53 ++++--- radio/src/myeeprom.h | 12 +- 6 files changed, 280 insertions(+), 124 deletions(-) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 35a03e197..a75f6e80b 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -684,9 +684,9 @@ class FlightModeData { class SwashRingData { // Swash Ring data public: SwashRingData() { clear(); } - bool invertELE; - bool invertAIL; - bool invertCOL; + int elevatorWeight; + int aileronWeight; + int collectiveWeight; unsigned int type; RawSource collectiveSource; RawSource aileronSource; diff --git a/companion/src/modeledit/heli.cpp b/companion/src/modeledit/heli.cpp index 25dea72a5..53d6541f9 100644 --- a/companion/src/modeledit/heli.cpp +++ b/companion/src/modeledit/heli.cpp @@ -8,12 +8,32 @@ HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & gener { ui->setupUi(this); - connect(ui->swashTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited())); - connect(ui->swashCollectiveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited())); - connect(ui->swashRingValSB, SIGNAL(editingFinished()), this, SLOT(edited())); - connect(ui->swashInvertELE, SIGNAL(stateChanged(int)), this, SLOT(edited())); - connect(ui->swashInvertAIL, SIGNAL(stateChanged(int)), this, SLOT(edited())); - connect(ui->swashInvertCOL, SIGNAL(stateChanged(int)), this, SLOT(edited())); + connect(ui->swashType, SIGNAL(currentIndexChanged(int)), this, SLOT(edited())); + connect(ui->swashRingVal, SIGNAL(editingFinished()), this, SLOT(edited())); + connect(ui->swashCollectiveSource, SIGNAL(currentIndexChanged(int)), this, SLOT(edited())); + if (firmware->getCapability(VirtualInputs)) { + connect(ui->swashAileronSource, SIGNAL(currentIndexChanged(int)), this, SLOT(edited())); + connect(ui->swashElevatorSource, SIGNAL(currentIndexChanged(int)), this, SLOT(edited())); + connect(ui->swashAileronWeight, SIGNAL(editingFinished()), this, SLOT(edited())); + connect(ui->swashElevatorWeight, SIGNAL(editingFinished()), this, SLOT(edited())); + connect(ui->swashCollectiveWeight, SIGNAL(editingFinished()), this, SLOT(edited())); + ui->invertLabel->hide(); + ui->swashElevatorInvert->hide(); + ui->swashAileronInvert->hide(); + ui->swashCollectiveInvert->hide(); + } + else { + connect(ui->swashElevatorInvert, SIGNAL(stateChanged(int)), this, SLOT(edited())); + connect(ui->swashAileronInvert, SIGNAL(stateChanged(int)), this, SLOT(edited())); + connect(ui->swashCollectiveInvert, SIGNAL(stateChanged(int)), this, SLOT(edited())); + ui->aileronLabel->hide(); + ui->elevatorLabel->hide(); + ui->swashAileronSource->hide(); + ui->swashElevatorSource->hide(); + ui->swashAileronWeight->hide(); + ui->swashElevatorWeight->hide(); + ui->swashCollectiveWeight->hide(); + } disableMouseScrolling(); } @@ -27,12 +47,21 @@ void HeliPanel::update() { lock = true; - ui->swashTypeCB->setCurrentIndex(model->swashRingData.type); - populateSourceCB(ui->swashCollectiveCB, model->swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); - ui->swashRingValSB->setValue(model->swashRingData.value); - ui->swashInvertELE->setChecked(model->swashRingData.invertELE); - ui->swashInvertAIL->setChecked(model->swashRingData.invertAIL); - ui->swashInvertCOL->setChecked(model->swashRingData.invertCOL); + ui->swashType->setCurrentIndex(model->swashRingData.type); + populateSourceCB(ui->swashCollectiveSource, model->swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); + ui->swashRingVal->setValue(model->swashRingData.value); + if (firmware->getCapability(VirtualInputs)) { + populateSourceCB(ui->swashElevatorSource, model->swashRingData.elevatorSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); + populateSourceCB(ui->swashAileronSource, model->swashRingData.aileronSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); + ui->swashElevatorWeight->setValue(model->swashRingData.elevatorWeight); + ui->swashAileronWeight->setValue(model->swashRingData.aileronWeight); + ui->swashCollectiveWeight->setValue(model->swashRingData.collectiveWeight); + } + else { + ui->swashElevatorInvert->setChecked(model->swashRingData.elevatorWeight < 0); + ui->swashAileronInvert->setChecked(model->swashRingData.aileronWeight < 0); + ui->swashCollectiveInvert->setChecked(model->swashRingData.collectiveWeight < 0); + } lock = false; } @@ -40,12 +69,21 @@ void HeliPanel::update() void HeliPanel::edited() { if (!lock) { - model->swashRingData.type = ui->swashTypeCB->currentIndex(); - model->swashRingData.collectiveSource = ui->swashCollectiveCB->itemData(ui->swashCollectiveCB->currentIndex()).toInt(); - model->swashRingData.value = ui->swashRingValSB->value(); - model->swashRingData.invertELE = ui->swashInvertELE->isChecked(); - model->swashRingData.invertAIL = ui->swashInvertAIL->isChecked(); - model->swashRingData.invertCOL = ui->swashInvertCOL->isChecked(); + model->swashRingData.type = ui->swashType->currentIndex(); + model->swashRingData.collectiveSource = ui->swashCollectiveSource->itemData(ui->swashCollectiveSource->currentIndex()).toInt(); + model->swashRingData.value = ui->swashRingVal->value(); + if (firmware->getCapability(VirtualInputs)) { + model->swashRingData.elevatorSource = ui->swashElevatorSource->itemData(ui->swashElevatorSource->currentIndex()).toInt(); + model->swashRingData.aileronSource = ui->swashAileronSource->itemData(ui->swashAileronSource->currentIndex()).toInt(); + model->swashRingData.elevatorWeight = ui->swashElevatorWeight->value(); + model->swashRingData.aileronWeight = ui->swashAileronWeight->value(); + model->swashRingData.collectiveWeight = ui->swashCollectiveWeight->value(); + } + else { + model->swashRingData.elevatorWeight = (ui->swashElevatorInvert->isChecked() ? -100 : 100); + model->swashRingData.aileronWeight = (ui->swashAileronInvert->isChecked() ? -100 : 100); + model->swashRingData.collectiveWeight = (ui->swashCollectiveInvert->isChecked() ? -100 : 100); + } emit modified(); } } diff --git a/companion/src/modeledit/heli.ui b/companion/src/modeledit/heli.ui index a248c9df7..bbe91d8fd 100644 --- a/companion/src/modeledit/heli.ui +++ b/companion/src/modeledit/heli.ui @@ -17,40 +17,15 @@ 6 - - - - - - Invert Elevator - - - - - - - Invert Aileron - - - - - - - Invert Collective - - - - - - + - Invert + Collective - + Off @@ -78,25 +53,69 @@ - - - - Collective + + + + 0 - + + + + + + + + + + -100 + + + 100 + + + 1 + + + 100 + + + + - - + + + + + + Invert Elevator + + + + + + + Invert Aileron + + + + + + + Invert Collective + + + + - - + + - Swash Type + Elevator - + @@ -114,14 +133,14 @@ - - + + - Swash Ring + Invert - + Qt::Vertical @@ -134,6 +153,85 @@ + + + + Swash Ring + + + + + + + Swash Type + + + + + + + 0 + + + + + + + + + + + -100 + + + 100 + + + 1 + + + 100 + + + + + + + + + Aileron + + + + + + + 0 + + + + + + + + + + + -100 + + + 100 + + + 1 + + + 100 + + + + + diff --git a/radio/src/gui/Taranis/menu_model_heli.cpp b/radio/src/gui/Taranis/menu_model_heli.cpp index e489569a1..8e5e5dfdf 100755 --- a/radio/src/gui/Taranis/menu_model_heli.cpp +++ b/radio/src/gui/Taranis/menu_model_heli.cpp @@ -37,17 +37,17 @@ enum menuModelHeliItems { ITEM_HELI_SWASHTYPE, - ITEM_HELI_ELESOURCE, - ITEM_HELI_AILSOURCE, - ITEM_HELI_COLSOURCE, ITEM_HELI_SWASHRING, - ITEM_HELI_ELEDIRECTION, - ITEM_HELI_AILDIRECTION, - ITEM_HELI_COLDIRECTION, + ITEM_HELI_ELE, + ITEM_HELI_ELE_WEIGHT, + ITEM_HELI_AIL, + ITEM_HELI_AIL_WEIGHT, + ITEM_HELI_COL, + ITEM_HELI_COL_WEIGHT, ITEM_HELI_MAX }; -#define HELI_PARAM_OFS (23*FW) +#define MODEL_HELI_2ND_COLUMN (LCD_W-17*FW-MENUS_SCROLLBAR_WIDTH) void menuModelHeli(uint8_t event) { @@ -56,51 +56,58 @@ void menuModelHeli(uint8_t event) int sub = m_posVert; for (unsigned int i=0; i0) ? BLINK|INVERS : INVERS); LcdFlags attr = (sub == k ? blink : 0); switch(k) { case ITEM_HELI_SWASHTYPE: - g_model.swashR.type = selectMenuItem(HELI_PARAM_OFS, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event); - break; - - case ITEM_HELI_ELESOURCE: - lcd_putsLeft(y, STR_ELEVATOR_SOURCE); - if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.elevatorSource, 0, MIXSRC_LAST_CH); - putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.elevatorSource, attr); - break; - - case ITEM_HELI_AILSOURCE: - lcd_putsLeft(y, STR_AILERON_SOURCE); - if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.aileronSource, 0, MIXSRC_LAST_CH); - putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.aileronSource, attr); - break; - - case ITEM_HELI_COLSOURCE: - lcd_putsLeft(y, STR_COLLECTIVE_SOURCE); - if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH); - putsMixerSource(HELI_PARAM_OFS, y, g_model.swashR.collectiveSource, attr); + g_model.swashR.type = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event); break; case ITEM_HELI_SWASHRING: lcd_putsLeft(y, STR_SWASHRING); - lcd_outdezAtt(HELI_PARAM_OFS, y, g_model.swashR.value, LEFT|attr); + lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.value, LEFT|attr); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100); break; - case ITEM_HELI_ELEDIRECTION: - g_model.swashR.invertELE = selectMenuItem(HELI_PARAM_OFS, y, STR_ELEDIRECTION, STR_MMMINV, g_model.swashR.invertELE, 0, 1, attr, event); + case ITEM_HELI_ELE: + lcd_putsLeft(y, "Elevator" /*STR_ELEVATOR_SOURCE*/); + putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorSource, attr); + if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.elevatorSource, 0, MIXSRC_LAST_CH); break; - case ITEM_HELI_AILDIRECTION: - g_model.swashR.invertAIL = selectMenuItem(HELI_PARAM_OFS, y, STR_AILDIRECTION, STR_MMMINV, g_model.swashR.invertAIL, 0, 1, attr, event); + case ITEM_HELI_ELE_WEIGHT: + lcd_puts(INDENT_WIDTH, y, STR_WEIGHT); + lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorWeight, LEFT|attr); + if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.elevatorWeight, -100, 100); break; - case ITEM_HELI_COLDIRECTION: - g_model.swashR.invertCOL = selectMenuItem(HELI_PARAM_OFS, y, STR_COLDIRECTION, STR_MMMINV, g_model.swashR.invertCOL, 0, 1, attr, event); + case ITEM_HELI_AIL: + lcd_putsLeft(y, "Aileron" /*STR_ELEVATOR_SOURCE*/); + putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronSource, attr); + if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.aileronSource, 0, MIXSRC_LAST_CH); break; + + case ITEM_HELI_AIL_WEIGHT: + lcd_puts(INDENT_WIDTH, y, STR_WEIGHT); + lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronWeight, LEFT|attr); + if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.aileronWeight, -100, 100); + break; + + case ITEM_HELI_COL: + lcd_putsLeft(y, "Collective" /*STR_ELEVATOR_SOURCE*/); + putsMixerSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveSource, attr); + if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH); + break; + + case ITEM_HELI_COL_WEIGHT: + lcd_puts(INDENT_WIDTH, y, STR_WEIGHT); + lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveWeight, LEFT|attr); + if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.collectiveWeight, -100, 100); + break; + } } } diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index 039e71948..da0f26b73 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -37,7 +37,7 @@ #include "opentx.h" #include "timers.h" -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) int8_t virtualInputsTrims[NUM_INPUTS]; #else int16_t rawAnas[NUM_INPUTS] = {0}; @@ -67,7 +67,7 @@ int16_t ex_chans[NUM_CHNOUT] = {0}; // Outputs (before LIMITS) of the last perMa void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) { -#if !defined(PCBTARANIS) +#if !defined(VIRTUALINPUTS) int16_t anas2[NUM_INPUTS]; // values before expo, to ensure same expo base when multiple expo lines are used memcpy(anas2, anas, sizeof(anas2)); #endif @@ -85,7 +85,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) if (ed->flightModes & (1<swtch)) { -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) int v; if (ed->srcRaw == ovwrIdx) { v = ovwrValue; @@ -107,7 +107,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) cur_chn = ed->chn; //========== CURVE================= -#if defined(PCBTARANIS) +#if defined(XCURVES) if (ed->curve.value) { v = applyCurve(v, ed->curve); } @@ -126,7 +126,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) weight = calc100to256(weight); v = ((int32_t)v * weight) >> 8; -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) //========== OFFSET =============== int16_t offset = GET_GVAR(ed->offset, -100, 100, mixerCurrentFlightMode); if (offset) v += calc100toRESX(offset); @@ -243,13 +243,13 @@ getvalue_t getValue(mixsrc_t i) { if (i==MIXSRC_NONE) return 0; -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) else if (i <= MIXSRC_LAST_INPUT) { return anas[i-MIXSRC_FIRST_INPUT]; } #endif -#if defined(PCBTARANIS) +#if defined(LUAINPUTS) else if (i 1024 if (g_model.swashR.type) { -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) getvalue_t vp = heliEleValue + getSourceTrimValue(g_model.swashR.elevatorSource); getvalue_t vr = heliAilValue + getSourceTrimValue(g_model.swashR.aileronSource); #else @@ -624,9 +631,15 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) if (g_model.swashR.collectiveSource) vc = getValue(g_model.swashR.collectiveSource); +#if defined(VIRTUALINPUTS) + vp = (vp * g_model.swashR.elevatorWeight) / 100; + vr = (vr * g_model.swashR.aileronWeight) / 100; + vc = (vc * g_model.swashR.collectiveWeight) / 100; +#else if (g_model.swashR.invertELE) vp = -vp; if (g_model.swashR.invertAIL) vr = -vr; if (g_model.swashR.invertCOL) vc = -vc; +#endif switch (g_model.swashR.type) { case SWASH_TYPE_120: @@ -705,7 +718,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) MIXER_LINE_DISABLE(); } -#if defined(PCBTARANIS) && defined(LUA_MODEL_SCRIPTS) +#if defined(LUA_MODEL_SCRIPTS) // disable mixer if Lua script is used as source and script was killed if (mixEnabled && md->srcRaw >= MIXSRC_FIRST_LUA && md->srcRaw <= MIXSRC_LAST_LUA) { div_t qr = div(md->srcRaw-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS); @@ -718,7 +731,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) //========== VALUE =============== getvalue_t v = 0; if (mode > e_perout_mode_inactive_flight_mode) { -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) if (!mixEnabled) { continue; } @@ -735,7 +748,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) #endif } else { -#if !defined(PCBTARANIS) +#if !defined(VIRTUALINPUTS) if (stickIndex < NUM_STICKS) { v = md->noExpo ? rawAnas[stickIndex] : anas[stickIndex]; } @@ -804,7 +817,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) //========== TRIMS ================ if (!(mode & e_perout_mode_notrims)) { -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) if (md->carryTrim == 0) { v += getSourceTrimValue(md->srcRaw); } @@ -873,7 +886,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) } //========== CURVES =============== -#if defined(PCBTARANIS) +#if defined(XCURVES) if (apply_offset_and_curve && md->curve.value) { v = applyCurve(v, md->curve); } @@ -893,7 +906,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) } //========== DIFFERENTIAL ========= -#if !defined(PCBTARANIS) +#if !defined(XCURVES) if (md->curveMode == MODE_DIFFERENTIAL) { // @@@2 also recalculate curveParam to a 256 basis which ease the calculation later a lot int16_t curveParam = calc100to256(GET_GVAR(md->curveParam, -100, 100, mixerCurrentFlightMode)); diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 669ee3144..55811e292 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -1502,16 +1502,16 @@ enum SwashType { SWASH_TYPE_MAX = SWASH_TYPE_90 }; -#if defined(PCBTARANIS) +#if defined(VIRTUALINPUTS) PACK(typedef struct { - uint8_t invertELE:1; - uint8_t invertAIL:1; - uint8_t invertCOL:1; - uint8_t type:5; + uint8_t type; + uint8_t value; uint8_t collectiveSource; uint8_t aileronSource; uint8_t elevatorSource; - uint8_t value; + int8_t collectiveWeight; + int8_t aileronWeight; + int8_t elevatorWeight; }) SwashRingData; #else PACK(typedef struct { From 856317ee4fec9645da8fc4f6c5676e5a0f00d3e9 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 14 Feb 2015 18:35:14 +0100 Subject: [PATCH 3/4] Some files forgotten --- companion/src/firmwares/er9x/er9xeeprom.cpp | 6 ++-- .../src/firmwares/ersky9x/ersky9xeeprom.cpp | 12 ++++---- .../src/firmwares/gruvin9x/gruvin9xeeprom.cpp | 6 ++-- .../firmwares/opentx/open9xGruvin9xeeprom.cpp | 12 ++++---- .../firmwares/opentx/open9xSky9xeeprom.cpp | 18 ++++++------ .../firmwares/opentx/open9xStockeeprom.cpp | 12 ++++---- .../opentx/opentxGruvin9xsimulator.cpp | 1 + .../firmwares/opentx/opentxM128simulator.cpp | 1 + .../firmwares/opentx/opentxM64simulator.cpp | 1 + .../firmwares/opentx/opentxSky9xsimulator.cpp | 1 + .../opentx/opentxTaranisSimulator.cpp | 1 + .../opentx/opentxTaranisX9ESimulator.cpp | 1 + .../src/firmwares/opentx/opentxeeprom.cpp | 29 ++++++++++++++----- radio/src/gui/Taranis/gui.h | 3 +- 14 files changed, 62 insertions(+), 42 deletions(-) diff --git a/companion/src/firmwares/er9x/er9xeeprom.cpp b/companion/src/firmwares/er9x/er9xeeprom.cpp index 18eadd7f5..41fa1d36c 100644 --- a/companion/src/firmwares/er9x/er9xeeprom.cpp +++ b/companion/src/firmwares/er9x/er9xeeprom.cpp @@ -385,9 +385,9 @@ t_Er9xModelData::operator ModelData () c9x.beepANACenter = beepANACenter; c9x.moduleData[0].ppmPulsePol = pulsePol; c9x.extendedLimits = extendedLimits; - c9x.swashRingData.invertELE = swashInvertELE; - c9x.swashRingData.invertAIL = swashInvertAIL; - c9x.swashRingData.invertCOL = swashInvertCOL; + c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100; + c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100; + c9x.swashRingData.collectiveWeight = swashInvertCOL ? -100 : 100; c9x.swashRingData.type = swashType; c9x.swashRingData.collectiveSource = er9xToSource(swashCollectiveSource); c9x.swashRingData.value = swashRingValue; diff --git a/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp b/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp index 7096a1ded..d13addaf3 100644 --- a/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp +++ b/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp @@ -517,9 +517,9 @@ t_Ersky9xModelData_v10::operator ModelData () c9x.beepANACenter = beepANACenter; c9x.moduleData[0].ppmPulsePol = pulsePol; c9x.extendedLimits = extendedLimits; - c9x.swashRingData.invertELE = swashInvertELE; - c9x.swashRingData.invertAIL = swashInvertAIL; - c9x.swashRingData.invertCOL = swashInvertCOL; + c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100; + c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100; + c9x.swashRingData.collectiveWeight = swashInvertCOL ? -100 : 100; c9x.swashRingData.type = swashType; c9x.swashRingData.collectiveSource = ersky9xToSource_v10(swashCollectiveSource); c9x.swashRingData.value = swashRingValue; @@ -632,9 +632,9 @@ t_Ersky9xModelData_v11::operator ModelData () c9x.beepANACenter = beepANACenter; c9x.moduleData[0].ppmPulsePol = pulsePol; c9x.extendedLimits = extendedLimits; - c9x.swashRingData.invertELE = swashInvertELE; - c9x.swashRingData.invertAIL = swashInvertAIL; - c9x.swashRingData.invertCOL = swashInvertCOL; + c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100; + c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100; + c9x.swashRingData.collectiveWeight = swashInvertCOL ? -100 : 100; c9x.swashRingData.type = swashType; c9x.swashRingData.collectiveSource = ersky9xToSource_v11(swashCollectiveSource); c9x.swashRingData.value = swashRingValue; diff --git a/companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp b/companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp index 7beb76611..e477de7ef 100644 --- a/companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp +++ b/companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp @@ -338,9 +338,9 @@ t_Gruvin9xSwashRingData::t_Gruvin9xSwashRingData() t_Gruvin9xSwashRingData::operator SwashRingData () { SwashRingData c9x; - c9x.invertELE = invertELE; - c9x.invertAIL = invertAIL; - c9x.invertCOL = invertCOL; + c9x.elevatorWeight = invertELE ? -100 : 100; + c9x.aileronWeight = invertAIL ? -100 : 100; + c9x.collectiveWeight = invertCOL ? -100 : 100; c9x.type = type; c9x.collectiveSource = gruvin9xToSource(collectiveSource); c9x.value = value; diff --git a/companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp b/companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp index 245b071c6..44de1ce22 100644 --- a/companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp +++ b/companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp @@ -410,9 +410,9 @@ t_Open9xGruvin9xCustomFunctionData_v210::operator CustomFunctionData () t_Open9xGruvin9xSwashRingData_v208::operator SwashRingData () { SwashRingData c9x; - c9x.invertELE = invertELE; - c9x.invertAIL = invertAIL; - c9x.invertCOL = invertCOL; + c9x.elevatorWeight = invertELE ? -100 : 100; + c9x.aileronWeight = invertAIL ? -100 : 100; + c9x.collectiveWeight = invertCOL ? -100 : 100; c9x.type = type; c9x.collectiveSource = open9xV4207ToSource(collectiveSource); c9x.value = value; @@ -422,9 +422,9 @@ t_Open9xGruvin9xSwashRingData_v208::operator SwashRingData () t_Open9xGruvin9xSwashRingData_v209::operator SwashRingData () { SwashRingData c9x; - c9x.invertELE = invertELE; - c9x.invertAIL = invertAIL; - c9x.invertCOL = invertCOL; + c9x.elevatorWeight = invertELE ? -100 : 100; + c9x.aileronWeight = invertAIL ? -100 : 100; + c9x.collectiveWeight = invertCOL ? -100 : 100; c9x.type = type; c9x.collectiveSource = open9xV4209ToSource(collectiveSource); c9x.value = value; diff --git a/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp b/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp index 1b8a0ae0a..938b205c3 100644 --- a/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp +++ b/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp @@ -640,9 +640,9 @@ t_Open9xArmCustomFunctionData_v211::operator CustomFunctionData () t_Open9xArmSwashRingData_v208::operator SwashRingData () { SwashRingData c9x; - c9x.invertELE = invertELE; - c9x.invertAIL = invertAIL; - c9x.invertCOL = invertCOL; + c9x.elevatorWeight = invertELE ? -100 : 100; + c9x.aileronWeight = invertAIL ? -100 : 100; + c9x.collectiveWeight = invertCOL ? -100 : 100; c9x.type = type; c9x.collectiveSource = open9xArm208ToSource(collectiveSource); c9x.value = value; @@ -652,9 +652,9 @@ t_Open9xArmSwashRingData_v208::operator SwashRingData () t_Open9xArmSwashRingData_v209::operator SwashRingData () { SwashRingData c9x; - c9x.invertELE = invertELE; - c9x.invertAIL = invertAIL; - c9x.invertCOL = invertCOL; + c9x.elevatorWeight = invertELE ? -100 : 100; + c9x.aileronWeight = invertAIL ? -100 : 100; + c9x.collectiveWeight = invertCOL ? -100 : 100; c9x.type = type; c9x.collectiveSource = open9xArm209ToSource(collectiveSource); c9x.value = value; @@ -664,9 +664,9 @@ t_Open9xArmSwashRingData_v209::operator SwashRingData () t_Open9xArmSwashRingData_v210::operator SwashRingData () { SwashRingData c9x; - c9x.invertELE = invertELE; - c9x.invertAIL = invertAIL; - c9x.invertCOL = invertCOL; + c9x.elevatorWeight = invertELE ? -100 : 100; + c9x.aileronWeight = invertAIL ? -100 : 100; + c9x.collectiveWeight = invertCOL ? -100 : 100; c9x.type = type; c9x.collectiveSource = open9xArm210ToSource(collectiveSource); c9x.value = value; diff --git a/companion/src/firmwares/opentx/open9xStockeeprom.cpp b/companion/src/firmwares/opentx/open9xStockeeprom.cpp index f42817d29..880ce420f 100644 --- a/companion/src/firmwares/opentx/open9xStockeeprom.cpp +++ b/companion/src/firmwares/opentx/open9xStockeeprom.cpp @@ -665,9 +665,9 @@ t_Open9xCustomFunctionData_v210::operator CustomFunctionData () t_Open9xSwashRingData_v208::operator SwashRingData () { SwashRingData c9x; - c9x.invertELE = invertELE; - c9x.invertAIL = invertAIL; - c9x.invertCOL = invertCOL; + c9x.elevatorWeight = invertELE ? -100 : 100; + c9x.aileronWeight = invertAIL ? -100 : 100; + c9x.collectiveWeight = invertCOL ? -100 : 100; c9x.type = type; c9x.collectiveSource = open9x208ToSource(collectiveSource); c9x.value = value; @@ -677,9 +677,9 @@ t_Open9xSwashRingData_v208::operator SwashRingData () t_Open9xSwashRingData_v209::operator SwashRingData () { SwashRingData c9x; - c9x.invertELE = invertELE; - c9x.invertAIL = invertAIL; - c9x.invertCOL = invertCOL; + c9x.elevatorWeight = invertELE ? -100 : 100; + c9x.aileronWeight = invertAIL ? -100 : 100; + c9x.collectiveWeight = invertCOL ? -100 : 100; c9x.type = type; c9x.collectiveSource = open9xStock209ToSource(collectiveSource); c9x.value = value; diff --git a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp index 629de0ee2..244a01e98 100644 --- a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp @@ -50,6 +50,7 @@ #define FRSKY_STICKS #define OVERRIDE_CHANNEL_FUNCTION #define TIMERS 2 +#define THRTRACE #define FLAVOUR "gruvin9x" #define EEPROM_VARIANT 3 diff --git a/companion/src/firmwares/opentx/opentxM128simulator.cpp b/companion/src/firmwares/opentx/opentxM128simulator.cpp index e02acb022..5fe968394 100644 --- a/companion/src/firmwares/opentx/opentxM128simulator.cpp +++ b/companion/src/firmwares/opentx/opentxM128simulator.cpp @@ -51,6 +51,7 @@ #define OVERRIDE_CHANNEL_FUNCTION #define TIMERS 2 #define GAUGES +#define THRTRACE #define FLAVOUR "9x128" #define EEPROM_VARIANT SIMU_M128_VARIANTS diff --git a/companion/src/firmwares/opentx/opentxM64simulator.cpp b/companion/src/firmwares/opentx/opentxM64simulator.cpp index 7c5e62492..312303f17 100644 --- a/companion/src/firmwares/opentx/opentxM64simulator.cpp +++ b/companion/src/firmwares/opentx/opentxM64simulator.cpp @@ -55,6 +55,7 @@ #define GAUGES #define TIMERS 2 #define NUM_POTS 3 +#define THRTRACE #define FLAVOUR "9x" #define EEPROM_VARIANT SIMU_STOCK_VARIANTS diff --git a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp index ecf04a744..53f8f2c78 100644 --- a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp @@ -57,6 +57,7 @@ #define OVERRIDE_CHANNEL_FUNCTION #define NUM_POTS 3 #define TIMERS 2 +#define THRTRACE #define EEPROM_VARIANT 3 #define FLAVOUR "sky9x" diff --git a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp index 331225fa4..9f7065c19 100644 --- a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp +++ b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp @@ -58,6 +58,7 @@ #define REVPLUS #define OVERRIDE_CHANNEL_FUNCTION #define TIMERS 3 +#define THRTRACE #define EEPROM_VARIANT 3 #define FLAVOUR "taranis-plus" diff --git a/companion/src/firmwares/opentx/opentxTaranisX9ESimulator.cpp b/companion/src/firmwares/opentx/opentxTaranisX9ESimulator.cpp index 5b3991bb0..775dcfb49 100755 --- a/companion/src/firmwares/opentx/opentxTaranisX9ESimulator.cpp +++ b/companion/src/firmwares/opentx/opentxTaranisX9ESimulator.cpp @@ -59,6 +59,7 @@ #define REV9E #define OVERRIDE_CHANNEL_FUNCTION #define TIMERS 3 +#define THRTRACE #define EEPROM_VARIANT 3 #define FLAVOUR "taranis-x9e" diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index e2685a69a..40a429a43 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -725,18 +725,33 @@ class HeliField: public StructField { public: HeliField(SwashRingData & heli, BoardEnum board, unsigned int version, unsigned int variant) { - Append(new BoolField<1>(heli.invertELE)); - Append(new BoolField<1>(heli.invertAIL)); - Append(new BoolField<1>(heli.invertCOL)); - Append(new UnsignedField<5>(heli.type)); - Append(new SourceField<8>(heli.collectiveSource, board, version, variant)); if (IS_TARANIS(board) && version >= 217) { + Append(new UnsignedField<8>(heli.type)); + Append(new UnsignedField<8>(heli.value)); + Append(new SourceField<8>(heli.collectiveSource, board, version, variant)); Append(new SourceField<8>(heli.aileronSource, board, version, variant)); Append(new SourceField<8>(heli.elevatorSource, board, version, variant)); + Append(new SignedField<8>(heli.collectiveWeight)); + Append(new SignedField<8>(heli.aileronWeight)); + Append(new SignedField<8>(heli.elevatorWeight)); + } + else { + Append(new BoolField<1>(invertELE)); + Append(new BoolField<1>(invertAIL)); + Append(new BoolField<1>(invertCOL)); + Append(new UnsignedField<5>(heli.type)); + Append(new SourceField<8>(heli.collectiveSource, board, version, variant)); + //, FLAG_NOSWITCHES)); Fix shift in collective + Append(new UnsignedField<8>(heli.value)); } - //, FLAG_NOSWITCHES)); Fix shift in collective - Append(new UnsignedField<8>(heli.value)); } + + // TODO before + after + + protected: + bool invertELE; + bool invertAIL; + bool invertCOL; }; class FlightModeField: public TransformedField { diff --git a/radio/src/gui/Taranis/gui.h b/radio/src/gui/Taranis/gui.h index 48d357e78..a27e7a1ad 100755 --- a/radio/src/gui/Taranis/gui.h +++ b/radio/src/gui/Taranis/gui.h @@ -39,8 +39,7 @@ #define DEFAULT_SCROLLBAR_X (LCD_W-1) #define NUM_BODY_LINES (LCD_LINES-1) -#define MENU_TITLE_HEIGHT FH -#define MENU_NAVIG_HEIGHT 0 +#define MENU_HEADER_HEIGHT FH struct MenuItem { const char *name; From a132d4cdea151d6faf694ff09610c1a370650bf6 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 14 Feb 2015 18:35:14 +0100 Subject: [PATCH 4/4] Some files forgotten --- radio/src/Makefile | 2 +- radio/src/mixer.cpp | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/radio/src/Makefile b/radio/src/Makefile index 780deb7e4..6ad838ec2 100644 --- a/radio/src/Makefile +++ b/radio/src/Makefile @@ -826,7 +826,7 @@ ifeq ($(PCB), TARANIS) PPM_LIMITS_SYMETRICAL = YES PPM_CENTER_ADJUSTABLE = YES DSM2 = PPM - CPPDEFS += -DPCBTARANIS -DCPUARM -DCPUSTM32 -DVIRTUALINPUTS -DXCURVES -DEEPROM_VARIANT=0 -DAUDIO -DPXX + CPPDEFS += -DPCBTARANIS -DCPUARM -DCPUSTM32 -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DEEPROM_VARIANT=0 -DAUDIO -DPXX INCDIRS += targets/taranis CoOS/kernel CoOS/portable EXTRAINCDIRS += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/include EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index da0f26b73..f9919f2fb 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -277,14 +277,7 @@ getvalue_t getValue(mixsrc_t i) else if (i<=MIXSRC_TrimAil) return calc1000toRESX((int16_t)8 * getTrimValue(mixerCurrentFlightMode, i-MIXSRC_TrimRud)); -#if defined(PCBTBS) - else if (i==MIXSRC_SA) return (switchState(SW_SA0) ? -1024 : (switchState(SW_SA1) ? 0 : 1024)); - else if (i==MIXSRC_SB) return (switchState(SW_SB0) ? -1024 : 1024); - else if (i==MIXSRC_SC) return (switchState(SW_SC0) ? -1024 : (switchState(SW_SC1) ? 0 : 1024)); - // else if (i==MIXSRC_SD) return (switchState(SW_SD0) ? -1024 : 1024); - else if (i==MIXSRC_SE) return (switchState(SW_SE0) ? -1024 : 1024); - else if (i==MIXSRC_SF) return (switchState(SW_SF0) ? -1024 : (switchState(SW_SF1) ? 0 : 1024)); -#elif defined(PCBTARANIS) +#if defined(PCBTARANIS) else if (i==MIXSRC_SA) return (switchState(SW_SA0) ? -1024 : (switchState(SW_SA1) ? 0 : 1024)); else if (i==MIXSRC_SB) return (switchState(SW_SB0) ? -1024 : (switchState(SW_SB1) ? 0 : 1024)); else if (i==MIXSRC_SC) return (switchState(SW_SC0) ? -1024 : (switchState(SW_SC1) ? 0 : 1024));