Merge against latest 2.3

This commit is contained in:
Bertrand Songis
2019-09-17 13:28:42 +02:00
247 changed files with 35085 additions and 42445 deletions
@@ -524,14 +524,14 @@ PACK(typedef struct {
ScriptData_v216 scriptsData[MAX_SCRIPTS]; \
char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; \
uint8_t nPotsToWarn; \
int8_t potPosition[NUM_POTS+NUM_SLIDERS]; \
int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; \
uint8_t spare[2];
#elif defined(PCBSKY9X)
#define MODELDATA_EXTRA_216 \
uint8_t externalModule; \
ModuleData_v216 moduleData[NUM_MODULES+1]; \
uint8_t nPotsToWarn; \
int8_t potPosition[NUM_POTS+NUM_SLIDERS]; \
int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; \
uint8_t rxBattAlarms[2];
#endif
@@ -1070,7 +1070,7 @@ void convertModelData_216_to_217(ModelData &model)
#endif
newModel.potsWarnMode = oldModel.nPotsToWarn >> 6;
newModel.potsWarnEnabled = oldModel.nPotsToWarn & 0x1f;
memcpy(newModel.potsWarnPosition, oldModel.potPosition, sizeof(newModel.potsWarnPosition));
memcpy(newModel.potsWarnPosition, oldModel.potsWarnPosition, sizeof(newModel.potsWarnPosition));
}
void convertModelData_217_to_218(ModelData &model)
@@ -59,7 +59,7 @@ int convertSource_218_to_219(int source)
#endif
#if defined(PCBX10)
if ((source == MIXSRC_EXT1) || (source == MIXSRC_EXT2))
if (source == MIXSRC_EXT1 || source == MIXSRC_EXT2)
source += 2;
#endif
@@ -70,8 +70,8 @@ int convertSwitch_218_to_219(int swtch)
{
// on X7: 2 additional switches
// on X9D / X9D+: 1 additional switch
// on xlite : 2 more storage switches
// on XLite: 2 additional storage switches
// on X10: 2 additional pots => 12 multipos switches
#if defined(PCBX7) || defined(PCBHORUS) || defined(PCBX9D) || defined(PCBX9DP) || defined(PCBXLITE)
if (swtch < 0)
return -convertSwitch_218_to_219(-swtch);
@@ -95,6 +95,9 @@ int convertSwitch_218_to_219(int swtch)
#if defined(PCBHORUS)
if (swtch >= SWSRC_SI0)
swtch += 2 * 3;
#endif
#if defined(PCBX10)
if (swtch >= SWSRC_FIRST_MULTIPOS_SWITCH + 3 * XPOTS_MULTIPOS_COUNT)
swtch += 2 * XPOTS_MULTIPOS_COUNT;
#endif
@@ -120,6 +123,10 @@ void convertModelData_218_to_219(ModelData &model)
// 4 bytes more for the ModelHeader::bitmap
memclear(&newModel.header.bitmap[10], 4);
memcpy(newModel.timers, oldModel.timers, offsetof(ModelData_v218, mixData) - offsetof(ModelData_v218, timers));
// trainer battery compartment removed
if (newModel.trainerData.mode >= TRAINER_MODE_MASTER_BLUETOOTH)
newModel.trainerData.mode -= 1;
#endif
memclear(newModel.mixData, sizeof(ModelData_v219) - offsetof(ModelData_v219, mixData));
@@ -128,6 +135,14 @@ void convertModelData_218_to_219(ModelData &model)
zchar2str(name, oldModel.header.name, LEN_MODEL_NAME);
TRACE("Model %s conversion from v218 to v219", name);
for (uint8_t i=0; i<MAX_TIMERS_218; i++) {
TimerData & timer = newModel.timers[i];
if (timer.mode >= TMRMODE_COUNT)
timer.mode = TMRMODE_COUNT + convertSwitch_218_to_219(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
else if (timer.mode < 0)
timer.mode = convertSwitch_218_to_219(oldModel.timers[i].mode);
}
for (uint8_t i=0; i<MAX_MIXERS_218; i++) {
memmove(&newModel.mixData[i], &oldModel.mixData[i], sizeof(MixData_v218));
newModel.mixData[i].srcRaw = convertSource_218_to_219(newModel.mixData[i].srcRaw); // from newModel to avoid overwrite
@@ -142,6 +157,10 @@ void convertModelData_218_to_219(ModelData &model)
memmove(&newModel.expoData[i], &oldModel.expoData[i], sizeof(ExpoData_v218));
newModel.expoData[i].srcRaw = convertSource_218_to_219(newModel.expoData[i].srcRaw); // from newModel to avoid overwrite
newModel.expoData[i].swtch = convertSwitch_218_to_219(newModel.expoData[i].swtch); // from newModel to avoid overwrite
#if LCD_W == 212
newModel.expoData[i].offset = oldModel.expoData[i].offset; // 212x64: expo name has been reduced to 6 chars instead of 8
newModel.expoData[i].curve = oldModel.expoData[i].curve; // 212x64: expo name has been reduced to 6 chars instead of 8
#endif
}
for (uint8_t i=0; i<MAX_CURVES_218; i++) {
@@ -166,8 +166,8 @@ PACK(typedef struct {
struct {
uint8_t power:2; // 0=10 mW, 1=100 mW, 2=500 mW, 3=1W
uint8_t spare1:2;
uint8_t receiver_telem_off:1; // false = receiver telem enabled
uint8_t receiver_channel_9_16:1; // false = pwm out 1-8, true 9-16
uint8_t receiverTelemetryOff:1; // false = receiver telem enabled
uint8_t receiverHigherChannels:1; // false = pwm out 1-8, true 9-16
uint8_t external_antenna:1; // false = internal antenna, true = external antenna
uint8_t fast:1;
uint8_t spare2;