1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00
This commit is contained in:
bsongis 2014-06-23 12:15:17 +02:00
parent 1febac7bf9
commit 2c6f28e422
4 changed files with 45 additions and 34 deletions

View file

@ -2749,8 +2749,16 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
pauseMixerCalculations(); pauseMixerCalculations();
if (expo) { if (expo) {
ExpoData *expo = expoAddress(idx); ExpoData *expo = expoAddress(idx);
#if defined(PCBTARANIS)
int input = expo->chn;
#endif
memmove(expo, expo+1, (MAX_EXPOS-(idx+1))*sizeof(ExpoData)); memmove(expo, expo+1, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
memclear(&g_model.expoData[MAX_EXPOS-1], sizeof(ExpoData)); memclear(&g_model.expoData[MAX_EXPOS-1], sizeof(ExpoData));
#if defined(PCBTARANIS)
if (!isInputAvailable(input)) {
memclear(&g_model.inputNames[input], sizeof(LEN_INPUT_NAME));
}
#endif
} }
else { else {
MixData *mix = mixAddress(idx); MixData *mix = mixAddress(idx);

View file

@ -1366,20 +1366,26 @@ void drawStatusLine()
} }
#endif #endif
#if defined(PCBTARANIS)
bool isInputAvailable(int input)
{
for (int i=0; i<MAX_EXPOS; i++) {
ExpoData * expo = expoAddress(i);
if (!EXPO_VALID(expo))
break;
if (expo->chn == input)
return true;
}
return false;
}
#endif
#if defined(CPUARM) #if defined(CPUARM)
bool isSourceAvailable(int source) bool isSourceAvailable(int source)
{ {
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
if (source>=MIXSRC_FIRST_INPUT && source<=MIXSRC_LAST_INPUT) { if (source>=MIXSRC_FIRST_INPUT && source<=MIXSRC_LAST_INPUT) {
int input = source - MIXSRC_FIRST_INPUT; return isInputAvailable(source - MIXSRC_FIRST_INPUT);
for (int i=0; i<MAX_EXPOS; i++) {
ExpoData * expo = expoAddress(i);
if (!EXPO_VALID(expo))
break;
if (expo->chn == input)
return true;
}
return false;
} }
#endif #endif

View file

@ -236,6 +236,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
bool isInputAvailable(int input);
bool isSourceAvailable(int source); bool isSourceAvailable(int source);
bool isTelemetrySourceAvailable(int source); bool isTelemetrySourceAvailable(int source);
bool isInputSourceAvailable(int source); bool isInputSourceAvailable(int source);

View file

@ -142,6 +142,12 @@
#define NUM_CAL_PPM 4 #define NUM_CAL_PPM 4
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
#define LEN_MODEL_NAME 12
#define LEN_BITMAP_NAME 10
#define LEN_EXPOMIX_NAME 8
#define LEN_FP_NAME 10
#define LEN_CHANNEL_NAME 6
#define LEN_INPUT_NAME 4
enum CurveType { enum CurveType {
CURVE_TYPE_STANDARD, CURVE_TYPE_STANDARD,
CURVE_TYPE_CUSTOM, CURVE_TYPE_CUSTOM,
@ -153,17 +159,22 @@ PACK(typedef struct t_CurveInfo {
uint8_t spare:4; uint8_t spare:4;
int8_t points; int8_t points;
}) CurveInfo; }) CurveInfo;
#define MAX_CURVES 32 #define MAX_CURVES 32
#define NUM_POINTS 512 #define NUM_POINTS 512
#define CURVDATA CurveInfo #define CURVDATA CurveInfo
#elif defined(CPUARM) #elif defined(CPUARM)
#define MAX_CURVES 16 #define LEN_MODEL_NAME 10
#define NUM_POINTS 512 #define LEN_EXPOMIX_NAME 6
#define CURVDATA int16_t #define LEN_FP_NAME 6
#define MAX_CURVES 16
#define NUM_POINTS 512
#define CURVDATA int16_t
#else #else
#define MAX_CURVES 8 #define LEN_MODEL_NAME 10
#define NUM_POINTS (112-MAX_CURVES) #define LEN_FP_NAME 6
#define CURVDATA int8_t #define MAX_CURVES 8
#define NUM_POINTS (112-MAX_CURVES)
#define CURVDATA int8_t
#endif #endif
#if defined(PCBTARANIS) || defined(PCBSKY9X) #if defined(PCBTARANIS) || defined(PCBSKY9X)
@ -326,7 +337,7 @@ PACK(typedef struct t_ScriptData {
TRAINER_MODULE TRAINER_MODULE
}; };
#define MODELDATA_BITMAP char bitmap[LEN_BITMAP_NAME]; #define MODELDATA_BITMAP char bitmap[LEN_BITMAP_NAME];
#define MODELDATA_EXTRA uint8_t externalModule; uint8_t trainerMode; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][4]; uint8_t nPotsToWarn; int8_t potPosition[NUM_POTS]; uint8_t spare[2]; #define MODELDATA_EXTRA uint8_t externalModule; uint8_t trainerMode; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t nPotsToWarn; int8_t potPosition[NUM_POTS]; uint8_t spare[2];
#define LIMITDATA_EXTRA char name[LEN_CHANNEL_NAME]; int8_t curve; #define LIMITDATA_EXTRA char name[LEN_CHANNEL_NAME]; int8_t curve;
#define swstate_t uint16_t #define swstate_t uint16_t
#elif defined(PCBSKY9X) #elif defined(PCBSKY9X)
@ -443,21 +454,6 @@ PACK(typedef struct t_EEGeneral {
#define SWITCHES_DELAY_NONE (-15) #define SWITCHES_DELAY_NONE (-15)
#define HAPTIC_STRENGTH() (3+g_eeGeneral.hapticStrength) #define HAPTIC_STRENGTH() (3+g_eeGeneral.hapticStrength)
#if defined(PCBTARANIS)
#define LEN_MODEL_NAME 12
#define LEN_BITMAP_NAME 10
#define LEN_EXPOMIX_NAME 8
#define LEN_FP_NAME 10
#define LEN_CHANNEL_NAME 6
#elif defined(PCBSKY9X)
#define LEN_MODEL_NAME 10
#define LEN_EXPOMIX_NAME 6
#define LEN_FP_NAME 6
#else
#define LEN_MODEL_NAME 10
#define LEN_FP_NAME 6
#endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
enum CurveRefType { enum CurveRefType {
CURVE_REF_DIFF, CURVE_REF_DIFF,