1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-17 13:25:20 +03:00
This commit is contained in:
bsongis 2014-08-13 12:48:12 +02:00
parent 36481471a3
commit 4cb598bcaa
18 changed files with 794 additions and 596 deletions

View file

@ -1,8 +1,8 @@
PROJECT( companion )
SET( C9X_VERSION_MAJOR "2" )
SET( C9X_VERSION_MINOR "0" )
SET( C9X_VERSION_REVISION "9" )
SET( C9X_VERSION_MINOR "1" )
SET( C9X_VERSION_REVISION "0" )
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )

View file

@ -1162,7 +1162,7 @@ void ModelData::clear()
funcSw[i].clear();
for (int i=0; i<C9X_MAX_CURVES; i++)
curves[i].clear(5);
for (int i=0; i<2; i++)
for (int i=0; i<C9X_MAX_TIMERS; i++)
timers[i].clear();
swashRingData.clear();
frsky.clear();

View file

@ -70,6 +70,7 @@ const uint8_t modn12x3[4][4]= {
{4, 3, 2, 1} };
#define C9X_MAX_MODELS 60
#define C9X_MAX_TIMERS 3
#define C9X_MAX_FLIGHT_MODES 9
#define C9X_MAX_MIXERS 64
#define C9X_MAX_INPUTS 32
@ -199,7 +200,6 @@ enum HeliSwashTypes {
#define NUM_CYC 3
#define C9X_NUM_SWITCHES 10
#define C9X_NUM_KEYS 6
#define C9X_MAX_TIMERS 2
extern const char * switches9X[];
extern const char * switchesX9D[];
@ -983,7 +983,7 @@ class ModelData {
bool used;
char name[12+1];
TimerData timers[2];
TimerData timers[C9X_MAX_TIMERS];
bool thrTrim; // Enable Throttle Trim
int trimInc; // Trim Increments
bool disableThrottleWarning;
@ -1055,7 +1055,6 @@ class RadioData {
ModelData models[C9X_MAX_MODELS];
};
// TODO rename FlightPhase to FlightMode
enum Capability {
FlightModes,
FlightModesName,

View file

@ -436,7 +436,7 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -460,7 +460,7 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -471,31 +471,31 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -517,7 +517,7 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -545,7 +545,7 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -556,29 +556,29 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -594,7 +594,7 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
}
}
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -606,7 +606,7 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -634,7 +634,7 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -645,29 +645,29 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -684,7 +684,7 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
}
}
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -696,7 +696,7 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -724,7 +724,7 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -735,13 +735,13 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_MAX_CURVES; i++) {
for (int i=0; i<8; i++) {
CurveInfo crvinfo = curveinfo(this, i);
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
c9x.curves[i].count = crvinfo.points;
@ -758,9 +758,9 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.curves[i].points[j].x = -100 + (200*i) / (crvinfo.points-1);
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -768,7 +768,7 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -780,7 +780,7 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++) {
for (int i=0; i<2; i++) {
c9x.timers[i] = timers[i];
c9x.timers[i].persistent = timersXtra[i].remanent;
c9x.timers[i].val = timersXtra[i].value;
@ -811,7 +811,7 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -822,13 +822,13 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_MAX_CURVES; i++) {
for (int i=0; i<8; i++) {
CurveInfo crvinfo = curveinfo(this, i);
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
c9x.curves[i].count = crvinfo.points;
@ -845,9 +845,9 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
c9x.curves[i].points[j].x = -100 + (200*i) / (crvinfo.points-1);
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;

View file

@ -177,7 +177,7 @@ PACK(typedef struct t_Open9xGruvin9xSwashRingData_v209 { // Swash Ring data
PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -189,15 +189,15 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v207 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xGruvin9xMixData_v207 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xGruvin9xLogicalSwitchData_v207 customSw[12];
Open9xFuncSwData_v203 funcSw[16];
Open9xGruvin9xSwashRingData_v208 swashR;
Open9xGruvin9xFlightModeData_v207 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xGruvin9xFlightModeData_v207 flightModeData[5];
Open9xFrSkyData_v205 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@ -211,7 +211,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -223,22 +223,22 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v207 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xGruvin9xMixData_v207 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xGruvin9xLogicalSwitchData_v207 customSw[12];
Open9xGruvin9xFuncSwData_v203 funcSw[16];
Open9xGruvin9xSwashRingData_v208 swashR;
Open9xGruvin9xFlightModeData_v208 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[O9X_NUM_CHNOUT];
int8_t servoCenter[16];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
@ -250,7 +250,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -262,22 +262,22 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v209 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xGruvin9xMixData_v209 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xGruvin9xLogicalSwitchData_v209 customSw[12];
Open9xGruvin9xFuncSwData_v203 funcSw[16];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xFlightModeData_v208 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[O9X_NUM_CHNOUT];
int8_t servoCenter[16];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
@ -290,7 +290,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -302,21 +302,21 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v209 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves[O9X_MAX_CURVES];
int8_t points[O9X_NUM_POINTS];
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
Open9xGruvin9xMixData_v209 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves[8];
int8_t points[112-8];
Open9xGruvin9xLogicalSwitchData_v209 customSw[12];
Open9xGruvin9xFuncSwData_v210 funcSw[16];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xFlightModeData_v208 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
int8_t servoCenter[O9X_NUM_CHNOUT];
int8_t servoCenter[16];
uint8_t switchWarningStates;
@ -328,7 +328,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -340,15 +340,15 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
uint8_t spare1:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v211 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v211 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
int8_t curves[O9X_MAX_CURVES];
int8_t points[O9X_NUM_POINTS];
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
Open9xGruvin9xMixData_v211 mixData[32];
Open9xLimitData_v211 limitData[16];
Open9xExpoData_v211 expoData[14];
int8_t curves[8];
int8_t points[112-8];
Open9xGruvin9xLogicalSwitchData_v209 customSw[12];
Open9xGruvin9xFuncSwData_v210 funcSw[16];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xFlightModeData_v208 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@ -356,7 +356,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
uint8_t switchWarningStates;
Open9xFrSkyData_v210 frsky;
Open9xTimerDataExtra timersXtra[O9X_MAX_TIMERS];
Open9xTimerDataExtra timersXtra[2];
operator ModelData();
t_Open9xGruvin9xModelData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v211)); }

View file

@ -261,17 +261,17 @@ t_Open9xArmMixData_v208::operator MixData ()
else if (srcRaw == 9) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
}
else if (srcRaw <= 9+9+O9X_ARM_NUM_CSW) {
else if (srcRaw <= 9+9+32) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-9);
}
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+32+NUM_CYC) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-10-9-32);
}
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 if (srcRaw <= 9+9+32+NUM_CYC+8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-10-9-32-NUM_CYC);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-10-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-10-9-32-NUM_CYC-8);
}
c9x.weight = weight;
c9x.swtch = open9xArmToSwitch(swtch);
@ -327,17 +327,17 @@ t_Open9xArmMixData_v209::operator MixData ()
else if (srcRaw == 13) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
}
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW) {
else if (srcRaw <= 13+9+32) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-13);
}
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+32+NUM_CYC) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-14-9-32);
}
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 if (srcRaw <= 13+9+32+NUM_CYC+8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-14-9-32-NUM_CYC);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-32-NUM_CYC-8);
}
c9x.weight = weight;
@ -393,17 +393,17 @@ t_Open9xArmMixData_v210::operator MixData ()
else if (srcRaw == 13) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
}
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW) {
else if (srcRaw <= 13+9+32) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-13);
}
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+32+NUM_CYC) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-14-9-32);
}
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 if (srcRaw <= 13+9+32+NUM_CYC+8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-14-9-32-NUM_CYC);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-32-NUM_CYC-8);
}
c9x.weight = weight;
@ -463,17 +463,17 @@ t_Open9xArmMixData_v212::operator MixData ()
else if (srcRaw == 14) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
}
else if (srcRaw <= 14+9+O9X_ARM_NUM_CSW) {
else if (srcRaw <= 14+9+32) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-14);
}
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+32+NUM_CYC) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-15-9-32);
}
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 if (srcRaw <= 14+9+32+NUM_CYC+8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-15-9-32-NUM_CYC);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-15-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-15-9-32-NUM_CYC-8);
}
c9x.weight = weight;
@ -738,7 +738,7 @@ t_Open9xArmModelData_v208::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -766,7 +766,7 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<9; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -777,29 +777,29 @@ t_Open9xArmModelData_v208::operator ModelData ()
}
}
}
for (int i=0; i<O9X_ARM_MAX_MIXERS; i++)
for (int i=0; i<64; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_ARM_NUM_CHNOUT; i++)
for (int i=0; i<32; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_ARM_MAX_EXPOS; i++)
for (int i=0; i<32; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_ARM_NUM_CSW; i++)
for (int i=0; i<32; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_ARM_NUM_FSW; i++)
for (int i=0; i<32; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -815,7 +815,7 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
}
}
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -827,7 +827,7 @@ t_Open9xArmModelData_v209::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -855,7 +855,7 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<9; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -866,29 +866,29 @@ t_Open9xArmModelData_v209::operator ModelData ()
}
}
}
for (int i=0; i<O9X_ARM_MAX_MIXERS; i++)
for (int i=0; i<64; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_ARM_NUM_CHNOUT; i++)
for (int i=0; i<32; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_ARM_MAX_EXPOS; i++)
for (int i=0; i<32; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_ARM_NUM_CSW; i++)
for (int i=0; i<32; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_ARM_NUM_FSW; i++)
for (int i=0; i<32; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -905,7 +905,7 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
}
}
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -917,7 +917,7 @@ t_Open9xArmModelData_v210::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -945,7 +945,7 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<9; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -956,29 +956,29 @@ t_Open9xArmModelData_v210::operator ModelData ()
}
}
}
for (int i=0; i<O9X_ARM_MAX_MIXERS; i++)
for (int i=0; i<64; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_ARM_NUM_CHNOUT; i++)
for (int i=0; i<32; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_ARM_MAX_EXPOS; i++)
for (int i=0; i<32; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_ARM_NUM_CSW; i++)
for (int i=0; i<32; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_ARM_NUM_FSW; i++)
for (int i=0; i<32; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -989,7 +989,7 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -1001,7 +1001,7 @@ t_Open9xArmModelData_v211::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -1029,7 +1029,7 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<9; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1040,13 +1040,13 @@ t_Open9xArmModelData_v211::operator ModelData ()
}
}
}
for (int i=0; i<O9X_ARM_MAX_MIXERS; i++)
for (int i=0; i<64; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_ARM_NUM_CHNOUT; i++)
for (int i=0; i<32; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_ARM_MAX_EXPOS; i++)
for (int i=0; i<32; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_ARM_MAX_CURVES; i++) {
for (int i=0; i<16; i++) {
CurveInfo crvinfo = curveinfo(this, i);
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
c9x.curves[i].count = crvinfo.points;
@ -1063,9 +1063,9 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.curves[i].points[j].x = -100 + (200*i) / (crvinfo.points-1);
}
}
for (int i=0; i<O9X_ARM_NUM_CSW; i++)
for (int i=0; i<32; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_ARM_NUM_FSW; i++)
for (int i=0; i<32; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1073,7 +1073,7 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -1085,7 +1085,7 @@ t_Open9xArmModelData_v212::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++) {
for (int i=0; i<2; i++) {
c9x.timers[i] = timers[i];
c9x.timers[i].persistent = timersXtra[i].remanent;
c9x.timers[i].val = timersXtra[i].value;
@ -1116,7 +1116,7 @@ t_Open9xArmModelData_v212::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_ARM_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<9; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1127,13 +1127,13 @@ t_Open9xArmModelData_v212::operator ModelData ()
}
}
}
for (int i=0; i<O9X_ARM_MAX_MIXERS; i++)
for (int i=0; i<64; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_ARM_NUM_CHNOUT; i++)
for (int i=0; i<32; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_ARM_MAX_EXPOS; i++)
for (int i=0; i<32; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_ARM_MAX_CURVES; i++) {
for (int i=0; i<16; i++) {
CurveInfo crvinfo = curveinfo(this, i);
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
c9x.curves[i].count = crvinfo.points;
@ -1150,9 +1150,9 @@ t_Open9xArmModelData_v212::operator ModelData ()
c9x.curves[i].points[j].x = -100 + (200*i) / (crvinfo.points-1);
}
}
for (int i=0; i<O9X_ARM_NUM_CSW; i++)
for (int i=0; i<32; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_ARM_NUM_FSW; i++)
for (int i=0; i<32; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;

View file

@ -19,17 +19,6 @@
#include "open9xStockeeprom.h"
#define O9X_ARM_MAX_FLIGHT_MODES 9
#define O9X_ARM_MAX_MIXERS 64
#define O9X_ARM_MAX_EXPOS 32
#define O9X_ARM_NUM_CHNOUT 32 // number of real output channels CH1-CH16
#define O9X_ARM_NUM_CSW 32 // number of custom switches
#define O9X_ARM_NUM_FSW 32 // number of functions assigned to switches
#define O9X_ARM_MAX_CURVES 16
#define O9X_ARM_NUM_POINTS 512
#define O9X_ARM_MAX_CSFUNCOLD 13
#define O9X_ARM_MAX_CSFUNC 15
PACK(typedef struct t_Open9xArmTimerData_v202 {
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint16_t val;
@ -326,7 +315,7 @@ PACK(typedef struct t_Open9xArmFrSkyData_v211 {
PACK(typedef struct t_Open9xArmModelData_v208 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -338,22 +327,22 @@ PACK(typedef struct t_Open9xArmModelData_v208 {
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v208 mixData[O9X_ARM_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_ARM_NUM_CHNOUT];
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xArmLogicalSwitchData_v208 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
Open9xArmMixData_v208 mixData[64];
Open9xLimitData_v201 limitData[32];
Open9xArmExpoData_v208 expoData[32];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xArmLogicalSwitchData_v208 customSw[32];
Open9xArmFuncSwData_v208 funcSw[32];
Open9xArmSwashRingData_v208 swashR;
Open9xArmFlightModeData_v208 flightModeData[O9X_ARM_MAX_FLIGHT_MODES];
Open9xArmFlightModeData_v208 flightModeData[9];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[O9X_ARM_NUM_CHNOUT];
int8_t servoCenter[32];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
@ -365,7 +354,7 @@ PACK(typedef struct t_Open9xArmModelData_v208 {
PACK(typedef struct t_Open9xArmModelData_v209 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -377,22 +366,22 @@ PACK(typedef struct t_Open9xArmModelData_v209 {
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v209 mixData[O9X_ARM_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_ARM_NUM_CHNOUT];
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xArmLogicalSwitchData_v209 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
Open9xArmMixData_v209 mixData[64];
Open9xLimitData_v201 limitData[32];
Open9xArmExpoData_v208 expoData[32];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xArmLogicalSwitchData_v209 customSw[32];
Open9xArmFuncSwData_v208 funcSw[32];
Open9xArmSwashRingData_v209 swashR;
Open9xArmFlightModeData_v208 flightModeData[O9X_ARM_MAX_FLIGHT_MODES];
Open9xArmFlightModeData_v208 flightModeData[9];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[O9X_ARM_NUM_CHNOUT];
int8_t servoCenter[32];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
@ -405,7 +394,7 @@ PACK(typedef struct t_Open9xArmModelData_v209 {
PACK(typedef struct t_Open9xArmModelData_v210 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -417,20 +406,20 @@ PACK(typedef struct t_Open9xArmModelData_v210 {
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v210 mixData[O9X_ARM_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_ARM_NUM_CHNOUT];
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v210 funcSw[O9X_ARM_NUM_FSW];
Open9xArmMixData_v210 mixData[64];
Open9xLimitData_v201 limitData[32];
Open9xArmExpoData_v210 expoData[32];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xArmLogicalSwitchData_v210 customSw[32];
Open9xArmFuncSwData_v210 funcSw[32];
Open9xArmSwashRingData_v209 swashR;
Open9xArmFlightModeData_v208 flightModeData[O9X_ARM_MAX_FLIGHT_MODES];
Open9xArmFlightModeData_v208 flightModeData[9];
Open9xArmFrSkyData_v210 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
int8_t servoCenter[O9X_ARM_NUM_CHNOUT];
int8_t servoCenter[32];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
@ -444,7 +433,7 @@ PACK(typedef struct t_Open9xArmModelData_v210 {
PACK(typedef struct t_Open9xArmModelData_v211 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -456,21 +445,21 @@ PACK(typedef struct t_Open9xArmModelData_v211 {
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v210 mixData[O9X_ARM_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_ARM_NUM_CHNOUT];
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
int16_t curves[O9X_ARM_MAX_CURVES];
int8_t points[O9X_ARM_NUM_POINTS];
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
Open9xArmMixData_v210 mixData[64];
Open9xLimitData_v201 limitData[32];
Open9xArmExpoData_v210 expoData[32];
int16_t curves[16];
int8_t points[512];
Open9xArmLogicalSwitchData_v210 customSw[32];
Open9xArmFuncSwData_v211 funcSw[32];
Open9xArmSwashRingData_v209 swashR;
Open9xArmFlightModeData_v208 flightModeData[O9X_ARM_MAX_FLIGHT_MODES];
Open9xArmFlightModeData_v208 flightModeData[9];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
int8_t servoCenter[O9X_ARM_NUM_CHNOUT];
int8_t servoCenter[32];
uint8_t switchWarningStates;
@ -482,7 +471,7 @@ PACK(typedef struct t_Open9xArmModelData_v211 {
PACK(typedef struct t_Open9xArmModelData_v212 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -494,15 +483,15 @@ PACK(typedef struct t_Open9xArmModelData_v212 {
uint8_t spare1:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v212 mixData[O9X_ARM_MAX_MIXERS];
Open9xLimitData_v211 limitData[O9X_ARM_NUM_CHNOUT];
Open9xArmExpoData_v212 expoData[O9X_ARM_MAX_EXPOS];
int16_t curves[O9X_ARM_MAX_CURVES];
int8_t points[O9X_ARM_NUM_POINTS];
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
Open9xArmMixData_v212 mixData[64];
Open9xLimitData_v211 limitData[32];
Open9xArmExpoData_v212 expoData[32];
int16_t curves[16];
int8_t points[512];
Open9xArmLogicalSwitchData_v210 customSw[32];
Open9xArmFuncSwData_v211 funcSw[32];
Open9xArmSwashRingData_v210 swashR;
Open9xArmFlightModeData_v212 flightModeData[O9X_ARM_MAX_FLIGHT_MODES];
Open9xArmFlightModeData_v212 flightModeData[9];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@ -510,7 +499,7 @@ PACK(typedef struct t_Open9xArmModelData_v212 {
uint8_t switchWarningStates;
Open9xArmFrSkyData_v211 frsky;
Open9xTimerDataExtra timersXtra[O9X_MAX_TIMERS];
Open9xTimerDataExtra timersXtra[2];
operator ModelData();
t_Open9xArmModelData_v212() { memset(this, 0, sizeof(t_Open9xArmModelData_v212)); }

View file

@ -568,7 +568,7 @@ t_Open9xFuncSwData_v201::operator FuncSwData ()
{
FuncSwData c9x;
c9x.swtch = open9xStockToSwitch(swtch);
c9x.func = (AssignFunc)(func+O9X_NUM_CHNOUT);
c9x.func = (AssignFunc)(func+16);
return c9x;
}
@ -943,7 +943,7 @@ t_Open9xModelData_v201::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -954,25 +954,25 @@ t_Open9xModelData_v201::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
@ -980,7 +980,7 @@ t_Open9xModelData_v201::operator ModelData ()
c9x.customSw[i] = customSw[i];
for (int i=0; i<12; i++)
c9x.funcSw[i] = funcSw[i];
// for (int i=0; i<O9X_NUM_CHNOUT; i++)
// for (int i=0; i<16; i++)
// c9x.safetySw[i] = safetySw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1017,7 +1017,7 @@ t_Open9xModelData_v202::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1028,25 +1028,25 @@ t_Open9xModelData_v202::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
@ -1054,7 +1054,7 @@ t_Open9xModelData_v202::operator ModelData ()
c9x.customSw[i] = customSw[i];
for (int i=0; i<12; i++)
c9x.funcSw[i] = funcSw[i];
// for (int i=0; i<O9X_NUM_CHNOUT; i++)
// for (int i=0; i<16; i++)
// c9x.safetySw[i] = safetySw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1093,7 +1093,7 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1104,31 +1104,31 @@ t_Open9xModelData_v203::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1167,7 +1167,7 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1178,31 +1178,31 @@ t_Open9xModelData_v204::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1219,7 +1219,7 @@ t_Open9xModelData_v205::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -1246,7 +1246,7 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1257,31 +1257,31 @@ t_Open9xModelData_v205::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1304,7 +1304,7 @@ t_Open9xModelData_v208::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -1332,7 +1332,7 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1343,31 +1343,31 @@ t_Open9xModelData_v208::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1385,7 +1385,7 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
}
}
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -1397,7 +1397,7 @@ t_Open9xModelData_v209::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -1425,7 +1425,7 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1436,31 +1436,31 @@ t_Open9xModelData_v209::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_209_MAX_CURVE5; i++) {
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<O9X_209_MAX_CURVE9; i++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].count = 9;
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[O9X_209_MAX_CURVE5 + i].points[j].y = curves9[i][j];
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1479,7 +1479,7 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.frsky.screens[1].body.lines[line].source[col] += (((frskyLinesXtra >> (4*line+2*col)) & 0x03) * 16);
}
}
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
@ -1491,7 +1491,7 @@ t_Open9xModelData_v210::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -1519,7 +1519,7 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1530,14 +1530,14 @@ t_Open9xModelData_v210::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_MAX_CURVES; i++) {
for (int i=0; i<8; i++) {
CurveInfo crvinfo = curveinfo(this, i);
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
c9x.curves[i].count = crvinfo.points;
@ -1555,9 +1555,9 @@ t_Open9xModelData_v210::operator ModelData ()
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
@ -1567,7 +1567,7 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.thrTraceSrc = thrTraceSrc;
c9x.modelId = modelId;
for (int i=0; i<O9X_NUM_CHNOUT; i++) {
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter=servoCenter[i];
}
@ -1579,7 +1579,7 @@ t_Open9xModelData_v211::operator ModelData ()
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<O9X_MAX_TIMERS; i++)
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
@ -1607,7 +1607,7 @@ t_Open9xModelData_v211::operator ModelData ()
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<O9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
@ -1618,14 +1618,14 @@ t_Open9xModelData_v211::operator ModelData ()
}
}
}
for (int i=0; i<O9X_MAX_MIXERS; i++)
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<O9X_NUM_CHNOUT; i++)
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<O9X_MAX_EXPOS; i++)
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<O9X_MAX_CURVES; i++) {
for (int i=0; i<8; i++) {
CurveInfo crvinfo = curveinfo(this, i);
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
c9x.curves[i].count = crvinfo.points;
@ -1643,9 +1643,9 @@ t_Open9xModelData_v211::operator ModelData ()
}
}
for (int i=0; i<O9X_NUM_CSW; i++)
for (int i=0; i<12; i++)
c9x.customSw[i] = customSw[i];
for (int i=0; i<O9X_NUM_FSW; i++)
for (int i=0; i<16; i++)
c9x.funcSw[i] = funcSw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;

View file

@ -481,20 +481,6 @@ PACK(typedef struct t_Open9xTimerDataExtra {
t_Open9xTimerDataExtra() { memset(this, 0, sizeof(t_Open9xTimerDataExtra)); }
}) Open9xTimerDataExtra;
#define O9X_MAX_TIMERS 2
#define O9X_MAX_FLIGHT_MODES 5
#define O9X_MAX_MIXERS 32
#define O9X_MAX_EXPOS 14
#define O9X_NUM_CHNOUT 16 // number of real output channels CH1-CH16
#define O9X_NUM_CSW 12 // number of custom switches
#define O9X_NUM_FSW 16 // number of functions assigned to switches
#define O9X_MAX_CURVES 8
#define O9X_NUM_POINTS (112-O9X_MAX_CURVES)
#define O9X_MAX_GVARS 5
#define O9X_209_MAX_CURVE5 8
#define O9X_209_MAX_CURVE9 8
PACK(typedef struct t_Open9xModelData_v201 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v201 timer1;
@ -511,16 +497,16 @@ PACK(typedef struct t_Open9xModelData_v201 {
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xTimerData_v201 timer2;
Open9xMixData_v201 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
Open9xMixData_v201 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 customSw[12];
Open9xSafetySwData safetySw[16];
Open9xFuncSwData_v201 funcSw[12];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v201 frsky;
operator ModelData();
@ -542,16 +528,16 @@ PACK(typedef struct t_Open9xModelData_v202 {
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xTimerData_v202 timer2;
Open9xMixData_v201 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
Open9xMixData_v201 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 customSw[12];
Open9xSafetySwData safetySw[16];
Open9xFuncSwData_v201 funcSw[12];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v202 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@ -576,15 +562,15 @@ PACK(typedef struct t_Open9xModelData_v203 {
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xTimerData_v202 timer2;
Open9xMixData_v203 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xMixData_v203 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 customSw[12];
Open9xFuncSwData_v203 funcSw[16];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v202 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@ -609,15 +595,15 @@ PACK(typedef struct t_Open9xModelData_v204 {
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xTimerData_v202 timer2;
Open9xMixData_v203 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xMixData_v203 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 customSw[12];
Open9xFuncSwData_v203 funcSw[16];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v204 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
@ -630,7 +616,7 @@ PACK(typedef struct t_Open9xModelData_v204 {
PACK(typedef struct t_Open9xModelData_v205 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -642,22 +628,22 @@ PACK(typedef struct t_Open9xModelData_v205 {
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v205 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xMixData_v205 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 customSw[12];
Open9xFuncSwData_v203 funcSw[16];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v205 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[O9X_NUM_CHNOUT];
int8_t servoCenter[16];
operator ModelData();
t_Open9xModelData_v205() { memset(this, 0, sizeof(t_Open9xModelData_v205)); }
@ -665,7 +651,7 @@ PACK(typedef struct t_Open9xModelData_v205 {
PACK(typedef struct t_Open9xModelData_v208 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -677,22 +663,22 @@ PACK(typedef struct t_Open9xModelData_v208 {
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v205 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xMixData_v205 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 customSw[12];
Open9xFuncSwData_v203 funcSw[16];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[O9X_NUM_CHNOUT];
int8_t servoCenter[16];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
@ -704,7 +690,7 @@ PACK(typedef struct t_Open9xModelData_v208 {
PACK(typedef struct t_Open9xModelData_v209 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -716,22 +702,22 @@ PACK(typedef struct t_Open9xModelData_v209 {
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v209 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves5[O9X_209_MAX_CURVE5][5];
int8_t curves9[O9X_209_MAX_CURVE9][9];
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
Open9xMixData_v209 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v209 customSw[12];
Open9xFuncSwData_v203 funcSw[16];
Open9xSwashRingData_v209 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[O9X_NUM_CHNOUT];
int8_t servoCenter[16];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
@ -744,7 +730,7 @@ PACK(typedef struct t_Open9xModelData_v209 {
PACK(typedef struct t_Open9xModelData_v210 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -756,21 +742,21 @@ PACK(typedef struct t_Open9xModelData_v210 {
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v209 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v201 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
int8_t curves[O9X_MAX_CURVES];
int8_t points[O9X_NUM_POINTS];
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
Open9xMixData_v209 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves[8];
int8_t points[112-8];
Open9xLogicalSwitchData_v209 customSw[12];
Open9xFuncSwData_v210 funcSw[16];
Open9xSwashRingData_v209 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
int8_t servoCenter[O9X_NUM_CHNOUT];
int8_t servoCenter[16];
uint8_t switchWarningStates;
@ -782,7 +768,7 @@ PACK(typedef struct t_Open9xModelData_v210 {
PACK(typedef struct t_Open9xModelData_v211 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[O9X_MAX_TIMERS];
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -794,15 +780,15 @@ PACK(typedef struct t_Open9xModelData_v211 {
uint8_t spare1:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v211 mixData[O9X_MAX_MIXERS];
Open9xLimitData_v211 limitData[O9X_NUM_CHNOUT];
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
int8_t curves[O9X_MAX_CURVES];
int8_t points[O9X_NUM_POINTS];
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
Open9xMixData_v211 mixData[32];
Open9xLimitData_v211 limitData[16];
Open9xExpoData_v211 expoData[14];
int8_t curves[8];
int8_t points[112-8];
Open9xLogicalSwitchData_v209 customSw[12];
Open9xFuncSwData_v210 funcSw[16];
Open9xSwashRingData_v209 swashR;
Open9xFlightModeData_v201 flightModeData[O9X_MAX_FLIGHT_MODES];
Open9xFlightModeData_v201 flightModeData[5];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;

View file

@ -16,12 +16,13 @@
#define MAX_SWITCHES_POSITION(board) (IS_TARANIS(board) ? 22 : 9)
#define MAX_ROTARY_ENCODERS(board) (board==BOARD_GRUVIN9X ? 2 : (IS_SKY9X(board) ? 1 : 0))
#define MAX_FLIGHT_MODES(board, version) (IS_ARM(board) ? 9 : (IS_DBLRAM(board, version) ? 6 : 5))
#define MAX_TIMERS(board, version) ((IS_ARM(board) && version >= 217) ? 3 : 2)
#define MAX_MIXERS(board, version) (IS_ARM(board) ? 64 : 32)
#define MAX_CHANNELS(board, version) (IS_ARM(board) ? 32 : 16)
#define MAX_EXPOS(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 64 : 32) : (IS_DBLRAM(board, version) ? 16 : 14))
#define MAX_CUSTOM_SWITCHES(board, version) (IS_ARM(board) ? 32 : ((IS_DBLEEPROM(board, version) && version<217) ? 15 : 12))
#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_CURVES(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 32 : 16) : 8)
#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)
@ -1239,7 +1240,7 @@ class CurvesField: public TransformedField {
board(board),
version(version),
maxCurves(MAX_CURVES(board, version)),
maxPoints(IS_ARM(board) ? O9X_ARM_NUM_POINTS : O9X_NUM_POINTS)
maxPoints(IS_ARM(board) ? 512 : 112-8)
{
for (int i=0; i<maxCurves; i++) {
if (IS_TARANIS(board) && version >= 216) {
@ -2426,9 +2427,17 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new CharField<10>(modelData.bitmap));
}
for (int i=0; i<O9X_MAX_TIMERS; i++) {
for (int i=0; i<MAX_TIMERS(board, version); i++) {
internalField.Append(new SwitchField<8>(modelData.timers[i].mode, board, version, true));
if ((IS_ARM(board) || IS_2560(board)) && version >= 216) {
if (IS_ARM(board) && version >= 217) {
internalField.Append(new UnsignedField<2>(modelData.timers[i].countdownBeep));
internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));
internalField.Append(new UnsignedField<2>(modelData.timers[i].persistent));
internalField.Append(new SpareBitsField<3>());
internalField.Append(new UnsignedField<32>(modelData.timers[i].val));
internalField.Append(new SignedField<32>(modelData.timers[i].pvalue));
}
else if ((IS_ARM(board) || IS_2560(board)) && version >= 216) {
internalField.Append(new UnsignedField<16>(modelData.timers[i].val));
internalField.Append(new UnsignedField<2>(modelData.timers[i].countdownBeep));
internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));

View file

@ -31,26 +31,6 @@
#define SIMU_STOCK_VARIANTS (GVARS_VARIANT|FRSKY_VARIANT)
#define SIMU_M128_VARIANTS (M128_VARIANT|SIMU_STOCK_VARIANTS)
#define O9X_MAX_TIMERS 2
#define O9X_MAX_FLIGHT_MODES 5
#define O9X_MAX_MIXERS 32
#define O9X_MAX_EXPOS 14
#define O9X_NUM_CHNOUT 16 // number of real output channels CH1-CH16
#define O9X_NUM_CSW 12 // number of custom switches
#define O9X_NUM_FSW 16 // number of functions assigned to switches
#define O9X_MAX_CURVES 8
#define O9X_NUM_POINTS (112-O9X_MAX_CURVES)
#define O9X_ARM_MAX_FLIGHT_MODES 9
#define O9X_ARM_MAX_MIXERS 64
#define O9X_ARM_MAX_EXPOS 32
#define O9X_ARM_NUM_CHNOUT 32 // number of real output channels CH1-CH16
#define O9X_ARM_NUM_CSW 32 // number of custom switches
#define O9X_ARM_NUM_FSW 32 // number of functions assigned to switches
#define O9X_ARM_NUM_POINTS 512
#define O9X_ARM_MAX_CSFUNCOLD 13
#define O9X_ARM_MAX_CSFUNC 15
class OpenTxGeneralData: public TransformedField {
public:
OpenTxGeneralData(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant=0);

View file

@ -377,7 +377,7 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
case BOARD_TARANIS_PLUS:
case BOARD_SKY9X:
case BOARD_9XRPRO:
version = 216;
version = 217;
break;
case BOARD_GRUVIN9X:
case BOARD_MEGA2560:
@ -556,11 +556,11 @@ int OpenTxFirmware::getCapability(const Capability capability)
case GvarsFlightModes:
return ((IS_ARM(board) || board==BOARD_GRUVIN9X) ? 1 : 0);
case Mixes:
return (IS_ARM(board) ? O9X_ARM_MAX_MIXERS : O9X_MAX_MIXERS);
return (IS_ARM(board) ? 64 : 32);
case OffsetWeight:
return (IS_ARM(board) ? 500 : 245);
case Timers:
return 2;
return (IS_ARM(board) ? 3 : 2);
case PermTimers:
if (board == BOARD_GRUVIN9X || IS_ARM(board))
return 1;
@ -601,7 +601,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
else
return 0;
case Outputs:
return (IS_ARM(board) ? O9X_ARM_NUM_CHNOUT : O9X_NUM_CHNOUT);
return (IS_ARM(board) ? 32 : 16);
case NumCurvePoints:
return (IS_ARM(board) ? 512 : 104);
case VoicesAsNumbers:

View file

@ -345,10 +345,17 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
ui->name->setMaxLength(IS_TARANIS(firmware->getBoard()) ? 12 : 10);
for (int i=0; i<C9X_MAX_TIMERS; i++) {
if (i<firmware->getCapability(Timers)) {
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware);
ui->gridLayout->addWidget(timers[i], 1+i, 1);
connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified()));
}
else {
foreach(QLabel *label, findChildren<QLabel *>(QRegExp(QString("label_timer%1").arg(i+1)))) {
label->hide();
}
}
}
for (int i=0; i<firmware->getCapability(NumModules); i++) {
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, firmware, i);
@ -625,7 +632,7 @@ void SetupPanel::update()
updatePotWarnings();
}
for (int i=0; i<C9X_MAX_TIMERS; i++)
for (int i=0; i<firmware->getCapability(Timers); i++)
timers[i]->update();
for (int i=0; i<C9X_NUM_MODULES+1; i++)

View file

@ -16,7 +16,55 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="1">
<item row="3" column="0">
<widget class="QLabel" name="label_timer3">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Timer 3</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_timer1">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Timer 1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="label_timer2">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Timer 2</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="3">
<widget class="QCheckBox" name="throttleReverse">
@ -144,39 +192,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item>
</layout>
</item>
<item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="label_timer2">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Timer 2</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Timer 1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="label_ttrace">
@ -212,14 +228,14 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item>
</layout>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<layout class="QGridLayout" name="centerBeepLayout"/>
@ -239,14 +255,14 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item>
</layout>
</item>
<item row="7" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="font">
<font>
@ -262,7 +278,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -370,7 +386,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item>
</layout>
</item>
<item row="8" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<item row="9" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QLabel" name="swwarn_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -392,7 +408,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">

View file

@ -296,7 +296,7 @@ SHELL = sh
IMG2LBM = -python ../util/img2lbm.py
BIN2LBM = -python ../util/bin2lbm.py
TRANSLATE = -python ../util/translate.py
VERSION = 2.0.9
VERSION = 2.1.0
SRC =
CPPSRC =

View file

@ -134,6 +134,16 @@ PACK(typedef struct {
uint16_t value;
}) TimerData_v215;
PACK(typedef struct {
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint16_t start;
uint8_t countdownBeep:2;
uint8_t minuteBeep:1;
uint8_t persistent:2;
uint8_t spare:3;
uint16_t value;
}) TimerData_v216;
PACK(typedef struct {
int16_t trim[4];
int8_t swtch; // swtch of phase[0] is not used
@ -203,7 +213,7 @@ PACK(typedef struct {
PACK(typedef struct {
ModelHeader header;
TimerData_v215 timers[MAX_TIMERS];
TimerData_v215 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
@ -240,6 +250,65 @@ PACK(typedef struct {
}) ModelData_v215;
PACK(typedef struct {
ModelHeader header;
TimerData_v216 timers[2];
AVR_FIELD(uint8_t protocol:3)
ARM_FIELD(uint8_t telemetryProtocol:3)
uint8_t thrTrim:1; // Enable Throttle Trim
AVR_FIELD(int8_t ppmNCH:4)
ARM_FIELD(int8_t spare2:4)
int8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
ARM_FIELD(uint8_t displayChecklist:1)
AVR_FIELD(uint8_t pulsePol:1)
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t throttleReversed:1;
AVR_FIELD(int8_t ppmDelay)
BeepANACenter beepANACenter; // 1<<0->A1.. 1<<6->A7
MixData mixData[MAX_MIXERS];
LimitData limitData[NUM_CHNOUT];
ExpoData expoData[MAX_EXPOS];
CURVDATA curves[MAX_CURVES];
int8_t points[NUM_POINTS];
LogicalSwitchData logicalSw[NUM_LOGICAL_SWITCH];
CustomFnData funcSw[NUM_CFN];
SwashRingData swashR;
FlightModeData flightModeData[MAX_FLIGHT_MODES];
AVR_FIELD(int8_t ppmFrameLength) // 0=22.5ms (10ms-30ms) 0.5ms increments
uint8_t thrTraceSrc;
swstate_t switchWarningStates;
uint8_t nSwToWarn;
global_gvar_t gvars[MAX_GVARS];
FrSkyData frsky;
#if defined(PCBTARANIS)
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];
#elif defined(PCBSKY9X)
uint8_t externalModule;
ModuleData moduleData[NUM_MODULES+1];
uint8_t nPotsToWarn;
int8_t potPosition[NUM_POTS];
uint8_t rxBattAlarms[2];
#endif
}) ModelData_v216;
#if defined(PCBTARANIS)
#define NUM_POTS_215 4
#else
@ -330,6 +399,11 @@ void ConvertGeneralSettings_215_to_216(EEGeneral &settings)
settings.hapticStrength = 0; // Haptic strength reset
}
void ConvertGeneralSettings_216_to_217(EEGeneral &settings)
{
settings.version = 217;
}
int ConvertTelemetrySource_215_to_216(int source)
{
// TELEM_TX_TIME and 5 spare added
@ -463,15 +537,16 @@ void ConvertModel_215_to_216(ModelData &model)
ModelData_v215 oldModel;
memcpy(&oldModel, &model, sizeof(oldModel));
memset(&model, 0, sizeof(ModelData));
ModelData_v216 &newModel = *(ModelData_v216*)&model;
memset(&newModel, 0, sizeof(ModelData_v216));
char name[LEN_MODEL_NAME+1];
zchar2str(name, oldModel.header.name, LEN_MODEL_NAME);
TRACE("Model %s conversion from v215 to v216", name);
memcpy(&g_model.header, &oldModel.header, sizeof(g_model.header));
memcpy(&newModel.header, &oldModel.header, sizeof(newModel.header));
for (uint8_t i=0; i<2; i++) {
TimerData & timer = g_model.timers[i];
TimerData_v216 & timer = newModel.timers[i];
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
timer.mode = TMRMODE_COUNT + ConvertSwitch_215_to_216(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
else
@ -482,21 +557,21 @@ void ConvertModel_215_to_216(ModelData &model)
timer.countdownBeep = oldModel.timers[i].countdownBeep;
timer.value = oldModel.timers[i].value;
}
g_model.thrTrim = oldModel.thrTrim;
g_model.trimInc = oldModel.trimInc - 2;
g_model.disableThrottleWarning = oldModel.disableThrottleWarning;
g_model.extendedLimits = oldModel.extendedLimits;
g_model.extendedTrims = oldModel.extendedTrims;
g_model.throttleReversed = oldModel.throttleReversed;
newModel.thrTrim = oldModel.thrTrim;
newModel.trimInc = oldModel.trimInc - 2;
newModel.disableThrottleWarning = oldModel.disableThrottleWarning;
newModel.extendedLimits = oldModel.extendedLimits;
newModel.extendedTrims = oldModel.extendedTrims;
newModel.throttleReversed = oldModel.throttleReversed;
#if defined(PCBTARANIS)
g_model.beepANACenter = (oldModel.beepANACenter & 0x3f) | ((oldModel.beepANACenter & 0xc0) << 1);
newModel.beepANACenter = (oldModel.beepANACenter & 0x3f) | ((oldModel.beepANACenter & 0xc0) << 1);
#else
g_model.beepANACenter = oldModel.beepANACenter;
newModel.beepANACenter = oldModel.beepANACenter;
#endif
for (uint8_t i=0; i<64; i++) {
MixData * mix = &g_model.mixData[i];
MixData * mix = &newModel.mixData[i];
MixData_v215 * oldMix = &oldModel.mixData[i];
#if defined(PCBTARANIS)
mix->destCh = oldMix->destCh;
@ -552,25 +627,25 @@ void ConvertModel_215_to_216(ModelData &model)
}
for (uint8_t i=0; i<32; i++) {
#if defined(PCBTARANIS)
g_model.limitData[i].min = 10 * oldModel.limitData[i].min;
g_model.limitData[i].max = 10 * oldModel.limitData[i].max;
newModel.limitData[i].min = 10 * oldModel.limitData[i].min;
newModel.limitData[i].max = 10 * oldModel.limitData[i].max;
#else
g_model.limitData[i].min = oldModel.limitData[i].min;
g_model.limitData[i].max = oldModel.limitData[i].max;
newModel.limitData[i].min = oldModel.limitData[i].min;
newModel.limitData[i].max = oldModel.limitData[i].max;
#endif
g_model.limitData[i].ppmCenter = oldModel.limitData[i].ppmCenter;
g_model.limitData[i].offset = oldModel.limitData[i].offset;
g_model.limitData[i].symetrical = oldModel.limitData[i].symetrical;
g_model.limitData[i].revert = oldModel.limitData[i].revert;
newModel.limitData[i].ppmCenter = oldModel.limitData[i].ppmCenter;
newModel.limitData[i].offset = oldModel.limitData[i].offset;
newModel.limitData[i].symetrical = oldModel.limitData[i].symetrical;
newModel.limitData[i].revert = oldModel.limitData[i].revert;
#if defined(PCBTARANIS)
memcpy(g_model.limitData[i].name, oldModel.limitData[i].name, LEN_CHANNEL_NAME);
memcpy(newModel.limitData[i].name, oldModel.limitData[i].name, LEN_CHANNEL_NAME);
#endif
}
#if defined(PCBTARANIS)
int indexes[NUM_STICKS] = { 0, 0, 0, 0 };
#endif
for (uint8_t i=0; i<32; i++) {
ExpoData * expo = &g_model.expoData[i];
ExpoData * expo = &newModel.expoData[i];
ExpoData_v215 * oldExpo = &oldModel.expoData[i];
if (oldExpo->mode) {
#if defined(PCBTARANIS)
@ -634,7 +709,7 @@ void ConvertModel_215_to_216(ModelData &model)
expo->mode = 3;
}
for (int c=0; c<4; c++) {
g_model.inputNames[i][c] = char2idx(STR_VSRCRAW[1+STR_VSRCRAW[0]*(i+1)+c]);
newModel.inputNames[i][c] = char2idx(STR_VSRCRAW[1+STR_VSRCRAW[0]*(i+1)+c]);
}
}
#endif
@ -644,21 +719,21 @@ void ConvertModel_215_to_216(ModelData &model)
int8_t *nxt = &oldModel.points[5+5*i+oldModel.curves[i]];
uint8_t size = nxt - cur;
if ((size & 1) == 0) {
g_model.curves[i].type = CURVE_TYPE_CUSTOM;
g_model.curves[i].points = (size / 2) - 4;
newModel.curves[i].type = CURVE_TYPE_CUSTOM;
newModel.curves[i].points = (size / 2) - 4;
}
else {
g_model.curves[i].points = size-5;
newModel.curves[i].points = size-5;
}
#else
g_model.curves[i] = oldModel.curves[i];
newModel.curves[i] = oldModel.curves[i];
#endif
}
for (uint16_t i=0; i<512; i++) {
g_model.points[i] = oldModel.points[i];
newModel.points[i] = oldModel.points[i];
}
for (uint8_t i=0; i<32; i++) {
LogicalSwitchData & sw = g_model.logicalSw[i];
LogicalSwitchData & sw = newModel.logicalSw[i];
sw.func = oldModel.logicalSw[i].func;
if (sw.func >= LS_FUNC_VEQUAL) sw.func += 1;
if (sw.func >= LS_FUNC_RANGE) sw.func += 1;
@ -725,7 +800,7 @@ void ConvertModel_215_to_216(ModelData &model)
}
}
for (uint8_t i=0; i<32; i++) {
CustomFnData & fn = g_model.funcSw[i];
CustomFnData & fn = newModel.funcSw[i];
fn.swtch = ConvertSwitch_215_to_216(oldModel.funcSw[i].swtch);
fn.func = oldModel.funcSw[i].func;
if (fn.func <= 15) {
@ -798,13 +873,13 @@ void ConvertModel_215_to_216(ModelData &model)
}
}
g_model.swashR = oldModel.swashR;
g_model.swashR.collectiveSource = ConvertSource_215_to_216(g_model.swashR.collectiveSource);
newModel.swashR = oldModel.swashR;
newModel.swashR.collectiveSource = ConvertSource_215_to_216(newModel.swashR.collectiveSource);
for (uint8_t i=0; i<9; i++) {
if (i==0 || oldModel.flightModeData[i].swtch) {
memcpy(&g_model.flightModeData[i], &oldModel.flightModeData[i], sizeof(oldModel.flightModeData[i])); // the last 4 gvars will remain blank
g_model.flightModeData[i].swtch = ConvertSwitch_215_to_216(oldModel.flightModeData[i].swtch);
memcpy(&newModel.flightModeData[i], &oldModel.flightModeData[i], sizeof(oldModel.flightModeData[i])); // the last 4 gvars will remain blank
newModel.flightModeData[i].swtch = ConvertSwitch_215_to_216(oldModel.flightModeData[i].swtch);
#if defined(PCBTARANIS)
for (uint8_t t=0; t<4; t++) {
int trim = oldModel.flightModeData[i].trim[t];
@ -812,43 +887,43 @@ void ConvertModel_215_to_216(ModelData &model)
trim -= 501;
if (trim >= i)
trim += 1;
g_model.flightModeData[i].trim[t].mode = 2*trim;
g_model.flightModeData[i].trim[t].value = 0;
newModel.flightModeData[i].trim[t].mode = 2*trim;
newModel.flightModeData[i].trim[t].value = 0;
}
else {
g_model.flightModeData[i].trim[t].mode = 2*i;
g_model.flightModeData[i].trim[t].value = trim;
newModel.flightModeData[i].trim[t].mode = 2*i;
newModel.flightModeData[i].trim[t].value = trim;
}
}
#endif
}
}
g_model.thrTraceSrc = oldModel.thrTraceSrc;
newModel.thrTraceSrc = oldModel.thrTraceSrc;
#if defined(PCBTARANIS)
// S3 added
if (g_model.thrTraceSrc >= THROTTLE_SOURCE_S3)
g_model.thrTraceSrc += 1;
if (newModel.thrTraceSrc >= THROTTLE_SOURCE_S3)
newModel.thrTraceSrc += 1;
#endif
g_model.switchWarningStates = oldModel.switchWarningStates >> 1;
g_model.nSwToWarn = (oldModel.switchWarningStates & 0x01) ? 0xFF : 0;
newModel.switchWarningStates = oldModel.switchWarningStates >> 1;
newModel.nSwToWarn = (oldModel.switchWarningStates & 0x01) ? 0xFF : 0;
for (uint8_t i=0; i<5; i++) {
memcpy(g_model.gvars[i].name, oldModel.gvar_names[i], LEN_GVAR_NAME);
memcpy(newModel.gvars[i].name, oldModel.gvar_names[i], LEN_GVAR_NAME);
}
memcpy(&g_model.frsky, &oldModel.frsky, 2*sizeof(FrSkyChannelData));
memcpy(&newModel.frsky, &oldModel.frsky, 2*sizeof(FrSkyChannelData));
// gap for A3-A4
memcpy(((uint8_t *)&g_model.frsky) + 4*sizeof(FrSkyChannelData), ((uint8_t *)&oldModel.frsky) + 2*sizeof(FrSkyChannelData), sizeof(oldModel.frsky) - 2*sizeof(FrSkyChannelData));
memcpy(((uint8_t *)&newModel.frsky) + 4*sizeof(FrSkyChannelData), ((uint8_t *)&oldModel.frsky) + 2*sizeof(FrSkyChannelData), sizeof(oldModel.frsky) - 2*sizeof(FrSkyChannelData));
// A3 and A4 introduced
if (g_model.frsky.voltsSource >= FRSKY_VOLTS_SOURCE_A3)
g_model.frsky.voltsSource += 2;
if (g_model.frsky.currentSource >= FRSKY_CURRENT_SOURCE_A3)
g_model.frsky.currentSource += 2;
if (newModel.frsky.voltsSource >= FRSKY_VOLTS_SOURCE_A3)
newModel.frsky.voltsSource += 2;
if (newModel.frsky.currentSource >= FRSKY_CURRENT_SOURCE_A3)
newModel.frsky.currentSource += 2;
for (int i=0; i<3; i++) {
if (g_model.frsky.screensType & (1<<i)) {
if (newModel.frsky.screensType & (1<<i)) {
// gauges
for (int j=0; j<4; j++) {
uint8_t & source = g_model.frsky.screens[i].bars[j].source;
uint8_t & source = newModel.frsky.screens[i].bars[j].source;
source = ConvertTelemetrySource_215_to_216(source);
}
}
@ -856,7 +931,7 @@ void ConvertModel_215_to_216(ModelData &model)
// numbers
for (int j=0; j<4; j++) {
for (int k=0; k<NUM_LINE_ITEMS; k++) {
uint8_t & source = g_model.frsky.screens[i].lines[j].sources[k];
uint8_t & source = newModel.frsky.screens[i].lines[j].sources[k];
source = ConvertTelemetrySource_215_to_216(source);
}
}
@ -864,12 +939,72 @@ void ConvertModel_215_to_216(ModelData &model)
}
#if defined(PCBTARANIS)
g_model.externalModule = oldModel.externalModule;
g_model.trainerMode = oldModel.trainerMode;
memcpy(g_model.curveNames, oldModel.curveNames, sizeof(g_model.curveNames));
newModel.externalModule = oldModel.externalModule;
newModel.trainerMode = oldModel.trainerMode;
memcpy(newModel.curveNames, oldModel.curveNames, sizeof(newModel.curveNames));
#endif
memcpy(g_model.moduleData, oldModel.moduleData, sizeof(g_model.moduleData));
memcpy(newModel.moduleData, oldModel.moduleData, sizeof(newModel.moduleData));
}
void ConvertModel_216_to_217(ModelData &model)
{
// Timer3 added
// 32bits Timers
assert(sizeof(ModelData_v216) <= sizeof(ModelData));
ModelData_v216 oldModel;
memcpy(&oldModel, &model, sizeof(oldModel));
ModelData &newModel = model;
memset(&newModel, 0, sizeof(ModelData));
char name[LEN_MODEL_NAME+1];
zchar2str(name, oldModel.header.name, LEN_MODEL_NAME);
TRACE("Model %s conversion from v216 to v217", name);
memcpy(&newModel.header, &oldModel.header, sizeof(newModel.header));
for (uint8_t i=0; i<2; i++) {
newModel.timers[i].mode = oldModel.timers[i].mode;
newModel.timers[i].start = oldModel.timers[i].start;
newModel.timers[i].countdownBeep = oldModel.timers[i].countdownBeep;
newModel.timers[i].minuteBeep = oldModel.timers[i].minuteBeep;
newModel.timers[i].persistent = oldModel.timers[i].persistent;
newModel.timers[i].value = oldModel.timers[i].value;
}
newModel.telemetryProtocol = oldModel.telemetryProtocol;
newModel.thrTrim = oldModel.thrTrim;
newModel.trimInc = oldModel.trimInc - 2;
newModel.disableThrottleWarning = oldModel.disableThrottleWarning;
newModel.displayChecklist = oldModel.displayChecklist;
newModel.extendedLimits = oldModel.extendedLimits;
newModel.extendedTrims = oldModel.extendedTrims;
newModel.throttleReversed = oldModel.throttleReversed;
newModel.beepANACenter = oldModel.beepANACenter;
memcpy(newModel.mixData, oldModel.mixData, sizeof(newModel.mixData));
memcpy(newModel.limitData, oldModel.limitData, sizeof(newModel.limitData));
memcpy(newModel.expoData, oldModel.expoData, sizeof(newModel.expoData));
memcpy(newModel.curves, oldModel.curves, sizeof(newModel.curves));
memcpy(newModel.points, oldModel.points, sizeof(newModel.points));
memcpy(newModel.logicalSw, oldModel.logicalSw, sizeof(newModel.logicalSw));
memcpy(newModel.funcSw, oldModel.funcSw, sizeof(newModel.funcSw));
newModel.swashR = oldModel.swashR;
memcpy(newModel.flightModeData, oldModel.flightModeData, sizeof(newModel.flightModeData));
newModel.thrTraceSrc = oldModel.thrTraceSrc;
newModel.switchWarningStates = oldModel.switchWarningStates;
newModel.nSwToWarn = oldModel.nSwToWarn;
memcpy(newModel.gvars, oldModel.gvars, sizeof(newModel.gvars));
newModel.frsky = oldModel.frsky;
newModel.externalModule = oldModel.externalModule;
memcpy(newModel.moduleData, oldModel.moduleData, sizeof(newModel.moduleData));
#if defined(PCBTARANIS)
newModel.trainerMode = oldModel.trainerMode;
memcpy(newModel.scriptsData, oldModel.scriptsData, sizeof(newModel.scriptsData));
memcpy(newModel.curveNames, oldModel.curveNames, sizeof(newModel.curveNames));
memcpy(newModel.inputNames, oldModel.inputNames, sizeof(newModel.inputNames));
#endif
newModel.nPotsToWarn = oldModel.nPotsToWarn;
memcpy(newModel.potPosition, oldModel.potPosition, sizeof(newModel.potPosition));
}
void ConvertModel(int id, int version)
@ -881,6 +1016,11 @@ void ConvertModel(int id, int version)
ConvertModel_215_to_216(g_model);
}
if (version == 216) {
version = 217;
ConvertModel_216_to_217(g_model);
}
uint8_t currModel = g_eeGeneral.currModel;
g_eeGeneral.currModel = id;
s_eeDirtyMsk = EE_MODEL;
@ -895,6 +1035,9 @@ bool eeConvert()
if (g_eeGeneral.version == 215) {
msg = PSTR("EEprom Data v215");
}
else if (g_eeGeneral.version == 216) {
msg = PSTR("EEprom Data v216");
}
else {
return false;
}
@ -918,6 +1061,10 @@ bool eeConvert()
version = 216;
ConvertGeneralSettings_215_to_216(g_eeGeneral);
}
if (version == 216) {
version = 217;
ConvertGeneralSettings_216_to_217(g_eeGeneral);
}
s_eeDirtyMsk = EE_GENERAL;
eeCheck(true);

View file

@ -881,6 +881,10 @@ enum menuModelSetupItems {
CASE_PERSISTENT_TIMERS(ITEM_MODEL_TIMER2_PERSISTENT)
ITEM_MODEL_TIMER2_MINUTE_BEEP,
ITEM_MODEL_TIMER2_COUNTDOWN_BEEP,
CASE_CPUARM(ITEM_MODEL_TIMER3)
CASE_CPUARM(ITEM_MODEL_TIMER3_PERSISTENT)
CASE_CPUARM(ITEM_MODEL_TIMER3_MINUTE_BEEP)
CASE_CPUARM(ITEM_MODEL_TIMER3_COUNTDOWN_BEEP)
ITEM_MODEL_EXTENDED_LIMITS,
ITEM_MODEL_EXTENDED_TRIMS,
ITEM_MODEL_TRIM_INC,
@ -996,7 +1000,7 @@ void menuModelSetup(uint8_t event)
#define MODEL_SETUP_MAX_LINES (1+ITEM_MODEL_SETUP_MAX)
#define POT_WARN_ITEMS() ((g_model.nPotsToWarn >> 6) ? (uint8_t)NUM_POTS : (uint8_t)0)
bool CURSOR_ON_CELL = (m_posHorz >= 0);
MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, CASE_PCBTARANIS(LABEL(Throttle)) 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, 7, POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 0, IF_INTERNAL_MODULE_ON(1), IF_INTERNAL_MODULE_ON(IS_D8_RX(0) ? (uint8_t)1 : (uint8_t)2), IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), LABEL(ExternalModule), (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, EXTERNAL_MODULE_CHANNELS_ROWS(), (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW, IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, CASE_PCBTARANIS(LABEL(Throttle)) 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, 7, POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 0, IF_INTERNAL_MODULE_ON(1), IF_INTERNAL_MODULE_ON(IS_D8_RX(0) ? (uint8_t)1 : (uint8_t)2), IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), LABEL(ExternalModule), (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, EXTERNAL_MODULE_CHANNELS_ROWS(), (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW, IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
#elif defined(CPUARM)
#define IF_EXTERNAL_MODULE_XJT(x) (IS_MODULE_XJT(EXTERNAL_MODULE) ? (uint8_t)x : HIDDEN_ROW)
#define IF_EXTERNAL_MODULE_ON(x) (g_model.externalModule == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
@ -1008,17 +1012,13 @@ void menuModelSetup(uint8_t event)
#define CURSOR_ON_CELL (true)
#define MODEL_SETUP_MAX_LINES (1+ITEM_MODEL_SETUP_MAX)
#define POT_WARN_ITEMS() ((g_model.nPotsToWarn >> 6) ? (uint8_t)NUM_POTS : (uint8_t)0)
#if defined(PCBTARANIS) || (defined(PCBSKY9X) && !defined(REVA) && !defined(REVX))
#if (defined(PCBSKY9X) && !defined(REVA) && !defined(REVX))
#define EXTRA_MODULE_ROWS LABEL(ExtraModule), 1, 2,
#else
#define EXTRA_MODULE_ROWS
#endif
#if defined(PCBTARANIS)
#define TRAINER_MODULE_ROWS LABEL(Trainer), IF_TRAINER_ON(1), 2
#else
#define TRAINER_MODULE_ROWS
#endif
MENU_TAB({ 0, 0, CASE_PCBTARANIS(0) 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, CASE_PCBTARANIS(LABEL(Throttle)) 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, 6, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, LABEL(ExternalModule), (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, EXTERNAL_MODULE_CHANNELS_ROWS(), (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW, IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)), EXTRA_MODULE_ROWS TRAINER_MODULE_ROWS });
MENU_TAB({ 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, CASE_PCBTARANIS(LABEL(Throttle)) 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, 6, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, LABEL(ExternalModule), (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, EXTERNAL_MODULE_CHANNELS_ROWS(), (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW, IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)), EXTRA_MODULE_ROWS TRAINER_MODULE_ROWS });
#elif defined(CPUM64)
#define CURSOR_ON_CELL (true)
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX)
@ -1091,26 +1091,26 @@ void menuModelSetup(uint8_t event)
break;
#endif
#if defined(CPUARM)
case ITEM_MODEL_TIMER1:
case ITEM_MODEL_TIMER2:
case ITEM_MODEL_TIMER3:
case ITEM_MODEL_TIMER1_MINUTE_BEEP:
case ITEM_MODEL_TIMER2_MINUTE_BEEP:
case ITEM_MODEL_TIMER3_MINUTE_BEEP:
case ITEM_MODEL_TIMER1_COUNTDOWN_BEEP:
case ITEM_MODEL_TIMER2_COUNTDOWN_BEEP:
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
{
TimerData *timer = &g_model.timers[k>=ITEM_MODEL_TIMER2 ? 1 : 0];
if (k==ITEM_MODEL_TIMER1_MINUTE_BEEP || k==ITEM_MODEL_TIMER2_MINUTE_BEEP) {
TimerData *timer = &g_model.timers[k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0)];
if (k==ITEM_MODEL_TIMER1_MINUTE_BEEP || k==ITEM_MODEL_TIMER2_MINUTE_BEEP || k==ITEM_MODEL_TIMER3_MINUTE_BEEP) {
timer->minuteBeep = onoffMenuItem(timer->minuteBeep, MODEL_SETUP_2ND_COLUMN, y, STR_MINUTEBEEP, attr, event);
}
else if (k==ITEM_MODEL_TIMER1_COUNTDOWN_BEEP || k==ITEM_MODEL_TIMER2_COUNTDOWN_BEEP) {
#if defined(CPUARM)
else if (k==ITEM_MODEL_TIMER1_COUNTDOWN_BEEP || k==ITEM_MODEL_TIMER2_COUNTDOWN_BEEP || k==ITEM_MODEL_TIMER3_COUNTDOWN_BEEP) {
timer->countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, 0, 2, attr, event);
#else
timer->countdownBeep = onoffMenuItem(timer->countdownBeep, MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, attr, event);
#endif
}
else {
putsStrIdx(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
putsStrIdx(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER3 ? 3 : (k>=ITEM_MODEL_TIMER2 ? 2 : 1));
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
#if defined(PCBTARANIS)
@ -1137,7 +1137,55 @@ void menuModelSetup(uint8_t event)
break;
}
#if defined(CPUARM) || defined(PCBGRUVIN9X)
case ITEM_MODEL_TIMER1_PERSISTENT:
case ITEM_MODEL_TIMER2_PERSISTENT:
case ITEM_MODEL_TIMER3_PERSISTENT:
{
TimerData &timer = g_model.timers[k==ITEM_MODEL_TIMER3_PERSISTENT ? 2 : (k==ITEM_MODEL_TIMER2_PERSISTENT ? 1 : 0)];
timer.persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer.persistent, 0, 2, attr, event);
break;
}
#else
case ITEM_MODEL_TIMER1:
case ITEM_MODEL_TIMER2:
case ITEM_MODEL_TIMER1_MINUTE_BEEP:
case ITEM_MODEL_TIMER2_MINUTE_BEEP:
case ITEM_MODEL_TIMER1_COUNTDOWN_BEEP:
case ITEM_MODEL_TIMER2_COUNTDOWN_BEEP:
{
TimerData *timer = &g_model.timers[k>=ITEM_MODEL_TIMER2 ? 1 : 0];
if (k==ITEM_MODEL_TIMER1_MINUTE_BEEP || k==ITEM_MODEL_TIMER2_MINUTE_BEEP) {
timer->minuteBeep = onoffMenuItem(timer->minuteBeep, MODEL_SETUP_2ND_COLUMN, y, STR_MINUTEBEEP, attr, event);
}
else if (k==ITEM_MODEL_TIMER1_COUNTDOWN_BEEP || k==ITEM_MODEL_TIMER2_COUNTDOWN_BEEP) {
timer->countdownBeep = onoffMenuItem(timer->countdownBeep, MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, attr, event);
}
else {
putsStrIdx(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
if (attr && (editMode>0 || p1valdiff)) {
div_t qr = div(timer->start, 60);
switch (m_posHorz) {
case 0:
CHECK_INCDEC_MODELVAR_CHECK(event, timer->mode, SWSRC_FIRST, TMRMODE_COUNT+SWSRC_LAST-1/*SWSRC_None removed*/, isSwitchAvailableInTimers);
break;
case 1:
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
timer->start = qr.rem + qr.quot*60;
break;
case 2:
qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62)-2;
timer->start -= qr.rem ;
if ((int16_t)timer->start < 0) timer->start=0;
break;
}
}
}
break;
}
#if defined(PCBGRUVIN9X)
case ITEM_MODEL_TIMER1_PERSISTENT:
case ITEM_MODEL_TIMER2_PERSISTENT:
{
@ -1145,6 +1193,7 @@ void menuModelSetup(uint8_t event)
timer.persistent = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer.persistent, 0, 2, attr, event);
break;
}
#endif
#endif
case ITEM_MODEL_EXTENDED_LIMITS:

View file

@ -64,10 +64,10 @@
#define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
#if defined(PCBTARANIS)
#define EEPROM_VER 216
#define EEPROM_VER 217
#define FIRST_CONV_EEPROM_VER 215
#elif defined(PCBSKY9X)
#define EEPROM_VER 216
#define EEPROM_VER 217
#define FIRST_CONV_EEPROM_VER 215
#elif defined(CPUM2560) || defined(CPUM2561)
#define EEPROM_VER 217
@ -149,7 +149,12 @@
#define NUM_XPOTS 0
#endif
#if defined(CPUARM)
#define MAX_TIMERS 3
#else
#define MAX_TIMERS 2
#endif
#define NUM_CYC 3
#define NUM_CAL_PPM 4
@ -1626,7 +1631,18 @@ enum CountDownModes {
COUNTDOWN_VOICE
};
#if defined(CPUARM) || defined(CPUM2560)
#if defined(CPUARM)
PACK(typedef struct t_TimerData {
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint8_t countdownBeep:2;
uint8_t minuteBeep:1;
uint8_t persistent:2;
uint8_t spare:3;
uint32_t start;
int32_t value;
}) TimerData;
#define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
#elif defined(CPUM2560)
PACK(typedef struct t_TimerData {
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint16_t start;