EEPROM conversions continued

This commit is contained in:
Bertrand Songis
2019-03-19 10:28:12 +01:00
parent cee4fe6ac9
commit a82dd27c99
13 changed files with 46 additions and 3216 deletions
+2 -2
View File
@@ -133,8 +133,8 @@ endif()
if(ARCH STREQUAL ARM AND NOT PCB STREQUAL X12S AND NOT PCB STREQUAL X10 AND NOT PCB STREQUAL XLITE AND NOT PCB STREQUAL XLITES AND NOT PCB STREQUAL X3)
add_definitions(-DEEPROM_CONVERSIONS)
set(SRC ${SRC} storage/conversions/eeprom_conversions.cpp)
# set(SRC ${SRC} storage/conversions/conversions_216_217.cpp)
set(SRC ${SRC} storage/conversions/conversions.cpp)
set(SRC ${SRC} storage/conversions/conversions_216_218.cpp)
endif()
add_definitions(-DFLAVOUR="${FLAVOUR}")
@@ -18,17 +18,20 @@
* GNU General Public License for more details.
*/
void ConvertModel(int id, int version)
#include "opentx.h"
#include "conversions.h"
void convertModelData(int id, int version)
{
eeLoadModelData(id);
if (version == 216) {
version = 217;
ConvertModel_216_to_217(g_model);
convertModelData_216_to_217(g_model);
}
if (version == 217) {
version = 218;
ConvertModel_217_to_218(g_model);
convertModelData_217_to_218(g_model);
}
uint8_t currModel = g_eeGeneral.currModel;
@@ -71,11 +74,11 @@ bool eeConvert()
int version = conversionVersionStart;
if (version == 216) {
version = 217;
ConvertRadioData_216_to_217(g_eeGeneral);
convertRadioData_216_to_217(g_eeGeneral);
}
if (version == 217) {
version = 218;
ConvertRadioData_217_to_218(g_eeGeneral);
convertRadioData_217_to_218(g_eeGeneral);
}
storageDirty(EE_GENERAL);
storageCheck(true);
@@ -97,7 +100,7 @@ bool eeConvert()
#endif
lcdRefresh();
if (eeModelExists(id)) {
ConvertModel(id, conversionVersionStart);
convertModelData(id, conversionVersionStart);
}
}
+28 -2
View File
@@ -1,4 +1,30 @@
void ConvertModel(int id, int version);
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
bool eeConvert();
void convertModelData(int id, int version);
// Conversions 216 to 217
void convertModelData_216_to_217(ModelData &model);
void convertRadioData_216_to_217(RadioData &settings);
// Conversions 217 to 218
void convertModelData_217_to_218(ModelData &model);
void convertRadioData_217_to_218(RadioData &settings);
@@ -1,448 +0,0 @@
#include <string.h>
#include "datastructs_216.h"
enum SwitchSources {
SWSRC_NONE = 0,
SWSRC_FIRST_SWITCH,
#if defined(PCBTARANIS)
SWSRC_SA0 = SWSRC_FIRST_SWITCH,
SWSRC_SA1,
SWSRC_SA2,
SWSRC_SB0,
SWSRC_SB1,
SWSRC_SB2,
SWSRC_SC0,
SWSRC_SC1,
SWSRC_SC2,
SWSRC_SD0,
SWSRC_SD1,
SWSRC_SD2,
SWSRC_SE0,
SWSRC_SE1,
SWSRC_SE2,
SWSRC_SF0,
SWSRC_SF2,
SWSRC_SG0,
SWSRC_SG1,
SWSRC_SG2,
SWSRC_SH0,
SWSRC_SH2,
SWSRC_TRAINER = SWSRC_SH2,
#else
SWSRC_ID0 = SWSRC_FIRST_SWITCH,
SWSRC_ID1,
SWSRC_ID2,
SWSRC_THR,
SWSRC_RUD,
SWSRC_ELE,
SWSRC_AIL,
SWSRC_GEA,
SWSRC_TRN,
SWSRC_TRAINER = SWSRC_TRN,
#endif
SWSRC_LAST_SWITCH = SWSRC_TRAINER,
#if defined(PCBTARANIS)
SWSRC_FIRST_MULTIPOS_SWITCH,
SWSRC_LAST_MULTIPOS_SWITCH = SWSRC_FIRST_MULTIPOS_SWITCH + (NUM_XPOTS*XPOTS_MULTIPOS_COUNT) - 1,
#endif
SWSRC_FIRST_TRIM,
SWSRC_TrimRudLeft = SWSRC_FIRST_TRIM,
SWSRC_TrimRudRight,
SWSRC_TrimEleDown,
SWSRC_TrimEleUp,
SWSRC_TrimThrDown,
SWSRC_TrimThrUp,
SWSRC_TrimAilLeft,
SWSRC_TrimAilRight,
SWSRC_LAST_TRIM = SWSRC_TrimAilRight,
#if defined(PCBSKY9X)
SWSRC_REa,
#endif
SWSRC_FIRST_LOGICAL_SWITCH,
SWSRC_SW1 = SWSRC_FIRST_LOGICAL_SWITCH,
SWSRC_SW2,
SWSRC_SW3,
SWSRC_SW4,
SWSRC_SW5,
SWSRC_SW6,
SWSRC_SW7,
SWSRC_SW8,
SWSRC_SW9,
SWSRC_SWA,
SWSRC_SWB,
SWSRC_SWC,
SWSRC_LAST_LOGICAL_SWITCH = SWSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
SWSRC_ON,
SWSRC_One,
SWSRC_FIRST_FLIGHT_MODE,
SWSRC_LAST_FLIGHT_MODE = SWSRC_FIRST_FLIGHT_MODE+MAX_FLIGHT_MODES-1,
SWSRC_COUNT,
SWSRC_OFF = -SWSRC_ON,
SWSRC_LAST = SWSRC_COUNT-1,
SWSRC_FIRST = -SWSRC_LAST,
SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_LAST_FLIGHT_MODE,
SWSRC_LAST_IN_MIXES = SWSRC_LAST_FLIGHT_MODE,
SWSRC_FIRST_IN_LOGICAL_SWITCHES = -SWSRC_LAST_IN_LOGICAL_SWITCHES,
SWSRC_FIRST_IN_MIXES = -SWSRC_LAST_IN_MIXES,
};
enum MixSources {
MIXSRC_NONE,
#if defined(PCBTARANIS)
MIXSRC_FIRST_INPUT,
MIXSRC_LAST_INPUT = MIXSRC_FIRST_INPUT+MAX_INPUTS-1,
MIXSRC_FIRST_LUA,
MIXSRC_LAST_LUA = MIXSRC_FIRST_LUA+(MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS)-1,
#endif
MIXSRC_Rud,
MIXSRC_Ele,
MIXSRC_Thr,
MIXSRC_Ail,
MIXSRC_FIRST_POT,
#if defined(PCBTARANIS)
MIXSRC_POT1 = MIXSRC_FIRST_POT,
MIXSRC_POT2,
MIXSRC_POT3,
MIXSRC_SLIDER1,
MIXSRC_SLIDER2,
MIXSRC_LAST_POT = MIXSRC_SLIDER2,
#else
MIXSRC_P1 = MIXSRC_FIRST_POT,
MIXSRC_P2,
MIXSRC_P3,
MIXSRC_LAST_POT = MIXSRC_P3,
#endif
#if defined(PCBSKY9X)
MIXSRC_REa,
MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REa,
#endif
MIXSRC_MAX,
MIXSRC_CYC1,
MIXSRC_CYC2,
MIXSRC_CYC3,
MIXSRC_TrimRud,
MIXSRC_TrimEle,
MIXSRC_TrimThr,
MIXSRC_TrimAil,
MIXSRC_FIRST_SWITCH,
#if defined(PCBTARANIS)
MIXSRC_SA = MIXSRC_FIRST_SWITCH,
MIXSRC_SB,
MIXSRC_SC,
MIXSRC_SD,
MIXSRC_SE,
MIXSRC_SF,
MIXSRC_SG,
MIXSRC_SH,
#else
MIXSRC_3POS = MIXSRC_FIRST_SWITCH,
MIXSRC_THR,
MIXSRC_RUD,
MIXSRC_ELE,
MIXSRC_AIL,
MIXSRC_GEA,
MIXSRC_TRN,
#endif
MIXSRC_FIRST_LOGICAL_SWITCH,
MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH,
MIXSRC_SW9 = MIXSRC_SW1 + 8,
MIXSRC_SWA,
MIXSRC_SWB,
MIXSRC_SWC,
MIXSRC_LAST_LOGICAL_SWITCH = MIXSRC_FIRST_LOGICAL_SWITCH+MAX_LOGICAL_SWITCHES-1,
MIXSRC_FIRST_TRAINER,
MIXSRC_LAST_TRAINER = MIXSRC_FIRST_TRAINER+MAX_TRAINER_CHANNELS-1,
MIXSRC_FIRST_CH,
MIXSRC_CH1 = MIXSRC_FIRST_CH,
MIXSRC_CH2,
MIXSRC_CH3,
MIXSRC_CH4,
MIXSRC_CH5,
MIXSRC_CH6,
MIXSRC_CH7,
MIXSRC_CH8,
MIXSRC_CH9,
MIXSRC_CH10,
MIXSRC_CH11,
MIXSRC_CH12,
MIXSRC_CH13,
MIXSRC_CH14,
MIXSRC_CH15,
MIXSRC_CH16,
MIXSRC_LAST_CH = MIXSRC_CH1+MAX_OUTPUT_CHANNELS-1,
MIXSRC_GVAR1,
MIXSRC_LAST_GVAR = MIXSRC_GVAR1+MAX_GVARS-1,
MIXSRC_FIRST_TELEM,
MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+NUM_TELEMETRY-1
};
int ConvertTelemetrySource_216_to_217(int source)
{
// TELEM_TIMER3 added
// if (source >= TELEM_TIMER3)
// source += 1;
return source;
}
#if defined(PCBTARANIS)
int ConvertSwitch_216_to_217(int swtch)
{
if (swtch < 0)
return -ConvertSwitch_216_to_217(-swtch);
if (swtch > SWSRC_SF0)
swtch += 1;
if (swtch > SWSRC_SH0)
swtch += 1;
return swtch;
}
#else
int ConvertSwitch_216_to_217(int swtch)
{
return swtch;
}
#endif
int ConvertSource_216_to_217(int source)
{
#if defined(PCBX9E)
// SI to SR switches added
if (source >= MIXSRC_SI)
source += 10;
#endif
// Telemetry conversions
if (source >= MIXSRC_FIRST_TELEM)
source = 0;
return source;
}
int ConvertGVar_216_to_217(int value)
{
if (value < -4096 + 9)
value += 4096 - 1024;
else if (value > 4095 - 9)
value -= 4095 - 1023;
return value;
}
void ConvertRadioData_216_to_217(void * settings)
{
RadioData_v216 * settings_v216 = (RadioData_v216 *)&settings;
settings_v216->version = 217;
#if defined(PCBTARANIS)
settings_v216->potsConfig = 0x05; // S1 and S2 = pots with detent
settings_v216->switchConfig = 0x00007bff; // 6x3POS, 1x2POS, 1xTOGGLE
#endif
}
void ConvertModel_216_to_217(void * model)
{
// Timer3 added
// 32bits Timers
// MixData reduction
// PPM center range
// Telemetry custom screens
// TODO perhaps will be needed, but elsewhere assert(sizeof(ModelData_v216) <= sizeof(ModelData));
ModelData_v216 oldModel;
memcpy(&oldModel, &model, sizeof(oldModel));
ModelData_v217 & newModel = (ModelData_v217 &)model;
memset(&newModel, 0, sizeof(ModelData_v217));
char name[LEN_MODEL_NAME+1];
zchar2str(name, oldModel.header.name, LEN_MODEL_NAME);
TRACE("Model %s conversion from v216 to v217", name);
newModel.header.modelId[0] = oldModel.header.modelId;
memcpy(newModel.header.name, oldModel.header.name, LEN_MODEL_NAME);
#if defined(PCBTARANIS) && LCD_W >= 212
memcpy(newModel.header.bitmap, oldModel.header.bitmap, LEN_BITMAP_NAME);
#endif
for (uint8_t i=0; i<2; i++) {
TimerData_v217 & timer = newModel.timers[i];
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
timer.mode = TMRMODE_COUNT + ConvertSwitch_216_to_217(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
else
timer.mode = ConvertSwitch_216_to_217(oldModel.timers[i].mode);
timer.start = oldModel.timers[i].start;
timer.countdownBeep = oldModel.timers[i].countdownBeep;
timer.minuteBeep = oldModel.timers[i].minuteBeep;
timer.persistent = oldModel.timers[i].persistent;
timer.value = oldModel.timers[i].value;
}
newModel.telemetryProtocol = oldModel.telemetryProtocol;
newModel.thrTrim = oldModel.thrTrim;
newModel.trimInc = oldModel.trimInc;
newModel.disableThrottleWarning = oldModel.disableThrottleWarning;
newModel.displayChecklist = oldModel.displayChecklist;
newModel.extendedLimits = oldModel.extendedLimits;
newModel.extendedTrims = oldModel.extendedTrims;
newModel.throttleReversed = oldModel.throttleReversed;
newModel.beepANACenter = oldModel.beepANACenter;
for (int i=0; i<MAX_MIXERS; i++) {
newModel.mixData[i].destCh = oldModel.mixData[i].destCh;
newModel.mixData[i].flightModes = oldModel.mixData[i].flightModes;
newModel.mixData[i].mltpx = oldModel.mixData[i].mltpx;
newModel.mixData[i].carryTrim = oldModel.mixData[i].carryTrim;
newModel.mixData[i].mixWarn = oldModel.mixData[i].mixWarn;
newModel.mixData[i].weight = ConvertGVar_216_to_217(oldModel.mixData[i].weight);
newModel.mixData[i].swtch = ConvertSwitch_216_to_217(oldModel.mixData[i].swtch);
#if defined(PCBTARANIS)
newModel.mixData[i].curve = oldModel.mixData[i].curve;
#else
// TODO newModel.mixData[i].curveMode = oldModel.mixData[i].curveMode;
// TODO newModel.mixData[i].noExpo = oldModel.mixData[i].noExpo;
// TODO newModel.mixData[i].curveParam = oldModel.mixData[i].curveParam;
#endif
newModel.mixData[i].delayUp = oldModel.mixData[i].delayUp;
newModel.mixData[i].delayDown = oldModel.mixData[i].delayDown;
newModel.mixData[i].speedUp = oldModel.mixData[i].speedUp;
newModel.mixData[i].speedDown = oldModel.mixData[i].speedDown;
newModel.mixData[i].srcRaw = ConvertSource_216_to_217(oldModel.mixData[i].srcRaw);
newModel.mixData[i].offset = ConvertGVar_216_to_217(oldModel.mixData[i].offset);
memcpy(newModel.mixData[i].name, oldModel.mixData[i].name, sizeof(newModel.mixData[i].name));
}
for (int i=0; i<MAX_OUTPUT_CHANNELS; i++) {
#if defined(PCBTARANIS)
newModel.limitData[i].min = ConvertGVar_216_to_217(oldModel.limitData[i].min);
newModel.limitData[i].max = ConvertGVar_216_to_217(oldModel.limitData[i].max);
newModel.limitData[i].offset = ConvertGVar_216_to_217(oldModel.limitData[i].offset);
newModel.limitData[i].ppmCenter = oldModel.limitData[i].ppmCenter;
newModel.limitData[i].symetrical = oldModel.limitData[i].symetrical;
newModel.limitData[i].revert = oldModel.limitData[i].revert;
newModel.limitData[i].curve = oldModel.limitData[i].curve;
memcpy(newModel.limitData[i].name, oldModel.limitData[i].name, sizeof(newModel.limitData[i].name));
#else
newModel.limitData[i] = oldModel.limitData[i];
#endif
}
for (int i=0; i<MAX_EXPOS; i++) {
#if defined(PCBTARANIS)
newModel.expoData[i].srcRaw = ConvertSource_216_to_217(oldModel.expoData[i].srcRaw);
newModel.expoData[i].scale = oldModel.expoData[i].scale;
newModel.expoData[i].carryTrim = oldModel.expoData[i].carryTrim;
newModel.expoData[i].curve = oldModel.expoData[i].curve;
newModel.expoData[i].offset = oldModel.expoData[i].offset;
#else
newModel.expoData[i].curveMode = oldModel.expoData[i].curveMode;
newModel.expoData[i].curveParam = oldModel.expoData[i].curveParam;
#endif
newModel.expoData[i].chn = oldModel.expoData[i].chn;
newModel.expoData[i].swtch = ConvertSwitch_216_to_217(oldModel.expoData[i].swtch);
newModel.expoData[i].flightModes = oldModel.expoData[i].flightModes;
newModel.expoData[i].weight = oldModel.expoData[i].weight;
newModel.expoData[i].mode = oldModel.expoData[i].mode;
memcpy(newModel.expoData[i].name, oldModel.expoData[i].name, sizeof(newModel.expoData[i].name));
}
memcpy(newModel.curves, oldModel.curves, sizeof(newModel.curves));
memcpy(newModel.points, oldModel.points, sizeof(newModel.points));
for (int i=0; i<32; i++) {
LogicalSwitchData_v217 & sw = newModel.logicalSw[i];
sw.func = oldModel.logicalSw[i].func;
sw.v1 = oldModel.logicalSw[i].v1;
sw.v2 = oldModel.logicalSw[i].v2;
sw.v3 = oldModel.logicalSw[i].v3;
sw.delay = oldModel.logicalSw[i].delay;
sw.duration = oldModel.logicalSw[i].duration;
uint8_t cstate = lswFamily(sw.func);
if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_COMP || cstate == LS_FAMILY_DIFF) {
sw.v1 = ConvertSource_216_to_217((uint8_t)sw.v1);
if (cstate == LS_FAMILY_COMP) {
sw.v2 = ConvertSource_216_to_217((uint8_t)sw.v2);
}
}
else if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
sw.v1 = ConvertSwitch_216_to_217(sw.v1);
sw.v2 = ConvertSwitch_216_to_217(sw.v2);
}
else if (cstate == LS_FAMILY_EDGE) {
sw.v1 = ConvertSwitch_216_to_217(sw.v1);
}
sw.andsw = ConvertSwitch_216_to_217(sw.andsw);
}
for (int i=0; i<MAX_SPECIAL_FUNCTIONS; i++) {
CustomFunctionData_v216 & fn = newModel.customFn[i];
fn = oldModel.customFn[i];
fn.swtch = ConvertSwitch_216_to_217(fn.swtch);
if (fn.func == FUNC_PLAY_VALUE || fn.func == FUNC_VOLUME || (IS_ADJUST_GV_FUNC(fn.func) && fn.all.mode == FUNC_ADJUST_GVAR_SOURCE)) {
fn.all.val = ConvertSource_216_to_217(fn.all.val);
}
}
newModel.swashR.collectiveSource = ConvertSource_216_to_217(newModel.swashR.collectiveSource);
// TODO other fields
for (int i=0; i<MAX_FLIGHT_MODES; i++) {
newModel.flightModeData[i] = oldModel.flightModeData[i];
newModel.flightModeData[i].swtch = ConvertSwitch_216_to_217(oldModel.flightModeData[i].swtch);
}
newModel.thrTraceSrc = oldModel.thrTraceSrc;
newModel.switchWarningState = oldModel.switchWarningState;
newModel.switchWarningEnable = oldModel.switchWarningEnable;
memcpy(newModel.gvars, oldModel.gvars, sizeof(newModel.gvars));
memcpy(&newModel.rssiAlarms, &oldModel.frsky.rssiAlarms, sizeof(newModel.rssiAlarms));
for (int i=0; i<NUM_MODULES+1; i++) {
newModel.moduleData[i].type = 0;
newModel.moduleData[i].rfProtocol = oldModel.moduleData[i].rfProtocol;
newModel.moduleData[i].channelsStart = oldModel.moduleData[i].channelsStart;
newModel.moduleData[i].channelsCount = oldModel.moduleData[i].channelsCount;
newModel.moduleData[i].failsafeMode = oldModel.moduleData[i].failsafeMode + 1;
for (int j=0; j<MAX_OUTPUT_CHANNELS; j++) {
newModel.moduleData[i].failsafeChannels[j] = oldModel.moduleData[i].failsafeChannels[j];
}
newModel.moduleData[i].ppm.delay = oldModel.moduleData[i].ppmDelay;
newModel.moduleData[i].ppm.frameLength = oldModel.moduleData[i].ppmFrameLength;
newModel.moduleData[i].ppm.pulsePol = oldModel.moduleData[i].ppmPulsePol;
}
#if defined(PCBTARANIS)
newModel.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_XJT;
#endif
newModel.moduleData[EXTERNAL_MODULE].type = oldModel.externalModule;
#if defined(PCBTARANIS)
newModel.trainerMode = oldModel.trainerMode;
// TODO 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.potsWarnMode = oldModel.nPotsToWarn >> 6;
newModel.potsWarnEnabled = oldModel.nPotsToWarn & 0x1f;
memcpy(newModel.potsWarnPosition, oldModel.potPosition, sizeof(newModel.potsWarnPosition));
}
@@ -811,7 +811,7 @@ PACK(typedef struct {
TARANIS_PCBX9E_FIELD(char bluetoothName[LEN_BLUETOOTH_NAME])
}) RadioData_v216;
void ConvertRadioData_216_to_217(RadioData & settings)
void convertRadioData_216_to_217(RadioData &settings)
{
RadioData_v216 * settings_v216 = (RadioData_v216 *)&settings;
settings_v216->version = 217;
@@ -834,7 +834,7 @@ void ConvertSpecialFunctions_217_to_218(CustomFunctionData_v218 * cf218, CustomF
}
}
void ConvertRadioData_217_to_218(RadioData & settings)
void convertRadioData_217_to_218(RadioData &settings)
{
RadioData_v216 settings_v217 = (RadioData_v216 &)settings;
@@ -893,7 +893,7 @@ void ConvertRadioData_217_to_218(RadioData & settings)
#endif
}
void ConvertModel_216_to_217(ModelData & model)
void convertModelData_216_to_217(ModelData &model)
{
// Timer3 added
// 32bits Timers
@@ -1074,7 +1074,7 @@ void ConvertModel_216_to_217(ModelData & model)
memcpy(newModel.potsWarnPosition, oldModel.potPosition, sizeof(newModel.potsWarnPosition));
}
void ConvertModel_217_to_218(ModelData & model)
void convertModelData_217_to_218(ModelData &model)
{
assert(sizeof(ModelData_v217) <= sizeof(ModelData));
@@ -1254,90 +1254,3 @@ void ConvertModel_217_to_218(ModelData & model)
newModel.toplcdTimer = oldModel.toplcdTimer;
#endif
}
void ConvertModel(int id, int version)
{
eeLoadModelData(id);
if (version == 216) {
version = 217;
ConvertModel_216_to_217(g_model);
}
if (version == 217) {
version = 218;
ConvertModel_217_to_218(g_model);
}
uint8_t currModel = g_eeGeneral.currModel;
g_eeGeneral.currModel = id;
storageDirty(EE_MODEL);
storageCheck(true);
g_eeGeneral.currModel = currModel;
}
bool eeConvert()
{
const char *msg = NULL;
if (g_eeGeneral.version == 216) {
msg = "EEprom Data v216";
}
else if (g_eeGeneral.version == 217) {
msg = "EEprom Data v217";
}
else {
return false;
}
int conversionVersionStart = g_eeGeneral.version;
// Information to the user and wait for key press
#if defined(PCBSKY9X)
g_eeGeneral.optrexDisplay = 0;
#endif
g_eeGeneral.backlightMode = e_backlight_mode_on;
g_eeGeneral.backlightBright = 0;
g_eeGeneral.contrast = 25;
ALERT(STR_STORAGE_WARNING, msg, AU_BAD_RADIODATA);
RAISE_ALERT(STR_STORAGE_WARNING, STR_EEPROM_CONVERTING, NULL, AU_NONE);
// General Settings conversion
eeLoadGeneralSettingsData();
int version = conversionVersionStart;
if (version == 216) {
version = 217;
ConvertRadioData_216_to_217(g_eeGeneral);
}
if (version == 217) {
version = 218;
ConvertRadioData_217_to_218(g_eeGeneral);
}
storageDirty(EE_GENERAL);
storageCheck(true);
#if defined(COLORLCD)
#elif LCD_W >= 212
lcdDrawRect(60, 6*FH+4, 132, 3);
#else
lcdDrawRect(10, 6*FH+4, 102, 3);
#endif
// Models conversion
for (uint8_t id=0; id<MAX_MODELS; id++) {
#if defined(COLORLCD)
#elif LCD_W >= 212
lcdDrawSolidHorizontalLine(61, 6*FH+5, 10+id*2, FORCE);
#else
lcdDrawSolidHorizontalLine(11, 6*FH+5, 10+(id*3)/2, FORCE);
#endif
lcdRefresh();
if (eeModelExists(id)) {
ConvertModel(id, conversionVersionStart);
}
}
return true;
}
@@ -1,284 +0,0 @@
int ConvertSwitch_217_to_218(int swtch)
{
// 32 additional logical switches
if (swtch < 0)
return -ConvertSwitch_217_to_218(-swtch);
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH+32)
return swtch+32;
return swtch;
}
int ConvertSource_217_to_218(int source)
{
#if defined(PCBTARANIS)
if (source >= MIXSRC_FIRST_LOGICAL_SWITCH + 32)
source += 32;
#endif
return source;
}
void ConvertSpecialFunctions_217_to_218(CustomFunctionData * cf218, CustomFunctionData_v216 * cf216)
{
for (int i=0; i<MAX_SPECIAL_FUNCTIONS; i++) {
CustomFunctionData & cf = cf218[i];
memcpy(&cf, &cf216[i], sizeof(CustomFunctionData));
cf.swtch = ConvertSwitch_217_to_218(cf216[i].swtch);
cf.func = cf216[i].func;
if (cf.func == FUNC_PLAY_VALUE || cf.func == FUNC_VOLUME || (IS_ADJUST_GV_FUNC(cf.func) && cf.all.mode == FUNC_ADJUST_GVAR_SOURCE)) {
cf.all.val = ConvertSource_217_to_218(cf.all.val);
}
}
}
void ConvertRadioData_217_to_218(RadioData & settings)
{
RadioData_v216 settings_v217 = (RadioData_v216 &)settings;
settings.version = 218;
#if !defined(PCBTARANIS)
settings.stickReverse = settings_v217.stickReverse;
#endif
settings.beepLength = settings_v217.beepLength;
settings.hapticStrength = settings_v217.hapticStrength;
settings.gpsFormat = settings_v217.gpsFormat;
settings.unexpectedShutdown = settings_v217.unexpectedShutdown;
settings.speakerPitch = settings_v217.speakerPitch;
settings.speakerVolume = settings_v217.speakerVolume;
settings.vBatMin = settings_v217.vBatMin;
settings.vBatMax = settings_v217.vBatMax;
settings.backlightBright = settings_v217.backlightBright;
settings.globalTimer = settings_v217.globalTimer;
settings.bluetoothBaudrate = settings_v217.bluetoothBaudrate;
settings.countryCode = settings_v217.countryCode;
settings.imperial = settings_v217.imperial;
settings.ttsLanguage[0] = settings_v217.ttsLanguage[0];
settings.ttsLanguage[1] = settings_v217.ttsLanguage[1];
settings.beepVolume = settings_v217.beepVolume;
settings.wavVolume = settings_v217.wavVolume;
settings.varioVolume = settings_v217.varioVolume;
settings.backgroundVolume = settings_v217.backgroundVolume;
settings.varioPitch = settings_v217.varioPitch;
settings.varioRange = settings_v217.varioRange;
settings.varioRepeat = settings_v217.varioRepeat;
ConvertSpecialFunctions_217_to_218(settings.customFn, settings_v217.customFn);
#if defined(PCBTARANIS)
settings.serial2Mode = settings_v217.serial2Mode;
settings.slidersConfig = settings_v217.slidersConfig;
settings.potsConfig = settings_v217.potsConfig;
settings.backlightColor = settings_v217.backlightColor;
settings.switchUnlockStates = settings_v217.switchUnlockStates;
settings.switchConfig = settings_v217.switchConfig;
memcpy(settings.switchNames, settings_v217.switchNames, sizeof(settings.switchNames));
memcpy(settings.anaNames, settings_v217.anaNames, sizeof(settings.anaNames));
#endif
#if defined(PCBX9E)
memcpy(settings.bluetoothName, settings_v217.bluetoothName, sizeof(settings.bluetoothName));
#endif
#if defined(PCBSKY9X)
settings.txCurrentCalibration = settings_v217.txCurrentCalibration;
settings.temperatureWarn = settings_v217.temperatureWarn;
settings.mAhWarn = settings_v217.mAhWarn;
settings.mAhUsed = settings_v217.mAhUsed;
settings.temperatureCalib = settings_v217.temperatureCalib;
settings.optrexDisplay = settings_v217.optrexDisplay;
settings.sticksGain = settings_v217.sticksGain;
settings.rotarySteps = settings_v217.rotarySteps;
#endif
}
void ConvertModel_217_to_218(ModelData & model)
{
assert(sizeof(ModelData_v217) <= sizeof(ModelData));
ModelData_v217 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 v217 to v218", name);
newModel.header = oldModel.header;
for (uint8_t i=0; i<MAX_TIMERS; i++) {
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
newModel.timers[i].mode = TMRMODE_COUNT + ConvertSwitch_217_to_218(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
else
newModel.timers[i].mode = ConvertSwitch_217_to_218(oldModel.timers[i].mode);
if (oldModel.timers[i].mode)
TRACE("timer mode %d => %d", oldModel.timers[i].mode, newModel.timers[i].mode);
newModel.timers[i].start = oldModel.timers[i].start;
newModel.timers[i].value = oldModel.timers[i].value;
newModel.timers[i].countdownBeep = oldModel.timers[i].countdownBeep;
newModel.timers[i].minuteBeep = oldModel.timers[i].minuteBeep;
newModel.timers[i].persistent = oldModel.timers[i].persistent;
memcpy(newModel.timers[i].name, oldModel.timers[i].name, sizeof(newModel.timers[i].name));
}
newModel.telemetryProtocol = oldModel.telemetryProtocol;
newModel.thrTrim = oldModel.thrTrim;
newModel.noGlobalFunctions = oldModel.noGlobalFunctions;
newModel.displayTrims = oldModel.displayTrims;
newModel.ignoreSensorIds = oldModel.ignoreSensorIds;
newModel.trimInc = oldModel.trimInc;
newModel.disableThrottleWarning = oldModel.disableThrottleWarning;
newModel.displayChecklist = oldModel.displayChecklist;
newModel.extendedLimits = oldModel.extendedLimits;
newModel.extendedTrims = oldModel.extendedTrims;
newModel.throttleReversed = oldModel.throttleReversed;
newModel.beepANACenter = oldModel.beepANACenter;
for (int i=0; i<MAX_MIXERS; i++) {
newModel.mixData[i].destCh = oldModel.mixData[i].destCh;
newModel.mixData[i].flightModes = oldModel.mixData[i].flightModes;
newModel.mixData[i].mltpx = oldModel.mixData[i].mltpx;
newModel.mixData[i].carryTrim = oldModel.mixData[i].carryTrim;
newModel.mixData[i].mixWarn = oldModel.mixData[i].mixWarn;
newModel.mixData[i].weight = oldModel.mixData[i].weight;
newModel.mixData[i].swtch = ConvertSwitch_217_to_218(oldModel.mixData[i].swtch);
#if defined(PCBTARANIS)
newModel.mixData[i].curve = oldModel.mixData[i].curve;
#else
// newModel.mixData[i].curveMode = oldModel.mixData[i].curveMode;
// newModel.mixData[i].noExpo = oldModel.mixData[i].noExpo;
// newModel.mixData[i].curveParam = oldModel.mixData[i].curveParam;
#endif
newModel.mixData[i].delayUp = oldModel.mixData[i].delayUp;
newModel.mixData[i].delayDown = oldModel.mixData[i].delayDown;
newModel.mixData[i].speedUp = oldModel.mixData[i].speedUp;
newModel.mixData[i].speedDown = oldModel.mixData[i].speedDown;
newModel.mixData[i].srcRaw = ConvertSource_217_to_218(oldModel.mixData[i].srcRaw);
newModel.mixData[i].offset = oldModel.mixData[i].offset;
memcpy(newModel.mixData[i].name, oldModel.mixData[i].name, sizeof(newModel.mixData[i].name));
}
for (int i=0; i<MAX_OUTPUT_CHANNELS; i++) {
newModel.limitData[i] = oldModel.limitData[i];
#if defined(PCBTARANIS)
if (newModel.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT || newModel.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_XJT) {
newModel.limitData[i].ppmCenter = (oldModel.limitData[i].ppmCenter * 612) / 1024;
}
#endif
}
for (int i=0; i<MAX_EXPOS; i++) {
#if defined(PCBTARANIS)
newModel.expoData[i].srcRaw = ConvertSource_217_to_218(oldModel.expoData[i].srcRaw);
newModel.expoData[i].scale = oldModel.expoData[i].scale;
newModel.expoData[i].carryTrim = oldModel.expoData[i].carryTrim;
newModel.expoData[i].curve = oldModel.expoData[i].curve;
newModel.expoData[i].offset = oldModel.expoData[i].offset;
#else
// TODO newModel.expoData[i].curveMode = oldModel.expoData[i].curveMode;
// TODO newModel.expoData[i].curveParam = oldModel.expoData[i].curveParam;
#endif
newModel.expoData[i].chn = oldModel.expoData[i].chn;
newModel.expoData[i].swtch = ConvertSwitch_217_to_218(oldModel.expoData[i].swtch);
newModel.expoData[i].flightModes = oldModel.expoData[i].flightModes;
newModel.expoData[i].weight = oldModel.expoData[i].weight;
newModel.expoData[i].mode = oldModel.expoData[i].mode;
memcpy(newModel.expoData[i].name, oldModel.expoData[i].name, sizeof(newModel.expoData[i].name));
}
for (int i=0; i<MAX_CURVES; i++) {
#if defined(PCBTARANIS)
newModel.curves[i].type = oldModel.curves[i].type;
newModel.curves[i].smooth = oldModel.curves[i].smooth;
newModel.curves[i].points = oldModel.curves[i].points;
memcpy(newModel.curves[i].name, oldModel.curveNames[i], sizeof(newModel.curves[i].name));
#else
// TODO newModel.curves[i] = oldModel.curves[i];
#endif
}
memcpy(newModel.points, oldModel.points, sizeof(newModel.points));
for (int i=0; i<32; i++) {
LogicalSwitchData & sw = newModel.logicalSw[i];
sw.func = oldModel.logicalSw[i].func;
sw.v1 = oldModel.logicalSw[i].v1;
sw.v2 = oldModel.logicalSw[i].v2;
sw.v3 = oldModel.logicalSw[i].v3;
newModel.logicalSw[i].andsw = ConvertSwitch_217_to_218(oldModel.logicalSw[i].andsw);
sw.delay = oldModel.logicalSw[i].delay;
sw.duration = oldModel.logicalSw[i].duration;
uint8_t cstate = lswFamily(sw.func);
if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_COMP || cstate == LS_FAMILY_DIFF) {
sw.v1 = ConvertSource_217_to_218((uint8_t)sw.v1);
if (cstate == LS_FAMILY_COMP) {
sw.v2 = ConvertSource_217_to_218((uint8_t)sw.v2);
}
}
else if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
sw.v1 = ConvertSwitch_217_to_218(sw.v1);
sw.v2 = ConvertSwitch_217_to_218(sw.v2);
}
else if (cstate == LS_FAMILY_EDGE) {
sw.v1 = ConvertSwitch_217_to_218(sw.v1);
}
}
ConvertSpecialFunctions_217_to_218(newModel.customFn, oldModel.customFn);
newModel.swashR = oldModel.swashR;
for (int i=0; i<MAX_FLIGHT_MODES; i++) {
memcpy(newModel.flightModeData[i].trim, oldModel.flightModeData[i].trim, sizeof(newModel.flightModeData[i].trim));
memcpy(newModel.flightModeData[i].name, oldModel.flightModeData[i].name, sizeof(newModel.flightModeData[i].name));
newModel.flightModeData[i].swtch = ConvertSwitch_217_to_218(oldModel.flightModeData[i].swtch);
newModel.flightModeData[i].fadeIn = oldModel.flightModeData[i].fadeIn;
newModel.flightModeData[i].fadeOut = oldModel.flightModeData[i].fadeOut;
#if defined(PCBSKY9X)
memcpy(newModel.flightModeData[i].rotaryEncoders, oldModel.flightModeData[i].rotaryEncoders, sizeof(newModel.flightModeData[i].rotaryEncoders));
#endif
memcpy(newModel.flightModeData[i].gvars, oldModel.flightModeData[i].gvars, sizeof(newModel.flightModeData[i].gvars));
}
newModel.thrTraceSrc = oldModel.thrTraceSrc;
newModel.switchWarningState = oldModel.switchWarningState;
newModel.switchWarningEnable = oldModel.switchWarningEnable;
for (int i=0; i<MAX_GVARS; i++) {
memcpy(newModel.gvars[i].name, oldModel.gvars[i].name, sizeof(newModel.gvars[i].name));
newModel.gvars[i].popup = oldModel.gvars[i].popup;
}
newModel.frsky = oldModel.frsky;
for (int i=0; i<MAX_TELEMETRY_SCREENS; i++) {
if (((oldModel.frsky.screensType >> (2*i)) & 0x03) == TELEMETRY_SCREEN_TYPE_VALUES) {
for (int j = 0; j < 4; j++) {
for (int k = 0; k < NUM_LINE_ITEMS; k++) {
newModel.frsky.screens[i].lines[j].sources[k] = ConvertSource_217_to_218(oldModel.frsky.screens[i].lines[j].sources[k]);
}
}
}
else if (((oldModel.frsky.screensType >> (2*i)) & 0x03) == TELEMETRY_SCREEN_TYPE_GAUGES) {
for (int j = 0; j < 4; j++) {
newModel.frsky.screens[i].bars[j].source = ConvertSource_217_to_218(oldModel.frsky.screens[i].bars[j].source);
}
}
}
for (int i=0; i<NUM_MODULES+1; i++) {
// newModel.moduleData[i] = oldModel.moduleData[i];
#warning "Conversion from v217 to v218 is broken"
}
#if defined(PCBTARANIS)
newModel.trainerData.mode = oldModel.trainerMode;
memcpy(newModel.scriptsData, oldModel.scriptsData, sizeof(newModel.scriptsData));
memcpy(newModel.inputNames, oldModel.inputNames, sizeof(newModel.inputNames));
#endif
newModel.potsWarnMode = oldModel.potsWarnMode;
newModel.potsWarnEnabled = oldModel.potsWarnEnabled;
memcpy(newModel.potsWarnPosition, oldModel.potsWarnPosition, sizeof(newModel.potsWarnPosition));
for (uint8_t i=0; i<MAX_TELEMETRY_SENSORS; i++) {
newModel.telemetrySensors[i] = oldModel.telemetrySensors[i];
if (newModel.telemetrySensors[i].unit > UNIT_WATTS)
newModel.telemetrySensors[i].unit += 1;
}
#if defined(PCBX9E)
newModel.toplcdTimer = oldModel.toplcdTimer;
#endif
}
@@ -1,675 +0,0 @@
#include "definitions.h"
#include "board.h"
#define NUM_STICKS 4
#define XPOTS_MULTIPOS_COUNT 6
#define MAX_SCRIPT_INPUTS 10
#define MAX_SCRIPT_OUTPUTS 6
#define MAX_GVARS 9
#if defined(PCBHORUS)
#define MAX_MODELS 60
#define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
#define MAX_FLIGHT_MODES 9
#define MAX_MIXERS 64
#define MAX_EXPOS 64
#define MAX_LOGICAL_SWITCHES 64
#define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
#define MAX_SCRIPTS 9
#define MAX_INPUTS 32
#define MAX_TRAINER_CHANNELS 16
#define MAX_TELEMETRY_SENSORS 32
#define MAX_CUSTOM_SCREENS 5
#elif defined(PCBTARANIS)
#define MAX_MODELS 60
#define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
#define MAX_FLIGHT_MODES 9
#define MAX_MIXERS 64
#define MAX_EXPOS 64
#define MAX_LOGICAL_SWITCHES 64
#define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
#define MAX_SCRIPTS 7
#define MAX_INPUTS 32
#define MAX_TRAINER_CHANNELS 16
#define MAX_TELEMETRY_SENSORS 32
#else
#define MAX_MODELS 60
#define MAX_OUTPUT_CHANNELS 32 // number of real output channels CH1-CH32
#define MAX_FLIGHT_MODES 9
#define MAX_MIXERS 64
#define MAX_EXPOS 32
#define MAX_LOGICAL_SWITCHES 64
#define MAX_SPECIAL_FUNCTIONS 64 // number of functions assigned to switches
#define MAX_INPUTS 32
#define MAX_TRAINER_CHANNELS 16
#define MAX_TELEMETRY_SENSORS 32
#endif
#if defined(PCBHORUS)
#define LEN_SWITCH_NAME 3
#define LEN_ANA_NAME 3
#define LEN_MODEL_FILENAME 16
#define LEN_BLUETOOTH_NAME 10
#else
#define LEN_SWITCH_NAME 3
#define LEN_ANA_NAME 3
#define LEN_BLUETOOTH_NAME 10
#endif
#if defined(PCBHORUS)
#define LEN_MODEL_NAME 15
#define LEN_TIMER_NAME 8
#define LEN_FLIGHT_MODE_NAME 10
#define LEN_BITMAP_NAME 10 // TODO next EEPROM change: we need 14 here as we have to store the file extension
#define LEN_EXPOMIX_NAME 6
#define LEN_CHANNEL_NAME 6
#define LEN_INPUT_NAME 4
#define LEN_CURVE_NAME 3
#define LEN_FUNCTION_NAME 6
#define MAX_CURVES 32
#define MAX_CURVE_POINTS 512
#elif LCD_W == 212
#define LEN_MODEL_NAME 12
#define LEN_TIMER_NAME 8
#define LEN_FLIGHT_MODE_NAME 10
#define LEN_BITMAP_NAME 10
#define LEN_EXPOMIX_NAME 8 // TODO next EEPROM change: 6 seem enough
#define LEN_CHANNEL_NAME 6
#define LEN_INPUT_NAME 4
#define LEN_CURVE_NAME 3
#define LEN_FUNCTION_NAME 8
#define MAX_CURVES 32
#define MAX_CURVE_POINTS 512
#else
#define LEN_MODEL_NAME 10
#define LEN_TIMER_NAME 3
#define LEN_FLIGHT_MODE_NAME 6
#define LEN_EXPOMIX_NAME 6
#define LEN_CHANNEL_NAME 4
#define LEN_INPUT_NAME 3
#define LEN_CURVE_NAME 3
#define LEN_FUNCTION_NAME 6
#define MAX_CURVES 16 // TODO next EEPROM check if can be changed to 32 to have all ARM the same
#define MAX_CURVE_POINTS 512
#endif
enum TelemetrySource {
TELEM_NONE,
TELEM_TX_VOLTAGE,
TELEM_TX_TIME,
TELEM_RESERVE1,
TELEM_RESERVE2,
TELEM_RESERVE3,
TELEM_RESERVE4,
TELEM_RESERVE5,
TELEM_TIMER1,
TELEM_TIMER2,
TELEM_SWR,
TELEM_RSSI_TX,
TELEM_RSSI_RX,
TELEM_RESERVE0,
TELEM_A_FIRST,
TELEM_A1=TELEM_A_FIRST,
TELEM_A2,
TELEM_A3,
TELEM_A4,
TELEM_A_LAST=TELEM_A4,
TELEM_ALT,
TELEM_RPM,
TELEM_FUEL,
TELEM_T1,
TELEM_T2,
TELEM_SPEED,
TELEM_DIST,
TELEM_GPSALT,
TELEM_CELL,
TELEM_CELLS_SUM,
TELEM_VFAS,
TELEM_CURRENT,
TELEM_CONSUMPTION,
TELEM_POWER,
TELEM_ACCx,
TELEM_ACCy,
TELEM_ACCz,
TELEM_HDG,
TELEM_VSPEED,
TELEM_ASPEED,
TELEM_DTE,
TELEM_RESERVE6,
TELEM_RESERVE7,
TELEM_RESERVE8,
TELEM_RESERVE9,
TELEM_RESERVE10,
TELEM_MIN_A_FIRST,
TELEM_MIN_A1=TELEM_MIN_A_FIRST,
TELEM_MIN_A2,
TELEM_MIN_A3,
TELEM_MIN_A4,
TELEM_MIN_A_LAST=TELEM_MIN_A4,
// TODO: add A1-4 MAX
TELEM_MIN_ALT,
TELEM_MAX_ALT,
TELEM_MAX_RPM,
TELEM_MAX_T1,
TELEM_MAX_T2,
TELEM_MAX_SPEED,
TELEM_MAX_DIST,
TELEM_MAX_ASPEED,
TELEM_MIN_CELL,
TELEM_MIN_CELLS_SUM,
TELEM_MIN_VFAS,
TELEM_MAX_CURRENT,
TELEM_MAX_POWER,
TELEM_RESERVE11,
TELEM_RESERVE12,
TELEM_RESERVE13,
TELEM_RESERVE14,
TELEM_RESERVE15,
TELEM_ACC,
TELEM_GPS_TIME,
TELEM_CSW_MAX = TELEM_MAX_POWER,
TELEM_NOUSR_MAX = TELEM_A2,
TELEM_DISPLAY_MAX = TELEM_MAX_POWER,
TELEM_STATUS_MAX = TELEM_GPS_TIME,
TELEM_FIRST_STREAMED_VALUE = TELEM_RSSI_TX,
};
#define NUM_TELEMETRY TELEM_CSW_MAX
#if defined(PCBTARANIS)
enum CurveType {
CURVE_TYPE_STANDARD,
CURVE_TYPE_CUSTOM,
CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
};
PACK(typedef struct {
uint8_t type:3;
uint8_t smooth:1;
uint8_t spare:4;
int8_t points;
}) CurveInfo;
#define NUM_POINTS 512
#define CURVDATA CurveInfo
#else
#define LEN_MODEL_NAME 10
#define LEN_EXPOMIX_NAME 6
#define LEN_FP_NAME 6
#define NUM_POINTS 512
#define CURVDATA int16_t
#endif
#if defined(PCBTARANIS)
enum CurveRefType {
CURVE_REF_DIFF,
CURVE_REF_EXPO,
CURVE_REF_FUNC,
CURVE_REF_CUSTOM
};
PACK(typedef struct {
uint8_t type;
int8_t value;
}) CurveRef;
#else
#define MODE_DIFFERENTIAL 0
#define MODE_EXPO 0
#define MODE_CURVE 1
#endif
#if defined(PCBTARANIS)
PACK(typedef struct {
uint8_t srcRaw;
uint16_t scale;
uint8_t chn;
int8_t swtch;
uint16_t flightModes;
int8_t weight;
int8_t carryTrim:6;
uint8_t mode:2;
char name[LEN_EXPOMIX_NAME];
int8_t offset;
CurveRef curve;
uint8_t spare;
}) ExpoData_v216;
#else
PACK(typedef struct {
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
uint8_t chn:4;
uint8_t curveMode:2;
int8_t swtch;
uint16_t flightModes;
int8_t weight;
char name[LEN_EXPOMIX_NAME];
int8_t curveParam;
}) ExpoData_v216;
typedef ExpoData_v216;
#endif
#if defined(PCBTARANIS)
PACK(typedef struct {
int16_t min;
int16_t max;
int8_t ppmCenter;
int16_t offset:14;
uint16_t symetrical:1;
uint16_t revert:1;
char name[LEN_CHANNEL_NAME];
int8_t curve;
}) LimitData_v216;
#else
PACK(struct LimitData {
int32_t min:11;
int32_t max:11;
int32_t ppmCenter:10;
int16_t offset:11;
uint16_t symetrical:1;
uint16_t revert:1;
uint16_t spare:3;
int8_t curve;
NOBACKUP(char name[LEN_CHANNEL_NAME]);
});
#endif
PACK(typedef struct {
uint8_t type:3;
uint8_t smooth:1;
uint8_t spare:4;
int8_t points;
}) CurveData_v216;
#if defined(PCBTARANIS)
PACK(typedef struct {
uint8_t destCh;
uint16_t flightModes;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
uint8_t carryTrim:1;
uint8_t spare1:5;
int16_t weight;
int8_t swtch;
CurveRef curve;
uint8_t mixWarn:4; // mixer warning
uint8_t spare2:4;
uint8_t delayUp;
uint8_t delayDown;
uint8_t speedUp;
uint8_t speedDown;
uint8_t srcRaw;
int16_t offset;
char name[LEN_EXPOMIX_NAME];
uint8_t spare3;
}) MixData_v216;
#else
PACK(typedef struct {
uint8_t destCh:5;
uint8_t mixWarn:3; // mixer warning
uint16_t flightModes;
uint8_t curveMode:1;
uint8_t noExpo:1;
int8_t carryTrim:3;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
uint8_t spare:1;
int16_t weight;
int8_t swtch;
int8_t curveParam;
uint8_t delayUp;
uint8_t delayDown;
uint8_t speedUp;
uint8_t speedDown;
uint8_t srcRaw;
int16_t offset;
char name[LEN_EXPOMIX_NAME];
}) MixData_v216;
#endif
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[NUM_STICKS];
int8_t swtch; // swtch of phase[0] is not used
char name[LEN_FLIGHT_MODE_NAME];
uint8_t fadeIn;
uint8_t fadeOut;
int16_t rotaryEncoders[1];
int16_t gvars[9];
}) FlightModeData_v216;
PACK(typedef struct { // Logical Switches data
int8_t v1;
int16_t v2;
int16_t v3;
uint8_t func;
uint8_t delay;
uint8_t duration;
int8_t andsw;
}) LogicalSwitchData_v216;
#if defined(PCBTARANIS)
PACK(typedef struct {
int8_t swtch;
uint8_t func;
PACK(union {
PACK(struct {
char name[8];
}) play;
PACK(struct {
int16_t val;
uint8_t mode;
uint8_t param;
int32_t spare2;
}) all;
PACK(struct {
int32_t val1;
int32_t val2;
}) clear;
});
uint8_t active;
}) CustomFunctionData_v216;
#else
PACK(typedef struct {
int8_t swtch;
uint8_t func;
PACK(union {
PACK(struct {
char name[6];
}) play;
PACK(struct {
int16_t val;
uint8_t mode;
uint8_t param;
int16_t spare2;
}) all;
PACK(struct {
int32_t val1;
int16_t val2;
}) clear;
});
uint8_t active;
}) CustomFunctionData_v216;
#endif
PACK(typedef struct {
uint8_t source;
uint8_t barMin; // minimum for bar display
uint8_t barMax; // ditto for max display (would usually = ratio)
}) FrSkyBarData_v216;
#if LCD_W >= 212
#define NUM_LINE_ITEMS 3
#else
#define NUM_LINE_ITEMS 2
#endif
PACK(typedef struct {
uint8_t sources[NUM_LINE_ITEMS];
}) FrSkyLineData_v216;
typedef union {
FrSkyBarData_v216 bars[4];
FrSkyLineData_v216 lines[4];
} FrSkyScreenData_v216;
PACK(struct FrSkyChannelData_v216 {
uint8_t unused[7];
});
PACK(typedef struct {
FrSkyChannelData_v216 channels[4];
uint8_t usrProto; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh, 3=Halcyon
uint8_t voltsSource:7;
uint8_t altitudeDisplayed:1;
int8_t blades; // How many blades for RPMs, 0=2 blades
uint8_t currentSource;
uint8_t screensType; // 2bits per screen (None/Gauges/Numbers/Script)
FrSkyScreenData_v216 screens[3];
uint8_t varioSource;
int8_t varioCenterMax;
int8_t varioCenterMin;
int8_t varioMin;
int8_t varioMax;
uint8_t rssiAlarms[2];
uint16_t mAhPersistent:1;
uint16_t storedMah:15;
int8_t fasOffset;
}) FrSkyData_v216;
PACK(typedef struct {
char file[10];
char name[10];
int8_t inputs[10];
}) ScriptData_v216;
PACK(typedef struct { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
}) SwashRingData_v216;
PACK(typedef struct {
int8_t rfProtocol;
uint8_t channelsStart;
int8_t channelsCount; // 0=8 channels
uint8_t failsafeMode;
int16_t failsafeChannels[MAX_OUTPUT_CHANNELS];
int8_t ppmDelay;
int8_t ppmFrameLength;
uint8_t ppmPulsePol;
}) ModuleData_v216;
#if defined(PCBTARANIS) && LCD_W >= 212
PACK(typedef struct {
char name[LEN_MODEL_NAME];
uint8_t modelId;
char bitmap[LEN_BITMAP_NAME];
}) ModelHeader_v216;
#else
PACK(typedef struct {
char name[LEN_MODEL_NAME];
uint8_t modelId;
}) ModelHeader_v216;
#endif
PACK(struct GVarData {
char name[3];
uint32_t min:12;
uint32_t max:12;
uint32_t popup:1;
uint32_t prec:1;
uint32_t unit:2;
uint32_t spare:4;
});
PACK(typedef struct {
ModelHeader_v216 header;
TimerData_v216 timers[2];
uint8_t telemetryProtocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t spare2:4;
int8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t displayChecklist:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t throttleReversed:1;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
MixData_v216 mixData[MAX_MIXERS];
LimitData_v216 limitData[MAX_OUTPUT_CHANNELS];
ExpoData_v216 expoData[MAX_EXPOS];
CurveData_v216 curves[MAX_CURVES];
int8_t points[MAX_CURVE_POINTS];
LogicalSwitchData_v216 logicalSw[32];
CustomFunctionData_v216 customFn[MAX_SPECIAL_FUNCTIONS];
SwashRingData_v216 swashR;
FlightModeData_v216 flightModeData[MAX_FLIGHT_MODES];
uint8_t thrTraceSrc;
uint16_t switchWarningState;
uint8_t switchWarningEnable;
GVarData gvars[MAX_GVARS];
FrSkyData_v216 frsky;
uint8_t externalModule;
#if defined(PCBTARANIS)
uint8_t trainerMode;
#endif
ModuleData_v216 moduleData[2 + 1];
#if defined(PCBTARANIS)
char curveNames[MAX_CURVES][6];
ScriptData_v216 scriptsData[MAX_SCRIPTS];
char inputNames[MAX_INPUTS][LEN_INPUT_NAME];
#endif
uint8_t nPotsToWarn;
int8_t potPosition[NUM_POTS+NUM_SLIDERS];
uint8_t rxBattAlarms[2];
}) ModelData_v216;
PACK(struct CalibData {
int16_t mid;
int16_t spanNeg;
int16_t spanPos;
});
PACK(struct TrainerMix {
uint8_t srcChn:6; // 0-7 = ch1-8
uint8_t mode:2; // off,add-mode,subst-mode
int8_t studWeight;
});
PACK(struct TrainerData {
int16_t calib[4];
TrainerMix mix[4];
});
#if defined(COLORLCD)
typedef uint16_t swconfig_t;
typedef uint32_t swarnstate_t;
#elif defined(PCBX9E)
typedef uint64_t swconfig_t;
typedef uint64_t swarnstate_t;
typedef uint32_t swarnenable_t;
#elif defined(PCBTARANIS)
typedef uint16_t swconfig_t;
typedef uint16_t swarnstate_t;
typedef uint8_t swarnenable_t;
#else
typedef uint8_t swarnstate_t;
typedef uint8_t swarnenable_t;
#endif
PACK(typedef struct {
uint8_t version;
uint16_t variant;
CalibData calib[NUM_STICKS+NUM_POTS+NUM_SLIDERS];
uint16_t chkSum;
int8_t currModel;
uint8_t contrast;
uint8_t vBatWarn;
int8_t txVoltageCalibration;
int8_t backlightMode;
TrainerData trainer;
uint8_t view; // index of view in main screen
int8_t buzzerMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
uint8_t fai:1;
int8_t beepMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
uint8_t alarmsFlash:1;
uint8_t disableMemoryWarning:1;
uint8_t disableAlarmWarning:1;
uint8_t stickMode:2;
int8_t timezone:5;
uint8_t adjustRTC:1;
uint8_t inactivityTimer;
uint8_t telemetryBaudrate:3;
int8_t splashMode:3;
int8_t hapticMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
int8_t switchesDelay;
uint8_t lightAutoOff;
uint8_t templateSetup; // RETA order for receiver channels
int8_t PPM_Multiplier;
int8_t hapticLength;
uint8_t reNavigation;
#if !defined(PCBTARANIS)
uint8_t stickReverse;
#endif
int8_t beepLength:3;
int8_t hapticStrength:3;
uint8_t gpsFormat:1;
uint8_t unexpectedShutdown:1;
uint8_t speakerPitch;
int8_t speakerVolume;
int8_t vBatMin;
int8_t vBatMax;
uint8_t backlightBright;
int8_t txCurrentCalibration;
int8_t temperatureWarn;
uint8_t mAhWarn;
uint16_t mAhUsed;
uint32_t globalTimer;
int8_t temperatureCalib;
uint8_t bluetoothBaudrate;
uint8_t optrexDisplay;
uint8_t sticksGain;
uint8_t rotarySteps;
uint8_t countryCode;
uint8_t imperial;
char ttsLanguage[2];
int8_t beepVolume;
int8_t wavVolume;
int8_t varioVolume;
int8_t varioPitch;
int8_t varioRange;
int8_t varioRepeat;
int8_t backgroundVolume;
#if defined(PCBTARANIS)
uint8_t serial2Mode:6;
uint8_t slidersConfig:2;
uint8_t potsConfig;
uint8_t backlightColor;
swarnstate_t switchUnlockStates;
CustomFunctionData_v216 customFn[MAX_SPECIAL_FUNCTIONS];
swconfig_t switchConfig;
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME];
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS][LEN_ANA_NAME];
#else
CustomFunctionData_v216 customFn[MAX_SPECIAL_FUNCTIONS];
#endif
#if defined(PCBX9E)
uint8_t bluetoothEnable;
char bluetoothName[LEN_BLUETOOTH_NAME];
#endif
}) RadioData_v216;
@@ -1,362 +0,0 @@
enum Mix216Sources {
MIXSRC216_NONE,
#if defined(PCBTARANIS)
MIXSRC216_FIRST_INPUT,
MIXSRC216_LAST_INPUT = MIXSRC216_FIRST_INPUT+MAX_INPUTS-1,
MIXSRC216_FIRST_LUA,
MIXSRC216_LAST_LUA = MIXSRC216_FIRST_LUA+(MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS)-1,
#endif
MIXSRC216_Rud,
MIXSRC216_Ele,
MIXSRC216_Thr,
MIXSRC216_Ail,
MIXSRC216_FIRST_POT,
#if defined(PCBTARANIS)
MIXSRC216_POT1 = MIXSRC216_FIRST_POT,
MIXSRC216_POT2,
MIXSRC216_POT3,
MIXSRC216_SLIDER1,
MIXSRC216_SLIDER2,
MIXSRC216_LAST_POT = MIXSRC216_SLIDER2,
#else
MIXSRC216_P1 = MIXSRC216_FIRST_POT,
MIXSRC216_P2,
MIXSRC216_P3,
MIXSRC216_LAST_POT = MIXSRC216_P3,
#endif
#if defined(PCBSKY9X)
MIXSRC216_REa,
MIXSRC216_LAST_ROTARY_ENCODER = MIXSRC216_REa,
#endif
MIXSRC216_MAX,
MIXSRC216_CYC1,
MIXSRC216_CYC2,
MIXSRC216_CYC3,
MIXSRC216_TrimRud,
MIXSRC216_TrimEle,
MIXSRC216_TrimThr,
MIXSRC216_TrimAil,
MIXSRC216_FIRST_SWITCH,
#if defined(PCBTARANIS)
MIXSRC216_SA = MIXSRC216_FIRST_SWITCH,
MIXSRC216_SB,
MIXSRC216_SC,
MIXSRC216_SD,
MIXSRC216_SE,
MIXSRC216_SF,
MIXSRC216_SG,
MIXSRC216_SH,
#else
MIXSRC216_3POS = MIXSRC216_FIRST_SWITCH,
MIXSRC216_THR,
MIXSRC216_RUD,
MIXSRC216_ELE,
MIXSRC216_AIL,
MIXSRC216_GEA,
MIXSRC216_TRN,
#endif
MIXSRC216_FIRST_LOGICAL_SWITCH,
MIXSRC216_SW1 = MIXSRC216_FIRST_LOGICAL_SWITCH,
MIXSRC216_SW9 = MIXSRC216_SW1 + 8,
MIXSRC216_SWA,
MIXSRC216_SWB,
MIXSRC216_SWC,
MIXSRC216_LAST_LOGICAL_SWITCH = MIXSRC216_FIRST_LOGICAL_SWITCH+32-1,
MIXSRC216_FIRST_TRAINER,
MIXSRC216_LAST_TRAINER = MIXSRC216_FIRST_TRAINER+MAX_TRAINER_CHANNELS-1,
MIXSRC216_FIRST_CH,
MIXSRC216_CH1 = MIXSRC216_FIRST_CH,
MIXSRC216_CH2,
MIXSRC216_CH3,
MIXSRC216_CH4,
MIXSRC216_CH5,
MIXSRC216_CH6,
MIXSRC216_CH7,
MIXSRC216_CH8,
MIXSRC216_CH9,
MIXSRC216_CH10,
MIXSRC216_CH11,
MIXSRC216_CH12,
MIXSRC216_CH13,
MIXSRC216_CH14,
MIXSRC216_CH15,
MIXSRC216_CH16,
MIXSRC216_LAST_CH = MIXSRC216_CH1+MAX_OUTPUT_CHANNELS-1,
MIXSRC216_GVAR1,
MIXSRC216_LAST_GVAR = MIXSRC216_GVAR1+MAX_GVARS-1,
MIXSRC216_FIRST_TELEM,
};
enum Telemetry216Source {
TELEM216_NONE,
TELEM216_TX_VOLTAGE,
TELEM216_TX_TIME,
TELEM216_RESERVE1,
TELEM216_RESERVE2,
TELEM216_RESERVE3,
TELEM216_RESERVE4,
TELEM216_RESERVE5,
TELEM216_TIMER1,
TELEM216_TIMER2,
TELEM216_SWR,
TELEM216_RSSI_TX,
TELEM216_RSSI_RX,
TELEM216_RESERVE0,
TELEM216_A1,
TELEM216_A2,
TELEM216_A3,
TELEM216_A4,
TELEM216_ALT,
TELEM216_RPM,
TELEM216_FUEL,
TELEM216_T1,
TELEM216_T2,
TELEM216_SPEED,
TELEM216_DIST,
TELEM216_GPSALT,
TELEM216_CELL,
TELEM216_CELLS_SUM,
TELEM216_VFAS,
TELEM216_CURRENT,
TELEM216_CONSUMPTION,
TELEM216_POWER,
TELEM216_ACCx,
TELEM216_ACCy,
TELEM216_ACCz,
TELEM216_HDG,
TELEM216_VSPEED,
TELEM216_ASPEED,
TELEM216_DTE,
TELEM216_RESERVE6,
TELEM216_RESERVE7,
TELEM216_RESERVE8,
TELEM216_RESERVE9,
TELEM216_RESERVE10,
TELEM216_MIN_A1,
TELEM216_MIN_A2,
TELEM216_MIN_A3,
TELEM216_MIN_A4,
TELEM216_MIN_ALT,
TELEM216_MAX_ALT,
TELEM216_MAX_RPM,
TELEM216_MAX_T1,
TELEM216_MAX_T2,
TELEM216_MAX_SPEED,
TELEM216_MAX_DIST,
TELEM216_MAX_ASPEED,
TELEM216_MIN_CELL,
TELEM216_MIN_CELLS_SUM,
TELEM216_MIN_VFAS,
TELEM216_MAX_CURRENT,
TELEM216_MAX_POWER,
TELEM216_RESERVE11,
TELEM216_RESERVE12,
TELEM216_RESERVE13,
TELEM216_RESERVE14,
TELEM216_RESERVE15,
TELEM216_ACC,
TELEM216_GPS_TIME,
};
#if defined(PCBTARANIS)
PACK(typedef struct {
uint32_t srcRaw:10;
uint32_t scale:14;
uint32_t chn:8;
int8_t swtch;
uint16_t flightModes;
int8_t weight;
int8_t carryTrim:6;
uint8_t mode:2;
char name[LEN_EXPOMIX_NAME];
int8_t offset;
CurveRef curve;
}) ExpoData_v217;
#else
PACK(typedef struct {
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
uint8_t chn:4;
uint8_t curveMode:2;
int8_t swtch;
uint16_t flightModes;
int8_t weight;
char name[LEN_EXPOMIX_NAME];
int8_t curveParam;
}) ExpoData_v216;
typedef ExpoData_v217;
#endif
#if defined(PCBTARANIS)
PACK(typedef struct {
uint8_t destCh;
uint16_t flightModes:9;
uint16_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
uint16_t carryTrim:1;
uint16_t mixWarn:4; // mixer warning
int16_t weight;
uint32_t srcRaw:10;
int32_t offset:14;
int32_t swtch:8;
CurveRef curve;
uint8_t delayUp;
uint8_t delayDown;
uint8_t speedUp;
uint8_t speedDown;
char name[LEN_EXPOMIX_NAME];
}) MixData_v217;
#else
PACK(struct CurveRef {
uint8_t type;
int8_t value;
});
PACK(struct MixData {
int16_t weight:11; // GV1=-1024, -GV1=1023
uint16_t destCh:5;
uint16_t srcRaw:10; // srcRaw=0 means not used
uint16_t carryTrim:1;
uint16_t mixWarn:2; // mixer warning
uint16_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
uint16_t spare:1;
int32_t offset:14;
int32_t swtch:9;
uint32_t flightModes:9;
CurveRef curve;
uint8_t delayUp;
uint8_t delayDown;
uint8_t speedUp;
uint8_t speedDown;
NOBACKUP(char name[LEN_EXPOMIX_NAME]);
});
#endif
PACK(typedef struct {
int32_t mode:8; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint32_t start:24;
int32_t value:24;
uint32_t countdownBeep:2;
uint32_t minuteBeep:1;
uint32_t persistent:2;
uint32_t spare:3;
char name[LEN_TIMER_NAME];
}) TimerData_v217;
PACK(typedef struct { // Logical Switches data
uint16_t func:6;
int16_t v1:10;
int16_t v2;
int16_t v3;
uint8_t delay;
uint8_t duration;
int8_t andsw;
}) LogicalSwitchData_v217;
PACK(typedef struct {
uint8_t type:4;
int8_t rfProtocol:4;
uint8_t channelsStart;
int8_t channelsCount; // 0=8 channels
union {
struct {
uint8_t failsafeMode:4; // only 3 bits used
uint8_t subType:3;
uint8_t invertedSerial:1; // telemetry serial inverted from standard
};
struct {
uint8_t failsafeMode:4; // only 3 bits used
uint8_t freq:2;
uint8_t region:2;
} r9m;
};
int16_t failsafeChannels[MAX_OUTPUT_CHANNELS];
union {
struct {
int8_t delay:6;
uint8_t pulsePol:1;
uint8_t outputType:1; // false = open drain, true = push pull
int8_t frameLength;
} ppm;
};
}) ModuleData_v217;
PACK(typedef struct {
char name[6];
uint8_t popup:1;
uint8_t spare:7;
}) GVarData_v217;
PACK(typedef struct {
ModelHeader header;
TimerData_v217 timers[MAX_TIMERS];
uint8_t telemetryProtocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
uint8_t noGlobalFunctions:1;
uint8_t displayTrims:2;
uint8_t ignoreSensorIds:1;
int8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t displayChecklist:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t throttleReversed:1;
BeepANACenter beepANACenter;
MixData_v217 mixData[MAX_MIXERS];
LimitData limitData[MAX_OUTPUT_CHANNELS];
ExpoData_v217 expoData[MAX_EXPOS];
CurveData_v216 curves[MAX_CURVES];
int8_t points[MAX_CURVE_POINTS];
LogicalSwitchData_v217 logicalSw[32];
CustomFunctionData_v216 customFn[MAX_SPECIAL_FUNCTIONS];
SwashRingData swashR;
FlightModeData_v216 flightModeData[MAX_FLIGHT_MODES];
uint8_t thrTraceSrc;
swarnstate_t switchWarningState;
swarnenable_t switchWarningEnable;
GVarData_v217 gvars[MAX_GVARS];
FrSkyTelemetryData frsky;
RssiAlarmData rssiAlarms;
uint8_t spare:3;
uint8_t trainerMode:3;
uint8_t potsWarnMode:2;
ModuleData_v217 moduleData[NUM_MODULES+1];
#if defined(PCBTARANIS)
char curveNames[MAX_CURVES][6];
ScriptData scriptsData[MAX_SCRIPTS];
char inputNames[MAX_INPUTS][LEN_INPUT_NAME];
#endif
uint8_t potsWarnEnabled;
int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS];
#if defined(PCBTARANIS)
TelemetrySensor telemetrySensors[MAX_TELEMETRY_SENSORS];
#else
uint8_t rxBattAlarms[2];
#endif
TARANIS_PCBX9E_FIELD(uint8_t toplcdTimer)
}) ModelData_v217;
-2
View File
@@ -25,8 +25,6 @@ uint16_t eeLoadGeneralSettingsData();
bool eeModelExists(uint8_t id);
void eeLoadModel(uint8_t id);
bool eeConvert();
void ConvertModel(int id, int version);
uint8_t eeFindEmptyModel(uint8_t id, bool down);
void selectModel(uint8_t sub);
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -584,7 +584,7 @@ const char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
#if defined(EEPROM_CONVERSIONS)
if (version < EEPROM_VER) {
ConvertModel(i_fileDst, version);
convertModel(i_fileDst, version);
eeLoadModel(g_eeGeneral.currModel);
}
#endif
+2 -1
View File
@@ -22,6 +22,7 @@
#include <string.h>
#include "opentx.h"
#include "timers.h"
#include "conversions/conversions.h"
uint8_t s_write_err = 0; // error reasons
RlcFile theFile; //used for any file operation
@@ -596,7 +597,7 @@ const char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
#if defined(EEPROM_CONVERSIONS)
if (version < EEPROM_VER) {
storageCheck(true);
ConvertModel(i_fileDst, version);
convertModelData(i_fileDst, version);
eeLoadModel(g_eeGeneral.currModel);
}
#endif