1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 06:15:10 +03:00

Issue #764 fixed

This commit is contained in:
bsongis 2014-02-28 12:16:43 +01:00
parent c4bff418e3
commit f250d381e5
9 changed files with 36 additions and 27 deletions

View file

@ -162,7 +162,7 @@ enum HeliSwashTypes {
#define BOARD_X9D_NUM_POTS 4
#define C9X_NUM_POTS 4
#define NUM_CAL_PPM 4
#define NUM_PPM 8
#define NUM_PPM(board) (IS_ARM(board) ? 16 : 8)
#define NUM_CYC 3
#define C9X_NUM_SWITCHES 10
#define C9X_NUM_KEYS 6

View file

@ -268,11 +268,11 @@ t_Open9xArmMixData_v208::operator MixData ()
else if (srcRaw <= 9+9+O9X_ARM_NUM_CSW+NUM_CYC) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-10-9-O9X_ARM_NUM_CSW);
}
else if (srcRaw <= 9+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM) {
else if (srcRaw <= 9+9+O9X_ARM_NUM_CSW+NUM_CYC+8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-10-9-O9X_ARM_NUM_CSW-NUM_CYC);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-10-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-10-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
}
c9x.weight = weight;
c9x.swtch = open9xArmToSwitch(swtch);
@ -334,11 +334,11 @@ t_Open9xArmMixData_v209::operator MixData ()
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-14-9-O9X_ARM_NUM_CSW);
}
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM) {
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC+8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
}
c9x.weight = weight;
@ -400,11 +400,11 @@ t_Open9xArmMixData_v210::operator MixData ()
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-14-9-O9X_ARM_NUM_CSW);
}
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM) {
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC+8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
}
c9x.weight = weight;
@ -470,11 +470,11 @@ t_Open9xArmMixData_v212::operator MixData ()
else if (srcRaw <= 14+9+O9X_ARM_NUM_CSW+NUM_CYC) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-15-9-O9X_ARM_NUM_CSW);
}
else if (srcRaw <= 14+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM) {
else if (srcRaw <= 14+9+O9X_ARM_NUM_CSW+NUM_CYC+8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-15-9-O9X_ARM_NUM_CSW-NUM_CYC);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-15-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-15-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
}
c9x.weight = weight;

View file

@ -23,6 +23,7 @@
#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)
#define NUM_PPM_INPUTS(board, version) ((IS_ARM(board) && version >= 216) ? 16 : 8)
#define IS_AFTER_RELEASE_21_MARCH_2013(board, version) (version >= 214 || (!IS_ARM(board) && version >= 213))
#define IS_AFTER_RELEASE_23_MARCH_2013(board, version) (version >= 214 || (board==BOARD_STOCK && version >= 213))
@ -218,7 +219,7 @@ class SourcesConversionTable: public ConversionTable {
addConversion(RawSource(SOURCE_TYPE_CYC, i), val++);
}
for (int i=0; i<8; i++)
for (int i=0; i<NUM_PPM_INPUTS(board, version); i++)
addConversion(RawSource(SOURCE_TYPE_PPM, i), val++);
for (int i=0; i<MAX_CHANNELS(board, version); i++)

View file

