EEPROM save process unification on ARM boards

This commit is contained in:
bsongis
2015-04-25 11:09:09 +02:00
parent 5ed9bfcee9
commit ba05538920
4 changed files with 25 additions and 15 deletions
+4
View File
@@ -76,6 +76,10 @@ enum EepromWriteState {
};
extern EepromWriteState eepromWriteState;
inline bool eepromIsWriting()
{
return (eepromWriteState != EEPROM_IDLE);
}
void eepromWriteProcess();
void eepromWriteWait(EepromWriteState state = EEPROM_IDLE);
bool eepromOpen();
+4 -3
View File
@@ -709,7 +709,7 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
f_close(&g_oLogFile);
#if defined(CPUARM)
#if defined(PCBTARANIS)
if (version < EEPROM_VER) {
eeCheck(true);
ConvertModel(i_fileDst, version);
@@ -910,11 +910,12 @@ bool eeLoadGeneral()
}
}
#if defined(CPUARM)
#if defined(PCBTARANIS)
if (g_eeGeneral.version != EEPROM_VER) {
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
if (!eeConvert())
if (!eeConvert()) {
return false;
}
}
return true;
#else
+16 -3
View File
@@ -79,9 +79,9 @@ PACK(struct DirEnt {
});
#if defined(CPUARM)
#define EEFS_EXTRA_FIELDS uint8_t spare[2];
#define EEFS_EXTRA_FIELDS uint8_t spare[2];
#else
#define EEFS_EXTRA_FIELDS
#define EEFS_EXTRA_FIELDS
#endif
PACK(struct EeFs {
@@ -217,7 +217,20 @@ class RlcFile: public EFile
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)
#define DISPLAY_PROGRESS_BAR(x) theFile.DisplayProgressBar(x)
+1 -9
View File
@@ -81,18 +81,10 @@ void checkSpeakerVolume()
void checkEeprom()
{
if (!usbPlugged()) {
// TODO merge these 2 branches
#if defined(PCBSKY9X)
if (eepromWriteState != EEPROM_IDLE)
if (eepromIsWriting())
eepromWriteProcess();
else if (TIME_TO_WRITE())
eeCheck(false);
#else
if (theFile.isWriting())
theFile.nextWriteStep();
else if (TIME_TO_WRITE())
eeCheck(false);
#endif
}
}