Conversion continued

This commit is contained in:
Bertrand Songis
2019-03-19 12:14:51 +01:00
parent b4b97379bf
commit 3996fa17bc
3 changed files with 26 additions and 40 deletions
@@ -1234,8 +1234,7 @@ void convertModelData_217_to_218(ModelData &model)
} }
} }
for (int i=0; i<NUM_MODULES+1; i++) { for (int i=0; i<NUM_MODULES+1; i++) {
// newModel.moduleData[i] = oldModel.moduleData[i]; memcpy(&newModel.moduleData[i], &oldModel.moduleData[i], sizeof(ModuleData_v218));
#warning "Conversion from v217 to v218 is broken"
} }
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
newModel.trainerMode = oldModel.trainerMode; newModel.trainerMode = oldModel.trainerMode;
@@ -56,9 +56,9 @@ void convertModelData_218_to_219(ModelData &model)
newModel.trainerData.mode = oldModel.trainerMode; newModel.trainerData.mode = oldModel.trainerMode;
newModel.trainerData.channelsStart = oldModel.moduleData[NUM_MODULES].channelsStart; newModel.trainerData.channelsStart = oldModel.moduleData[NUM_MODULES].channelsStart;
newModel.trainerData.channelsCount = oldModel.moduleData[NUM_MODULES].channelsCount; newModel.trainerData.channelsCount = oldModel.moduleData[NUM_MODULES].channelsCount;
newModel.trainerData.frameLength = oldModel.moduleData[NUM_MODULES].frameLength; newModel.trainerData.frameLength = oldModel.moduleData[NUM_MODULES].ppm.frameLength;
newModel.trainerData.delay = oldModel.moduleData[NUM_MODULES].delay; newModel.trainerData.delay = oldModel.moduleData[NUM_MODULES].ppm.delay;
newModel.trainerData.pulsePol = oldModel.moduleData[NUM_MODULES].pulsePol; newModel.trainerData.pulsePol = oldModel.moduleData[NUM_MODULES].ppm.pulsePol;
memcpy(newModel.scriptsData, oldModel.scriptsData, memcpy(newModel.scriptsData, oldModel.scriptsData,
sizeof(newModel.scriptsData) + sizeof(newModel.scriptsData) +
@@ -174,19 +174,6 @@ PACK(typedef struct {
int8_t refreshRate; // definition as framelength for ppm (* 5 + 225 = time in 1/10 ms) int8_t refreshRate; // definition as framelength for ppm (* 5 + 225 = time in 1/10 ms)
} sbus; } sbus;
}; };
// Helper functions to set both of the rfProto protocol at the same time
inline uint8_t getMultiProtocol(bool returnCustom) {
if (returnCustom && multi.customProto)
return MM_RF_CUSTOM_SELECTED;
return ((uint8_t) (rfProtocol & 0x0f)) + (multi.rfProtocolExtra << 4);
}
inline void setMultiProtocol(uint8_t proto)
{
rfProtocol = (uint8_t) (proto & 0x0f);
multi.rfProtocolExtra = (proto & 0x30) >> 4;
}
}) ModuleData_v218; }) ModuleData_v218;
PACK(typedef struct { PACK(typedef struct {
@@ -310,7 +297,7 @@ PACK(typedef struct {
#elif defined(PCBTARANIS) #elif defined(PCBTARANIS)
#define MODELDATA_EXTRA_218 uint8_t spare:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1]; ScriptData scriptsData[MAX_SCRIPTS_218]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; #define MODELDATA_EXTRA_218 uint8_t spare:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1]; ScriptData scriptsData[MAX_SCRIPTS_218]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS];
#elif defined(PCBSKY9X) #elif defined(PCBSKY9X)
#define MODELDATA_EXTRA_218 uint8_t spare:6; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; uint8_t rxBattAlarms[2]; #define MODELDATA_EXTRA_218 uint8_t spare:6; uint8_t potsWarnMode:2; ModuleData_v218 moduleData[NUM_MODULES+1]; char inputNames[MAX_INPUTS_218][LEN_INPUT_NAME_218]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; uint8_t rxBattAlarms[2];
#else #else
#define MODELDATA_EXTRA_218 #define MODELDATA_EXTRA_218
#endif #endif