Fixes #1596
Conflicts: companion/src/firmwares/opentx/opentxeeprom.cpp More EEPROM saving in Mixes
This commit is contained in:
@@ -1051,6 +1051,15 @@ void ConvertModel_215_to_216(ModelData &model)
|
||||
memcpy(newModel.moduleData, oldModel.moduleData, sizeof(newModel.moduleData));
|
||||
}
|
||||
|
||||
int ConvertGVar_216_to_217(int value)
|
||||
{
|
||||
if (value < -4096 + 9)
|
||||
value += 4096 - 1024;
|
||||
else if (value > 4095 - 9)
|
||||
value -= 4095 - 1023;
|
||||
return value;
|
||||
}
|
||||
|
||||
void ConvertModel_216_to_217(ModelData &model)
|
||||
{
|
||||
// Timer3 added
|
||||
@@ -1086,14 +1095,33 @@ void ConvertModel_216_to_217(ModelData &model)
|
||||
newModel.throttleReversed = oldModel.throttleReversed;
|
||||
newModel.beepANACenter = oldModel.beepANACenter;
|
||||
for (int i=0; i<MAX_MIXERS; i++) {
|
||||
newModel.mixData[i] = oldModel.mixData[i];
|
||||
newModel.mixData[i].destCh = oldModel.mixData[i].destCh;
|
||||
newModel.mixData[i].flightModes = oldModel.mixData[i].flightModes;
|
||||
newModel.mixData[i].mltpx = oldModel.mixData[i].mltpx;
|
||||
newModel.mixData[i].carryTrim = oldModel.mixData[i].carryTrim;
|
||||
newModel.mixData[i].mixWarn = oldModel.mixData[i].mixWarn;
|
||||
newModel.mixData[i].weight = ConvertGVar_216_to_217(oldModel.mixData[i].weight);
|
||||
newModel.mixData[i].swtch = oldModel.mixData[i].swtch;
|
||||
#if defined(PCBTARANIS)
|
||||
newModel.mixData[i].curve = oldModel.mixData[i].curve;
|
||||
#else
|
||||
newModel.mixData[i].curveMode = oldModel.mixData[i].curveMode;
|
||||
newModel.mixData[i].noExpo = oldModel.mixData[i].noExpo;
|
||||
newModel.mixData[i].curveParam = oldModel.mixData[i].curveParam;
|
||||
#endif
|
||||
newModel.mixData[i].delayUp = oldModel.mixData[i].delayUp;
|
||||
newModel.mixData[i].delayDown = oldModel.mixData[i].delayDown;
|
||||
newModel.mixData[i].speedUp = oldModel.mixData[i].speedUp;
|
||||
newModel.mixData[i].speedDown = oldModel.mixData[i].speedDown;
|
||||
newModel.mixData[i].srcRaw = ConvertSource_216_to_217(oldModel.mixData[i].srcRaw);
|
||||
newModel.mixData[i].offset = ConvertGVar_216_to_217(oldModel.mixData[i].offset);
|
||||
memcpy(newModel.mixData[i].name, oldModel.mixData[i].name, sizeof(newModel.mixData[i].name));
|
||||
}
|
||||
for (int i=0; i<NUM_CHNOUT; i++) {
|
||||
#if defined(PCBTARANIS)
|
||||
newModel.limitData[i].min = oldModel.limitData[i].min;
|
||||
newModel.limitData[i].max = oldModel.limitData[i].max;
|
||||
newModel.limitData[i].offset = oldModel.limitData[i].offset;
|
||||
newModel.limitData[i].min = ConvertGVar_216_to_217(oldModel.limitData[i].min);
|
||||
newModel.limitData[i].max = ConvertGVar_216_to_217(oldModel.limitData[i].max);
|
||||
newModel.limitData[i].offset = ConvertGVar_216_to_217(oldModel.limitData[i].offset);
|
||||
newModel.limitData[i].ppmCenter = oldModel.limitData[i].ppmCenter;
|
||||
newModel.limitData[i].symetrical = oldModel.limitData[i].symetrical;
|
||||
newModel.limitData[i].revert = oldModel.limitData[i].revert;
|
||||
|
||||
@@ -608,7 +608,7 @@ PACK(typedef struct t_LimitData {
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define GV1_SMALL 128
|
||||
#define GV1_LARGE 4096
|
||||
#define GV1_LARGE 1024
|
||||
#define GV_RANGE_WEIGHT 500
|
||||
#define GV_RANGE_OFFSET 500
|
||||
#define DELAY_STEP 10
|
||||
@@ -618,15 +618,13 @@ PACK(typedef struct t_LimitData {
|
||||
#if defined(PCBTARANIS)
|
||||
PACK(typedef struct {
|
||||
uint8_t destCh;
|
||||
uint16_t flightModes;
|
||||
uint16_t flightModes:9;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
uint8_t carryTrim:1;
|
||||
uint8_t spare1:5;
|
||||
uint8_t mixWarn:4; // mixer warning
|
||||
int16_t weight;
|
||||
int8_t swtch;
|
||||
CurveRef curve;
|
||||
uint8_t mixWarn:4; // mixer warning
|
||||
uint8_t spare2:4;
|
||||
uint8_t delayUp;
|
||||
uint8_t delayDown;
|
||||
uint8_t speedUp;
|
||||
@@ -634,18 +632,16 @@ PACK(typedef struct {
|
||||
uint8_t srcRaw;
|
||||
int16_t offset;
|
||||
char name[LEN_EXPOMIX_NAME];
|
||||
uint8_t spare3;
|
||||
}) MixData;
|
||||
#else
|
||||
PACK(typedef struct {
|
||||
uint8_t destCh:5;
|
||||
uint8_t mixWarn:3; // mixer warning
|
||||
uint16_t flightModes;
|
||||
uint16_t flightModes:9;
|
||||
uint8_t curveMode:1;
|
||||
uint8_t noExpo:1;
|
||||
int8_t carryTrim:3;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
uint8_t spare:1;
|
||||
int16_t weight;
|
||||
int8_t swtch;
|
||||
int8_t curveParam;
|
||||
@@ -661,7 +657,6 @@ PACK(typedef struct {
|
||||
#define MD_WEIGHT(md) (md->weight)
|
||||
#define MD_WEIGHT_TO_UNION(md, var) var.word = md->weight
|
||||
#define MD_UNION_TO_WEIGHT(var, md) md->weight = var.word
|
||||
// #define MD_SETWEIGHT(md, val) md->weight = val
|
||||
|
||||
PACK( union u_int8int16_t {
|
||||
struct {
|
||||
|
||||
Reference in New Issue
Block a user