EEPROM save process unification on ARM boards
This commit is contained in:
@@ -76,6 +76,10 @@ enum EepromWriteState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern EepromWriteState eepromWriteState;
|
extern EepromWriteState eepromWriteState;
|
||||||
|
inline bool eepromIsWriting()
|
||||||
|
{
|
||||||
|
return (eepromWriteState != EEPROM_IDLE);
|
||||||
|
}
|
||||||
void eepromWriteProcess();
|
void eepromWriteProcess();
|
||||||
void eepromWriteWait(EepromWriteState state = EEPROM_IDLE);
|
void eepromWriteWait(EepromWriteState state = EEPROM_IDLE);
|
||||||
bool eepromOpen();
|
bool eepromOpen();
|
||||||
|
|||||||
@@ -709,7 +709,7 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
|
|||||||
|
|
||||||
f_close(&g_oLogFile);
|
f_close(&g_oLogFile);
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(PCBTARANIS)
|
||||||
if (version < EEPROM_VER) {
|
if (version < EEPROM_VER) {
|
||||||
eeCheck(true);
|
eeCheck(true);
|
||||||
ConvertModel(i_fileDst, version);
|
ConvertModel(i_fileDst, version);
|
||||||
@@ -910,11 +910,12 @@ bool eeLoadGeneral()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(PCBTARANIS)
|
||||||
if (g_eeGeneral.version != EEPROM_VER) {
|
if (g_eeGeneral.version != EEPROM_VER) {
|
||||||
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
|
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
|
||||||
if (!eeConvert())
|
if (!eeConvert()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
|
|||||||
+16
-3
@@ -79,9 +79,9 @@ PACK(struct DirEnt {
|
|||||||
});
|
});
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#define EEFS_EXTRA_FIELDS uint8_t spare[2];
|
#define EEFS_EXTRA_FIELDS uint8_t spare[2];
|
||||||
#else
|
#else
|
||||||
#define EEFS_EXTRA_FIELDS
|
#define EEFS_EXTRA_FIELDS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PACK(struct EeFs {
|
PACK(struct EeFs {
|
||||||
@@ -217,7 +217,20 @@ class RlcFile: public EFile
|
|||||||
|
|
||||||
extern RlcFile theFile; //used for any file operation
|
extern RlcFile theFile; //used for any file operation
|
||||||
|
|
||||||
inline void eeFlush() { theFile.flush(); }
|
inline void eeFlush()
|
||||||
|
{
|
||||||
|
theFile.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool eepromIsWriting()
|
||||||
|
{
|
||||||
|
return theFile.isWriting();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void eepromWriteProcess()
|
||||||
|
{
|
||||||
|
theFile.nextWriteStep();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined (EEPROM_PROGRESS_BAR)
|
#if defined (EEPROM_PROGRESS_BAR)
|
||||||
#define DISPLAY_PROGRESS_BAR(x) theFile.DisplayProgressBar(x)
|
#define DISPLAY_PROGRESS_BAR(x) theFile.DisplayProgressBar(x)
|
||||||
|
|||||||
@@ -81,18 +81,10 @@ void checkSpeakerVolume()
|
|||||||
void checkEeprom()
|
void checkEeprom()
|
||||||
{
|
{
|
||||||
if (!usbPlugged()) {
|
if (!usbPlugged()) {
|
||||||
// TODO merge these 2 branches
|
if (eepromIsWriting())
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
if (eepromWriteState != EEPROM_IDLE)
|
|
||||||
eepromWriteProcess();
|
eepromWriteProcess();
|
||||||
else if (TIME_TO_WRITE())
|
else if (TIME_TO_WRITE())
|
||||||
eeCheck(false);
|
eeCheck(false);
|
||||||
#else
|
|
||||||
if (theFile.isWriting())
|
|
||||||
theFile.nextWriteStep();
|
|
||||||
else if (TIME_TO_WRITE())
|
|
||||||
eeCheck(false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user