@ -599,7 +599,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<NUM_PPM; i++) {
for (int i=0; i<NUM_PPM(GetEepromInterface()->getBoard()); i++) {
item = RawSource(SOURCE_TYPE_PPM, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);

View file

@ -270,6 +270,9 @@ int ConvertSource_215_to_216(int source, bool insertZero=false)
// Virtual Inputs and Lua Outputs added
if (source > 0)
source += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
// PPM9-PPM16 added
if (source > MIXSRC_FIRST_PPM+7)
source += 8;
// 4 GVARS added
if (source > MIXSRC_GVAR1+4)
source += 4;

View file

@ -2186,7 +2186,7 @@ void menuModelHeli(uint8_t event)
uint8_t attr = (sub == i ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
switch(i) {
case ITEM_HELI_SWASHTYPE:
g_model.swashR.type = selectMenuItem(HELI_PARAM_OFS, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_NUM, attr, event);
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:

View file

@ -77,6 +77,7 @@
#define NUM_CFN 64 // number of functions assigned to switches
#define MAX_SCRIPTS 7
#define MAX_INPUTS 32
#define NUM_PPM 16
#elif defined(CPUARM)
#define MAX_MODELS 60
#define NUM_CHNOUT 32 // number of real output channels CH1-CH32
@ -85,6 +86,7 @@
#define MAX_EXPOS 32
#define NUM_CSW 32 // number of custom switches
#define NUM_CFN 64 // number of functions assigned to switches
#define NUM_PPM 16
#elif defined(CPUM2560) || defined(CPUM2561)
#define MAX_MODELS 30
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
@ -93,6 +95,7 @@
#define MAX_EXPOS 16
#define NUM_CSW 15 // number of custom switches
#define NUM_CFN 24 // number of functions assigned to switches
#define NUM_PPM 8
#elif defined(CPUM128)
#define MAX_MODELS 30
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
@ -101,6 +104,7 @@
#define MAX_EXPOS 14
#define NUM_CSW 15 // number of custom switches
#define NUM_CFN 24 // number of functions assigned to switches
#define NUM_PPM 8
#else
#define MAX_MODELS 16
#define NUM_CHNOUT 16 // number of real output channels CH1-CH16
@ -109,9 +113,12 @@
#define MAX_EXPOS 14
#define NUM_CSW 12 // number of custom switches
#define NUM_CFN 16 // number of functions assigned to switches
#define NUM_PPM 8
#endif
#define MAX_TIMERS 2
#define NUM_CYC 3
#define NUM_CAL_PPM 4
#if defined(PCBTARANIS)
enum CurveType {
@ -1156,6 +1163,14 @@ PACK(typedef struct t_MavlinkData {
}) MavlinkData;
#endif
enum SwashType {
SWASH_TYPE_120,
SWASH_TYPE_120X,
SWASH_TYPE_140,
SWASH_TYPE_90,
SWASH_TYPE_MAX = SWASH_TYPE_90
};
PACK(typedef struct t_SwashRingData { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
@ -1427,7 +1442,7 @@ enum MixSources {
MIXSRC_LAST_CSW = MIXSRC_FIRST_CSW+NUM_CSW-1,
MIXSRC_FIRST_PPM,
MIXSRC_LAST_PPM = MIXSRC_FIRST_PPM + 7,
MIXSRC_LAST_PPM = MIXSRC_FIRST_PPM+NUM_PPM-1,
MIXSRC_FIRST_CH,
MIXSRC_CH1 = MIXSRC_FIRST_CH,

View file

@ -4875,10 +4875,10 @@ void perMain()
#endif
}
}
} //endfunc void perMain()
}
int16_t g_ppmIns[8];
uint8_t ppmInState = 0; //0=unsync 1..8= wait for value i-1
int16_t g_ppmIns[NUM_PPM];
uint8_t ppmInState = 0; // 0=unsync 1..8= wait for value i-1
#if !defined(SIMU) && !defined(CPUARM)

View file

@ -622,16 +622,6 @@ enum BaseCurves {
CURVE_BASE
};
#define SWASH_TYPE_120 1
#define SWASH_TYPE_120X 2
#define SWASH_TYPE_140 3
#define SWASH_TYPE_90 4
#define SWASH_TYPE_NUM 4
#define NUM_CYC 3
#define NUM_CAL_PPM 4
#define NUM_PPM 8
#define THRCHK_DEADBAND 16
#if defined(FSPLASH) || defined(XSPLASH)
@ -1205,7 +1195,7 @@ extern uint8_t g_beepCnt;
extern uint8_t g_beepVal[5];
extern uint8_t ppmInState; //0=unsync 1..8= wait for value i-1
extern int16_t g_ppmIns[8];
extern int16_t g_ppmIns[NUM_PPM];
extern int32_t chans[NUM_CHNOUT];
extern int16_t ex_chans[NUM_CHNOUT]; // Outputs (before LIMITS) of the last perMain
extern int16_t channelOutputs[NUM_CHNOUT];