myeeprom.h splitted into dataconstants.h and datastructs.h
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -516,7 +516,13 @@ PACK(typedef struct {
|
||||
uint8_t potsWarnEnabled; \
|
||||
int8_t potsWarnPosition[NUM_POTS];
|
||||
#else
|
||||
#define MODELDATA_EXTRA_217 MODELDATA_EXTRA
|
||||
#define MODELDATA_EXTRA_217 \
|
||||
uint8_t spare:6; \
|
||||
uint8_t potsWarnMode:2; \
|
||||
ModuleData moduleData[NUM_MODULES+1]; \
|
||||
uint8_t potsWarnEnabled; \
|
||||
int8_t potsWarnPosition[NUM_POTS]; \
|
||||
uint8_t rxBattAlarms[2];
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -606,9 +612,9 @@ PACK(typedef struct {
|
||||
swarnstate_t switchWarningState;
|
||||
swarnenable_t switchWarningEnable;
|
||||
|
||||
MODEL_GVARS_DATA
|
||||
GVarData gvars[MAX_GVARS];
|
||||
|
||||
TELEMETRY_DATA
|
||||
FrSkyTelemetryData frsky;
|
||||
|
||||
MODELDATA_EXTRA_217
|
||||
|
||||
@@ -683,7 +689,7 @@ int ConvertGVar_216_to_217(int value)
|
||||
return value;
|
||||
}
|
||||
|
||||
void ConvertGeneralSettings_216_to_217(EEGeneral & settings)
|
||||
void ConvertGeneralSettings_216_to_217(RadioData & settings)
|
||||
{
|
||||
settings.version = 217;
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -692,7 +698,7 @@ void ConvertGeneralSettings_216_to_217(EEGeneral & settings)
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConvertGeneralSettings_217_to_218(EEGeneral & settings)
|
||||
void ConvertGeneralSettings_217_to_218(RadioData & settings)
|
||||
{
|
||||
settings.version = 218;
|
||||
for (int i=0; i<NUM_CFN; i++) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -281,7 +281,7 @@ bool eepromOpen()
|
||||
if (eeFs.mySize != sizeof(eeFs)) {
|
||||
TRACE("bad eeFs.mySize (%d instead of %d)", (int)eeFs.mySize, (int)sizeof(eeFs));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (eeFs.version != EEFS_VERS || eeFs.mySize != sizeof(eeFs)) {
|
||||
return false;
|
||||
@@ -349,7 +349,7 @@ uint8_t EFile::read(uint8_t *buf, uint8_t i_len)
|
||||
uint8_t remaining = i_len;
|
||||
while (remaining) {
|
||||
if (!m_currBlk) break;
|
||||
|
||||
|
||||
*buf++ = EeFsGetDat(m_currBlk, m_ofs++);
|
||||
if (m_ofs >= BS-sizeof(blkid_t)) {
|
||||
m_ofs = 0;
|
||||
@@ -565,7 +565,7 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
|
||||
if (buf[i])
|
||||
buf[i] = idx2char(buf[i]);
|
||||
else
|
||||
buf[i] = '_';
|
||||
buf[i] = '_';
|
||||
}
|
||||
i--;
|
||||
}
|
||||
@@ -881,7 +881,7 @@ bool eeLoadGeneral()
|
||||
theFile.openRlc(FILE_GENERAL);
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, 3) == 3 && g_eeGeneral.version == EEPROM_VER) {
|
||||
theFile.openRlc(FILE_GENERAL);
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(EEGeneral) && g_eeGeneral.variant == EEPROM_VARIANT) {
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(g_eeGeneral) && g_eeGeneral.variant == EEPROM_VARIANT) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -927,7 +927,7 @@ void storageCheck(bool immediately)
|
||||
if (storageDirtyMsk & EE_GENERAL) {
|
||||
TRACE("eeprom write general");
|
||||
storageDirtyMsk -= EE_GENERAL;
|
||||
theFile.writeRlc(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&g_eeGeneral, sizeof(EEGeneral), immediately);
|
||||
theFile.writeRlc(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral), immediately);
|
||||
if (!immediately) return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
namespace Backup {
|
||||
#define BACKUP
|
||||
#include "datastructs.h"
|
||||
PACK(struct RamBackup {
|
||||
ModelData model;
|
||||
RadioData radio;
|
||||
}) ramBackup;
|
||||
#undef BACKUP
|
||||
};
|
||||
|
||||
#include "datacopy.cpp"
|
||||
|
||||
void RamBackupWrite()
|
||||
{
|
||||
TRACE("RamBackup size=%d vs %d", sizeof(Backup::RamBackup), sizeof(ModelData)+sizeof(RadioData));
|
||||
}
|
||||
|
||||
void RamBackupRead()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -57,4 +57,9 @@ void postModelLoad(bool newModel);
|
||||
#include "sdcard_raw.h"
|
||||
#endif
|
||||
|
||||
#if defined(RAMBACKUP)
|
||||
void RamBackupWrite();
|
||||
void RamBackupRead();
|
||||
#endif
|
||||
|
||||
#endif // _STORAGE_H_
|
||||
|
||||
Reference in New Issue
Block a user