From fbd07444314d7bf23dcfdcf711cd52bb046f102e Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 18 Feb 2014 22:43:17 +0100 Subject: [PATCH] Issue #713 - 64 custom functions instead of 32. 8chars only filenames in PlayTrack function --- companion/src/eeprominterface.h | 2 +- companion/src/firmwares/opentx/opentxeeprom.cpp | 6 ++++-- companion/src/firmwares/opentx/opentxinterface.cpp | 4 ++-- radio/src/eeprom_conversions.cpp | 6 +++--- radio/src/myeeprom.h | 6 +++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 60f99b41a..14dc0d7ac 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -74,7 +74,7 @@ const uint8_t modn12x3[4][4]= { #define C9X_MAX_ENCODERS 2 #define C9X_NUM_CHNOUT 32 // number of real output channels #define C9X_NUM_CSW 32 // number of custom switches -#define C9X_MAX_CUSTOM_FUNCTIONS 32 // number of functions assigned to switches +#define C9X_MAX_CUSTOM_FUNCTIONS 64 // number of functions assigned to switches #define C9X_NUM_MODULES 2 #define STK_RUD 1 diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 92b5c4b3e..c078e6009 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -20,7 +20,7 @@ #define MAX_CHANNELS(board, version) (IS_ARM(board) ? 32 : 16) #define MAX_EXPOS(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 64 : 32) : (IS_DBLRAM(board, version) ? 16 : 14)) #define MAX_CUSTOM_SWITCHES(board, version) (IS_ARM(board) ? 32 : (IS_DBLEEPROM(board, version) ? 15 : 12)) -#define MAX_CUSTOM_FUNCTIONS(board, version) (IS_ARM(board) ? 32 : (IS_DBLEEPROM(board, version) ? 24 : 16)) +#define MAX_CUSTOM_FUNCTIONS(board, version) (IS_ARM(board) ? (version >= 216 ? 64 : 32) : (IS_DBLEEPROM(board, version) ? 24 : 16)) #define MAX_CURVES(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 32 : 16) : O9X_MAX_CURVES) #define MAX_GVARS(board, version) ((IS_ARM(board) && version >= 216) ? 9 : 5) @@ -1424,7 +1424,9 @@ class ArmCustomFunctionField: public TransformedField { internalField.Append(new SwitchField<8>(fn.swtch, board, version)); internalField.Append(new ConversionField< UnsignedField<8> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); - if (IS_TARANIS(board)) + if (IS_TARANIS(board) && version >= 216) + internalField.Append(new CharField<8>(_param, false)); + else if (IS_TARANIS(board)) internalField.Append(new CharField<10>(_param, false)); else internalField.Append(new CharField<6>(_param, false)); diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 16dbfeca9..d61ef76f6 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -521,7 +521,7 @@ int Open9xInterface::getCapability(const Capability capability) return (IS_TARANIS(board) ? 22 : 9); case CustomFunctions: if (IS_ARM(board)) - return 32; + return 64; else if (board==BOARD_GRUVIN9X||board==BOARD_M128) return 24; else @@ -554,7 +554,7 @@ int Open9xInterface::getCapability(const Capability capability) case VoicesAsNumbers: return (IS_ARM(board) ? 0 : 1); case VoicesMaxLength: - return (IS_ARM(board) ? (IS_TARANIS(board) ? 10 : 6) : 0); + return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : 0); case MultiLangVoice: return (IS_ARM(board) ? 1 : 0); case SoundPitch: diff --git a/radio/src/eeprom_conversions.cpp b/radio/src/eeprom_conversions.cpp index 8a0e6bac9..6e1a5924b 100644 --- a/radio/src/eeprom_conversions.cpp +++ b/radio/src/eeprom_conversions.cpp @@ -144,7 +144,7 @@ PACK(typedef struct { int8_t swtch; uint8_t func; PACK(union { - char name[LEN_CFN_NAME]; + char name[10]; struct { int16_t val; int16_t ext1; @@ -193,7 +193,7 @@ PACK(typedef struct { int8_t points[NUM_POINTS]; LogicalSwitchData_v215 customSw[NUM_CSW]; - CustomFnData_v215 funcSw[NUM_CFN]; + CustomFnData_v215 funcSw[32]; SwashRingData swashR; PhaseData_v215 phaseData[MAX_PHASES]; @@ -575,7 +575,7 @@ void ConvertModel_215_to_216(ModelData &model) } if (fn.func == FUNC_PLAY_TRACK || fn.func == FUNC_BACKGND_MUSIC) { - memcpy(fn.play.name, oldModel.funcSw[i].param.name, LEN_CFN_NAME); + memcpy(fn.play.name, oldModel.funcSw[i].param.name, 8); } else { fn.all.val = oldModel.funcSw[i].param.composite.val; diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index fed0158f4..0f2e0076b 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -74,7 +74,7 @@ #define MAX_MIXERS 64 #define MAX_EXPOS 64 #define NUM_CSW 32 // number of custom switches - #define NUM_CFN 32 // number of functions assigned to switches + #define NUM_CFN 64 // number of functions assigned to switches #define MAX_SCRIPTS 3 #define MAX_INPUTS 32 #elif defined(CPUARM) @@ -84,7 +84,7 @@ #define MAX_MIXERS 64 #define MAX_EXPOS 32 #define NUM_CSW 32 // number of custom switches - #define NUM_CFN 32 // number of functions assigned to switches + #define NUM_CFN 64 // number of functions assigned to switches #elif defined(CPUM2560) || defined(CPUM2561) #define MAX_MODELS 30 #define NUM_CHNOUT 16 // number of real output channels CH1-CH16 @@ -806,7 +806,7 @@ enum AdjustGvarFunctionParam { #if defined(CPUARM) #if defined(PCBTARANIS) - #define LEN_CFN_NAME 10 + #define LEN_CFN_NAME 8 #else #define LEN_CFN_NAME 6 #endif