From 3d27fed72f4e080ce37ba41fe7e80462585e7494 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sat, 17 Sep 2011 09:29:04 +0000 Subject: [PATCH] ASYNC_WRITE changed to EEPROM_ASYNC_WRITE --- src/drivers.cpp | 2 +- src/file.cpp | 26 +++++++++++++------------- src/file.h | 8 ++++---- src/gruvin9x.cpp | 4 ++-- src/gruvin9x.h | 2 +- src/model_menus.cpp | 4 ++-- src/pers.cpp | 12 ++++++------ 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/drivers.cpp b/src/drivers.cpp index 05b96dd41..1638f40eb 100644 --- a/src/drivers.cpp +++ b/src/drivers.cpp @@ -23,7 +23,7 @@ #ifndef SIMU -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE uint16_t eeprom_pointer; const char* eeprom_buffer_data; diff --git a/src/file.cpp b/src/file.cpp index 90a4f071b..ab79ca841 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -24,7 +24,7 @@ #include "string.h" uint8_t s_write_err = 0; // error reasons -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE uint8_t s_sync_write = false; #endif @@ -90,7 +90,7 @@ uint16_t EeFsGetFree() return ret; } -// #ifndef ASYNC_WRITE TODO because duplicate code +// #ifndef EEPROM_ASYNC_WRITE TODO because duplicate code static void EeFsFree(uint8_t blk){///free one or more blocks uint8_t i = blk; while( EeFsGetLink(i)) i = EeFsGetLink(i); @@ -100,7 +100,7 @@ static void EeFsFree(uint8_t blk){///free one or more blocks } // #endif -#ifndef ASYNC_WRITE +#ifndef EEPROM_ASYNC_WRITE static uint8_t EeFsAlloc(){ ///alloc one block from freelist uint8_t ret=eeFs.freeList; if(ret){ @@ -114,7 +114,7 @@ static uint8_t EeFsAlloc(){ ///alloc one block from freelist int8_t EeFsck() { -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE s_sync_write = true; #endif @@ -156,7 +156,7 @@ int8_t EeFsck() } } -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE s_sync_write = false; #endif return ret; @@ -164,7 +164,7 @@ int8_t EeFsck() void EeFsFormat() { -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE s_sync_write = true; #endif if(sizeof(eeFs) != RESV){ @@ -180,7 +180,7 @@ void EeFsFormat() EeFsSetLink(BLOCKS-1, 0); eeFs.freeList = FIRSTBLK; EeFsFlush(); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE s_sync_write = false; #endif } @@ -211,7 +211,7 @@ void EFile::swap(uint8_t i_fileId1, uint8_t i_fileId2) void EFile::rm(uint8_t i_fileId) { -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE s_sync_write = true; #endif uint8_t i = eeFs.files[i_fileId].startBlk; @@ -219,7 +219,7 @@ void EFile::rm(uint8_t i_fileId) EeFsFlush(); //chained out if(i) EeFsFree( i ); //chain in -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE s_sync_write = false; #endif } @@ -312,7 +312,7 @@ uint16_t RlcFile::readRlc(uint8_t*buf,uint16_t i_len) return i; } -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE void RlcFile::write1(uint8_t b) { @@ -452,7 +452,7 @@ uint8_t RlcFile::write(uint8_t*buf, uint8_t i_len) #endif -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE void RlcFile::create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write) { @@ -663,7 +663,7 @@ void RlcFile::close() if(m_currBlk && ( fri = EeFsGetLink(m_currBlk))) EeFsSetLink(m_currBlk, 0); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE eeFs.files[FILE_TMP].size = m_pos; EFile::swap(m_fileId, FILE_TMP); #else @@ -673,7 +673,7 @@ void RlcFile::close() if(fri) EeFsFree( fri ); //chain in -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE m_write_step = 0; s_sync_write = false; #endif diff --git a/src/file.h b/src/file.h index abcd63db0..f7bcf837a 100644 --- a/src/file.h +++ b/src/file.h @@ -47,7 +47,7 @@ int8_t EeFsck(); void EeFsFormat(); uint16_t EeFsGetFree(); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE extern volatile size_t eeprom_buffer_size; #endif @@ -82,7 +82,7 @@ class EFile #define ERR_NONE 0 #define ERR_FULL 1 -#ifndef ASYNC_WRITE +#ifndef EEPROM_ASYNC_WRITE #define ERR_TMO 2 #endif extern uint8_t s_write_err; // error reasons @@ -96,7 +96,7 @@ class RlcFile: public EFile uint8_t m_bRlc; // control byte for run length decoder uint8_t m_zeroes; -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE uint8_t m_flags; #define WRITE_FIRST_LINK 0x01 #define WRITE_NEXT_LINK_1 0x02 @@ -123,7 +123,7 @@ public: void openRlc(uint8_t i_fileId); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE void create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write); inline bool isWriting() { return m_write_step != 0; } void write(uint8_t*buf, uint8_t i_len); diff --git a/src/gruvin9x.cpp b/src/gruvin9x.cpp index e0d33f013..936853c0a 100644 --- a/src/gruvin9x.cpp +++ b/src/gruvin9x.cpp @@ -1519,7 +1519,7 @@ void perMain() } sei(); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE if (!eeprom_buffer_size) { if (theFile.isWriting()) theFile.nextWriteStep(); @@ -1548,7 +1548,7 @@ void perMain() if (trimsCheckTimer > 0) trimsCheckTimer -= 1; -#ifndef ASYNC_WRITE +#ifndef EEPROM_ASYNC_WRITE eeCheck(); #endif diff --git a/src/gruvin9x.h b/src/gruvin9x.h index 556db2112..d184274f2 100644 --- a/src/gruvin9x.h +++ b/src/gruvin9x.h @@ -25,7 +25,7 @@ #define VERS 1 #define SUB_VERS 2 -#define ASYNC_WRITE +#define EEPROM_ASYNC_WRITE #include #include diff --git a/src/model_menus.cpp b/src/model_menus.cpp index e4f533de5..dc131c113 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -156,11 +156,11 @@ void menuProcModelSelect(uint8_t event) // TODO lignes sur tout du long break; } if(sel_editMode && subOld!=sub){ -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE s_sync_write = true; #endif EFile::swap(FILE_MODEL(subOld),FILE_MODEL(sub)); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE s_sync_write = false; #endif } diff --git a/src/pers.cpp b/src/pers.cpp index 2e55e03ee..8f1601074 100644 --- a/src/pers.cpp +++ b/src/pers.cpp @@ -302,7 +302,7 @@ bool eeDuplicateModel(uint8_t id) EFile theFile2; theFile2.openRd(FILE_MODEL(id)); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE theFile.create(FILE_MODEL(i), FILE_TYP_MODEL, true); #else theFile.create(FILE_MODEL(i), FILE_TYP_MODEL, 600); @@ -334,7 +334,7 @@ void eeReadAll() generalDefault(); //alert(PSTR("default ok")); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE theFile.writeRlc(FILE_GENERAL, FILE_TYP_GENERAL,(uint8_t*)&g_eeGeneral,sizeof(EEGeneral), true); #else uint16_t sz = theFile.writeRlc(FILE_GENERAL,FILE_TYP_GENERAL,(uint8_t*)&g_eeGeneral,sizeof(EEGeneral), 200); @@ -343,7 +343,7 @@ void eeReadAll() modelDefault(0); //alert(PSTR("modef ok")); -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE theFile.writeRlc(FILE_MODEL(0), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model), true); #else theFile.writeRlc(FILE_MODEL(0), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model),200); @@ -356,14 +356,14 @@ void eeReadAll() uint8_t s_eeDirtyMsk; -#ifndef ASYNC_WRITE +#ifndef EEPROM_ASYNC_WRITE static uint16_t s_eeDirtyTime10ms; #define WRITE_DELAY_10MS 100 #endif void eeDirty(uint8_t msk) { s_eeDirtyMsk |= msk; -#ifndef ASYNC_WRITE +#ifndef EEPROM_ASYNC_WRITE if (msk) s_eeDirtyTime10ms = get_tmr10ms(); #endif @@ -371,7 +371,7 @@ void eeDirty(uint8_t msk) void eeCheck(bool immediately) { -#ifdef ASYNC_WRITE +#ifdef EEPROM_ASYNC_WRITE if (immediately) { theFile.flush(); }