Further confined v220 data structures
This commit is contained in:
@@ -19,16 +19,20 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "definitions.h"
|
||||
#include "datastructs_219.h"
|
||||
#include "datastructs_220.h"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#include "theme.h"
|
||||
#endif
|
||||
#include "debug.h"
|
||||
#include "strhelpers.h"
|
||||
|
||||
#if defined(EEPROM) || defined(EEPROM_RLC)
|
||||
#include <storage/eeprom_common.h>
|
||||
#include <storage/eeprom_common.h>
|
||||
#else
|
||||
#include <storage/sdcard_common.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -85,7 +89,7 @@
|
||||
// -> ModelData: +1284 (CustomScreenData x 5 = 1200; TopBar::PersistentData: +84)
|
||||
//
|
||||
|
||||
typedef TimerData TimerData_v220;
|
||||
typedef bin_storage_220::TimerData TimerData_v220;
|
||||
|
||||
static void convertToStr(char* str, size_t len)
|
||||
{
|
||||
@@ -99,11 +103,6 @@ static void convertToStr(char* str, size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(COLORLCD)
|
||||
extern const LayoutFactory * defaultLayout;
|
||||
extern OpenTxTheme * defaultTheme;
|
||||
#endif
|
||||
|
||||
void convertModelData_219_to_220(void* data)
|
||||
{
|
||||
constexpr unsigned md_size = sizeof(bin_storage_220::ModelData);
|
||||
@@ -125,17 +124,17 @@ void convertModelData_219_to_220(void* data)
|
||||
|
||||
// Convert mode
|
||||
|
||||
if (timer_219.mode >= TMRMODE_START) {
|
||||
if (timer_219.mode >= bin_storage_220::TMRMODE_START) {
|
||||
timer_219.mode += 1;
|
||||
}
|
||||
if (timer_219.mode < TMRMODE_COUNT
|
||||
if (timer_219.mode < bin_storage_220::TMRMODE_COUNT
|
||||
&& timer_219.mode >=0) {
|
||||
timer.mode = timer_219.mode;
|
||||
}
|
||||
else {
|
||||
timer.mode = TMRMODE_ON;
|
||||
timer.mode = bin_storage_220::TMRMODE_ON;
|
||||
if (timer_219.mode > 0)
|
||||
timer.swtch = timer_219.mode - (TMRMODE_COUNT - 1);
|
||||
timer.swtch = timer_219.mode - (bin_storage_220::TMRMODE_COUNT - 1);
|
||||
else
|
||||
timer.swtch = timer_219.mode;
|
||||
}
|
||||
@@ -219,33 +218,28 @@ void convertModelData_219_to_220(void* data)
|
||||
sizeof(newModel.screenData) +
|
||||
sizeof(newModel.topbarData));
|
||||
|
||||
if (defaultLayout) {
|
||||
strcpy(newModel.screenData[0].LayoutId, "Layout2P1");
|
||||
strcpy(newModel.screenData[0].LayoutId, "Layout2P1");
|
||||
auto persistentData = &newModel.screenData[0].layoutData;
|
||||
|
||||
// TODO: copy the raw structure for the default layout in version 220
|
||||
//defaultLayout->initPersistentData(&newModel.screenData[0].layoutData, true);
|
||||
auto persistentData = &newModel.screenData[0].layoutData;
|
||||
// top bar
|
||||
persistentData->options[0].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[0].value.boolValue = true;
|
||||
|
||||
// top bar
|
||||
persistentData->options[0].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[0].value.boolValue = true;
|
||||
// flight mode
|
||||
persistentData->options[1].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[1].value.boolValue = true;
|
||||
|
||||
// flight mode
|
||||
persistentData->options[1].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[1].value.boolValue = true;
|
||||
// sliders
|
||||
persistentData->options[2].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[2].value.boolValue = true;
|
||||
|
||||
// sliders
|
||||
persistentData->options[2].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[2].value.boolValue = true;
|
||||
// trims
|
||||
persistentData->options[3].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[3].value.boolValue = true;
|
||||
|
||||
// trims
|
||||
persistentData->options[3].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[3].value.boolValue = true;
|
||||
|
||||
// mirrored
|
||||
persistentData->options[4].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[4].value.boolValue = false;
|
||||
}
|
||||
// mirrored
|
||||
persistentData->options[4].type = bin_storage_220::ZOV_Bool;
|
||||
persistentData->options[4].value.boolValue = false;
|
||||
#endif
|
||||
free(oldModelAllocated);
|
||||
}
|
||||
@@ -300,7 +294,7 @@ void convertRadioData_219_to_220(void* data)
|
||||
#if defined(COLORLCD)
|
||||
// Clear CustomScreenData + TopBarPersistentData
|
||||
// as they cannot be converted (missing option types)
|
||||
strcpy(settings.themeName, defaultTheme->getName());
|
||||
strcpy(settings.themeName, "EdgeTX");
|
||||
memset(&settings.themeData, 0, sizeof(settings.themeData));
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,9 +19,19 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "definitions.h"
|
||||
#include "datastructs_220.h"
|
||||
|
||||
#include "sdcard.h"
|
||||
|
||||
#include <storage/yaml/yaml_node.h>
|
||||
|
||||
using namespace bin_storage_220;
|
||||
#include <storage/sdcard_common.h>
|
||||
|
||||
// see "yaml/yaml_datastructs.h"
|
||||
namespace yaml_conv_220 {
|
||||
const YamlNode* get_radiodata_nodes();
|
||||
|
||||
@@ -28,3 +28,6 @@ namespace bin_storage_220 {
|
||||
#include "yaml/myeeprom_220.h"
|
||||
|
||||
};
|
||||
|
||||
// prevent board.h from being included
|
||||
#define _BOARD_H_
|
||||
|
||||
@@ -27,6 +27,13 @@ using std::list;
|
||||
#include "yaml/yaml_modelslist.h"
|
||||
#endif
|
||||
|
||||
#include "myeeprom.h"
|
||||
#include "datastructs.h"
|
||||
#include "pulses/modules_helpers.h"
|
||||
#include "strhelpers.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
ModelsList modelslist;
|
||||
|
||||
ModelCell::ModelCell(const char* name) : valid_rfData(false)
|
||||
|
||||
@@ -30,12 +30,17 @@
|
||||
#include "sdcard_raw.h"
|
||||
#endif
|
||||
|
||||
#include "dataconstants.h"
|
||||
|
||||
// #define MODELCELL_WIDTH 172
|
||||
// #define MODELCELL_HEIGHT 59
|
||||
|
||||
// modelXXXXXXX.bin F,FF F,3F,FF\r\n
|
||||
#define LEN_MODELS_IDX_LINE (LEN_MODEL_FILENAME + sizeof(" F,FF F,3F,FF\r\n")-1)
|
||||
|
||||
struct ModelData;
|
||||
struct ModuleData;
|
||||
|
||||
struct SimpleModuleData
|
||||
{
|
||||
uint8_t type;
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
#define DEFAULT_MODEL_FILENAME MODEL_FILENAME_PREFIX "1" MODEL_FILENAME_SUFFIX
|
||||
#define MODEL_FILENAME_PATTERN MODEL_FILENAME_PREFIX MODEL_FILENAME_SUFFIX
|
||||
|
||||
//#if !defined(EEPROM)
|
||||
#if !defined(STORAGE_MODELSLIST)
|
||||
extern ModelHeader modelHeaders[MAX_MODELS];
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
// opens radio.bin or model file
|
||||
const char* openFileBin(const char* fullpath, FIL* file, uint16_t* size,
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "storage/modelslist.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using std::list;
|
||||
|
||||
struct modelslist_iter
|
||||
|
||||
Reference in New Issue
Block a user