mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 08:45:24 +03:00
Conversion from 218 to 219 added
This commit is contained in:
parent
fd3ead1b1f
commit
5285cc9b5e
6 changed files with 108 additions and 21 deletions
|
@ -131,11 +131,7 @@ else()
|
|||
add_definitions(-DEEPROM -DEEPROM_RAW)
|
||||
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/conversions.cpp)
|
||||
set(SRC ${SRC} storage/conversions/conversions_216_218.cpp)
|
||||
endif()
|
||||
include(storage/conversions/CMakeLists.txt)
|
||||
|
||||
add_definitions(-DFLAVOUR="${FLAVOUR}")
|
||||
|
||||
|
|
|
@ -557,10 +557,6 @@ typedef uint8_t swarnenable_t;
|
|||
swarnenable_t switchWarningEnable;
|
||||
#endif
|
||||
|
||||
#define MODEL_GVARS_DATA GVarData gvars[MAX_GVARS];
|
||||
|
||||
#define TELEMETRY_DATA NOBACKUP(FrSkyTelemetryData frsky); NOBACKUP(RssiAlarmData rssiAlarms);
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#include "gui/480x272/layout.h"
|
||||
#include "gui/480x272/topbar.h"
|
||||
|
@ -574,17 +570,11 @@ PACK(struct CustomScreenData {
|
|||
NOBACKUP(Topbar::PersistentData topbarData); \
|
||||
NOBACKUP(uint8_t view);
|
||||
#elif defined(PCBTARANIS)
|
||||
#define CUSTOM_SCREENS_DATA \
|
||||
#define CUSTOM_SCREENS_DATA \
|
||||
NOBACKUP(uint8_t view);
|
||||
#else
|
||||
#define CUSTOM_SCREENS_DATA
|
||||
// TODO other boards could have their custom screens here as well
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS) || defined(PCBTARANIS)
|
||||
#define SCRIPTS_DATA NOBACKUP(ScriptData scriptsData[MAX_SCRIPTS]);
|
||||
#else
|
||||
#define SCRIPTS_DATA
|
||||
#define CUSTOM_SCREENS_DATA
|
||||
// TODO other boards could have their custom screens here as well
|
||||
#endif
|
||||
|
||||
PACK(struct ModelData {
|
||||
|
@ -618,9 +608,10 @@ PACK(struct ModelData {
|
|||
|
||||
SWITCHES_WARNING_DATA
|
||||
|
||||
MODEL_GVARS_DATA
|
||||
GVarData gvars[MAX_GVARS];
|
||||
|
||||
TELEMETRY_DATA
|
||||
NOBACKUP(FrSkyTelemetryData frsky);
|
||||
NOBACKUP(RssiAlarmData rssiAlarms);
|
||||
|
||||
NOBACKUP(uint8_t spare:6);
|
||||
NOBACKUP(uint8_t potsWarnMode:2);
|
||||
|
@ -629,7 +620,9 @@ PACK(struct ModelData {
|
|||
int16_t failsafeChannels[MAX_OUTPUT_CHANNELS];
|
||||
TrainerModuleData trainerData;
|
||||
|
||||
SCRIPTS_DATA
|
||||
#if defined(PCBHORUS) || defined(PCBTARANIS)
|
||||
NOBACKUP(ScriptData scriptsData[MAX_SCRIPTS]);
|
||||
#endif
|
||||
|
||||
NOBACKUP(char inputNames[MAX_INPUTS][LEN_INPUT_NAME]);
|
||||
NOBACKUP(uint8_t potsWarnEnabled);
|
||||
|
|
9
radio/src/storage/conversions/CMakeLists.txt
Normal file
9
radio/src/storage/conversions/CMakeLists.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
if(NOT PCB STREQUAL X3)
|
||||
add_definitions(-DEEPROM_CONVERSIONS)
|
||||
set(SRC
|
||||
${SRC}
|
||||
storage/conversions/conversions.cpp
|
||||
storage/conversions/conversions_216_218.cpp
|
||||
storage/conversions/conversions_218_219.cpp
|
||||
)
|
||||
endif()
|
|
@ -29,11 +29,17 @@ void convertModelData(int id, int version)
|
|||
version = 217;
|
||||
convertModelData_216_to_217(g_model);
|
||||
}
|
||||
|
||||
if (version == 217) {
|
||||
version = 218;
|
||||
convertModelData_217_to_218(g_model);
|
||||
}
|
||||
|
||||
if (version == 218) {
|
||||
version = 219;
|
||||
convertModelData_218_to_219(g_model);
|
||||
}
|
||||
|
||||
uint8_t currModel = g_eeGeneral.currModel;
|
||||
g_eeGeneral.currModel = id;
|
||||
storageDirty(EE_MODEL);
|
||||
|
|
|
@ -28,3 +28,7 @@ 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);
|
||||
|
||||
// Conversions 218 to 219
|
||||
void convertModelData_218_to_219(ModelData &model);
|
||||
void convertRadioData_218_to_219(RadioData &settings);
|
||||
|
|
79
radio/src/storage/conversions/conversions_218_219.cpp
Normal file
79
radio/src/storage/conversions/conversions_218_219.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "datastructs_218.h"
|
||||
|
||||
/*
|
||||
* PCBHORUS: 64 telemetry sensors instead of 32
|
||||
* ALL: ReceiverData array added
|
||||
* ALL: registrationId added
|
||||
* ALL: failsafeChannels moved from ModuleData to ModelData
|
||||
* ALL: ModuleData / TrainerModuleData modified
|
||||
*
|
||||
*/
|
||||
|
||||
typedef ModelData ModelData_v219;
|
||||
|
||||
void convertModelData_218_to_219(ModelData &model)
|
||||
{
|
||||
assert(sizeof(ModelData_v218) <= sizeof(ModelData));
|
||||
|
||||
ModelData_v218 oldModel;
|
||||
memcpy(&oldModel, &model, sizeof(oldModel));
|
||||
ModelData_v219 & newModel = (ModelData_v219 &) model;
|
||||
|
||||
memset(&newModel.rssiAlarms + sizeof(RssiAlarmData), 0, sizeof(ModelData_v219) - offsetof(ModelData_v219, rssiAlarms) - sizeof(RssiAlarmData));
|
||||
|
||||
char name[LEN_MODEL_NAME+1];
|
||||
zchar2str(name, oldModel.header.name, LEN_MODEL_NAME);
|
||||
TRACE("Model %s conversion from v218 to v219", name);
|
||||
|
||||
for (int i=0; i<NUM_MODULES; i++) {
|
||||
memcpy(&newModel.moduleData[i], &oldModel.moduleData[i], sizeof(ModuleData));
|
||||
}
|
||||
|
||||
#warning "Here we have to merge the failsafe values properly"
|
||||
memcpy(newModel.failsafeChannels, oldModel.moduleData[0].failsafeChannels, sizeof(newModel.failsafeChannels));
|
||||
|
||||
newModel.trainerData.mode = oldModel.trainerMode;
|
||||
newModel.trainerData.channelsStart = oldModel.moduleData[NUM_MODULES].channelsStart;
|
||||
newModel.trainerData.channelsCount = oldModel.moduleData[NUM_MODULES].channelsCount;
|
||||
newModel.trainerData.frameLength = oldModel.moduleData[NUM_MODULES].frameLength;
|
||||
newModel.trainerData.delay = oldModel.moduleData[NUM_MODULES].delay;
|
||||
newModel.trainerData.pulsePol = oldModel.moduleData[NUM_MODULES].pulsePol;
|
||||
|
||||
memcpy(newModel.scriptsData, oldModel.scriptsData,
|
||||
sizeof(newModel.scriptsData) +
|
||||
sizeof(newModel.inputNames) +
|
||||
sizeof(newModel.potsWarnEnabled) +
|
||||
sizeof(newModel.potsWarnPosition) +
|
||||
sizeof(oldModel.telemetrySensors));
|
||||
|
||||
#if defined(PCBX9E)
|
||||
newModel.toplcdTimer = oldModel.toplcdTimer;
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
memcpy(newModel.screenData, oldModel.screenData,
|
||||
sizeof(newModel.screenData) +
|
||||
sizeof(newModel.topbarData))
|
||||
#endif
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue