Files
edgetx-gx12/radio/src/storage/sdcard_common.h
T
c8693569b0 feat(color): New label based Model Selector (#1374)
* Model Labels Selector

* Portrait Layout

* Receiver ID Check

* Fix Labels .yml format

* Companion Initial Commit

commit 967ddf3979b4954402fe62c858faba4b7a416bba
Author: dlktdr <cblackburn320@gmail.com>
Date:   Mon Aug 29 01:49:15 2022 -0700

    Fix Labels .yml format

commit 534221cad9e01146c47a9ac1080a655e04f1f6c8
Author: dlktdr <cblackburn320@gmail.com>
Date:   Mon Aug 29 01:20:57 2022 -0700

    Receiver ID Check

commit f32c0939d44e9ae60bc0705a9176354c23fec198
Author: dlktdr <cblackburn320@gmail.com>
Date:   Sun Aug 28 23:13:25 2022 -0700

    Portrait Layout

commit 961181217c7841ff3f21299ac6aa419b810f80e9
Author: dlktdr <cblackburn320@gmail.com>
Date:   Sat Dec 11 16:56:13 2021 -0800

    Model Labels Selector

commit dc99dd40d2
Author: David PHAM-VAN <1387855+DavBfr@users.noreply.github.com>
Date:   Fri Aug 26 03:04:34 2022 -0300

    feat: Allow Lua widget to override built-in widget with same name (#2208)

    * Allow CPP Widgets Override with LUA

    * Reset a widget option it the type differs

commit 4b747caff9
Author: eshifri <46511024+eshifri@users.noreply.github.com>
Date:   Thu Aug 25 19:47:53 2022 -0700

    fix: Write model name into models.yml when duplicating model (#2224)

    * Update model name in the models.yml file (#2214)

    * Fix the length of the name.

commit e97f23a305
Author: eshifri <46511024+eshifri@users.noreply.github.com>
Date:   Wed Aug 24 21:19:52 2022 -0700

    fix(cpn): Fix full path to model notes for Simulator (#2223)

* Correct Highlighted Column

* labels .yml indentation

* Update da.h

New defines translated to Danish

* Update dataconstants.h

Omit warnings due to difference of LEN_MODEL_FILENAME and LEN_MODEL_NAME in modellist.cpp

* Update modelslist.cpp

Wonder if this are the right file in PR #1374 (?), seems a lot are changed to the better in #1374

* Update dataconstants.h

Restore #define for LEN_MODEL_FILENAME to 16

* Rebase, Correct Issues

Delete now deletes instead of select
New model stores correct information
Duplicate save all information in cell
Rework items to use cell over button
Reword function variables

* CMPN: Add context menu

Fix output not functional. Removed Yaml::null at some point :)
Fix some compiler warnings

* CMPN: Compiler warning, replace ,->_ in list

* FW: Various Changes

Change view to a grid
Don't allow comma in label name
Add scroll indicators
Save sort order

Co-authored-by: HThuren <99370924+HThuren@users.noreply.github.com>
2022-09-03 09:01:19 +10:00

90 lines
2.9 KiB
C

/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* 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.
*/
#ifndef _SDCARD_COMMON_H_
#define _SDCARD_COMMON_H_
#include "ff.h"
#include "translations.h"
#define MODEL_FILENAME_PREFIX "model"
#if defined(SDCARD_RAW)
#define MODEL_FILENAME_SUFFIX ".bin"
#elif defined(SDCARD_YAML)
#define MODEL_FILENAME_SUFFIX ".yml"
#endif
#define DEFAULT_MODEL_FILENAME MODEL_FILENAME_PREFIX "1" MODEL_FILENAME_SUFFIX
#define MODEL_FILENAME_PATTERN MODEL_FILENAME_PREFIX MODEL_FILENAME_SUFFIX
#if !defined(STORAGE_MODELSLIST)
extern ModelHeader modelHeaders[MAX_MODELS];
#endif
// opens radio.bin or model file
const char* openFileBin(const char* fullpath, FIL* file, uint16_t* size,
uint8_t* version);
const char* writeFileBin(const char* fullpath, const uint8_t* data,
uint16_t size, uint8_t version = EEPROM_VER);
// open, read, and close the file
const char *loadFileBin(const char *fullpath, uint8_t *data,
uint16_t maxsize, uint8_t *version);
// writes a complete YAML file
struct YamlNode;
const char* writeFileYaml(const char* path, const YamlNode* root_node, uint8_t* data, uint16_t checksum);
void getModelPath(char * path, const char * filename, const char* pathName = STR_MODELS_PATH);
const char * readModel(const char * filename, uint8_t * buffer, uint32_t size, const char* pathName = STR_MODELS_PATH);
const char * loadModel(char * filename, bool alarms=true);
const char * loadModelTemplate(const char* fileName, const char* filePath);
const char * createModel();
const char * writeModel();
#if !defined(STORAGE_MODELSLIST)
// index storage vs modelslist
void selectModel(uint8_t idx);
const char* loadModel(uint8_t idx, bool alarms=true);
bool modelExists(uint8_t idx);
bool copyModel(uint8_t dst, uint8_t src);
void swapModels(uint8_t id1, uint8_t id2);
int8_t deleteModel(uint8_t idx);
const char* backupModel(uint8_t idx);
const char * restoreModel(uint8_t idx, char *model_name);
uint8_t findEmptyModel(uint8_t id, bool down);
#endif
bool storageReadRadioSettings(bool checks);
const char * loadRadioSettings();
const char * writeGeneralSettings();
const char * loadRadioSettings(const char * path);
const char * loadRadioSettings();
void checkModelIdUnique(uint8_t index, uint8_t module);
#endif // _SDCARD_RAW_H_