ASYNC_WRITE changed to EEPROM_ASYNC_WRITE
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#ifndef SIMU
|
#ifndef SIMU
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
|
|
||||||
uint16_t eeprom_pointer;
|
uint16_t eeprom_pointer;
|
||||||
const char* eeprom_buffer_data;
|
const char* eeprom_buffer_data;
|
||||||
|
|||||||
+13
-13
@@ -24,7 +24,7 @@
|
|||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
uint8_t s_write_err = 0; // error reasons
|
uint8_t s_write_err = 0; // error reasons
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
uint8_t s_sync_write = false;
|
uint8_t s_sync_write = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ uint16_t EeFsGetFree()
|
|||||||
return ret;
|
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
|
static void EeFsFree(uint8_t blk){///free one or more blocks
|
||||||
uint8_t i = blk;
|
uint8_t i = blk;
|
||||||
while( EeFsGetLink(i)) i = EeFsGetLink(i);
|
while( EeFsGetLink(i)) i = EeFsGetLink(i);
|
||||||
@@ -100,7 +100,7 @@ static void EeFsFree(uint8_t blk){///free one or more blocks
|
|||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
#ifndef ASYNC_WRITE
|
#ifndef EEPROM_ASYNC_WRITE
|
||||||
static uint8_t EeFsAlloc(){ ///alloc one block from freelist
|
static uint8_t EeFsAlloc(){ ///alloc one block from freelist
|
||||||
uint8_t ret=eeFs.freeList;
|
uint8_t ret=eeFs.freeList;
|
||||||
if(ret){
|
if(ret){
|
||||||
@@ -114,7 +114,7 @@ static uint8_t EeFsAlloc(){ ///alloc one block from freelist
|
|||||||
|
|
||||||
int8_t EeFsck()
|
int8_t EeFsck()
|
||||||
{
|
{
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
s_sync_write = true;
|
s_sync_write = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ int8_t EeFsck()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
s_sync_write = false;
|
s_sync_write = false;
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
@@ -164,7 +164,7 @@ int8_t EeFsck()
|
|||||||
|
|
||||||
void EeFsFormat()
|
void EeFsFormat()
|
||||||
{
|
{
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
s_sync_write = true;
|
s_sync_write = true;
|
||||||
#endif
|
#endif
|
||||||
if(sizeof(eeFs) != RESV){
|
if(sizeof(eeFs) != RESV){
|
||||||
@@ -180,7 +180,7 @@ void EeFsFormat()
|
|||||||
EeFsSetLink(BLOCKS-1, 0);
|
EeFsSetLink(BLOCKS-1, 0);
|
||||||
eeFs.freeList = FIRSTBLK;
|
eeFs.freeList = FIRSTBLK;
|
||||||
EeFsFlush();
|
EeFsFlush();
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
s_sync_write = false;
|
s_sync_write = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,7 @@ void EFile::swap(uint8_t i_fileId1, uint8_t i_fileId2)
|
|||||||
|
|
||||||
void EFile::rm(uint8_t i_fileId)
|
void EFile::rm(uint8_t i_fileId)
|
||||||
{
|
{
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
s_sync_write = true;
|
s_sync_write = true;
|
||||||
#endif
|
#endif
|
||||||
uint8_t i = eeFs.files[i_fileId].startBlk;
|
uint8_t i = eeFs.files[i_fileId].startBlk;
|
||||||
@@ -219,7 +219,7 @@ void EFile::rm(uint8_t i_fileId)
|
|||||||
EeFsFlush(); //chained out
|
EeFsFlush(); //chained out
|
||||||
|
|
||||||
if(i) EeFsFree( i ); //chain in
|
if(i) EeFsFree( i ); //chain in
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
s_sync_write = false;
|
s_sync_write = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ uint16_t RlcFile::readRlc(uint8_t*buf,uint16_t i_len)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
|
|
||||||
void RlcFile::write1(uint8_t b)
|
void RlcFile::write1(uint8_t b)
|
||||||
{
|
{
|
||||||
@@ -452,7 +452,7 @@ uint8_t RlcFile::write(uint8_t*buf, uint8_t i_len)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
|
|
||||||
void RlcFile::create(uint8_t i_fileId, uint8_t typ, uint8_t sync_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);
|
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;
|
eeFs.files[FILE_TMP].size = m_pos;
|
||||||
EFile::swap(m_fileId, FILE_TMP);
|
EFile::swap(m_fileId, FILE_TMP);
|
||||||
#else
|
#else
|
||||||
@@ -673,7 +673,7 @@ void RlcFile::close()
|
|||||||
|
|
||||||
if(fri) EeFsFree( fri ); //chain in
|
if(fri) EeFsFree( fri ); //chain in
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
m_write_step = 0;
|
m_write_step = 0;
|
||||||
s_sync_write = false;
|
s_sync_write = false;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+4
-4
@@ -47,7 +47,7 @@ int8_t EeFsck();
|
|||||||
void EeFsFormat();
|
void EeFsFormat();
|
||||||
uint16_t EeFsGetFree();
|
uint16_t EeFsGetFree();
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
extern volatile size_t eeprom_buffer_size;
|
extern volatile size_t eeprom_buffer_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ class EFile
|
|||||||
|
|
||||||
#define ERR_NONE 0
|
#define ERR_NONE 0
|
||||||
#define ERR_FULL 1
|
#define ERR_FULL 1
|
||||||
#ifndef ASYNC_WRITE
|
#ifndef EEPROM_ASYNC_WRITE
|
||||||
#define ERR_TMO 2
|
#define ERR_TMO 2
|
||||||
#endif
|
#endif
|
||||||
extern uint8_t s_write_err; // error reasons
|
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_bRlc; // control byte for run length decoder
|
||||||
uint8_t m_zeroes;
|
uint8_t m_zeroes;
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
uint8_t m_flags;
|
uint8_t m_flags;
|
||||||
#define WRITE_FIRST_LINK 0x01
|
#define WRITE_FIRST_LINK 0x01
|
||||||
#define WRITE_NEXT_LINK_1 0x02
|
#define WRITE_NEXT_LINK_1 0x02
|
||||||
@@ -123,7 +123,7 @@ public:
|
|||||||
void openRlc(uint8_t i_fileId);
|
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);
|
void create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write);
|
||||||
inline bool isWriting() { return m_write_step != 0; }
|
inline bool isWriting() { return m_write_step != 0; }
|
||||||
void write(uint8_t*buf, uint8_t i_len);
|
void write(uint8_t*buf, uint8_t i_len);
|
||||||
|
|||||||
+2
-2
@@ -1519,7 +1519,7 @@ void perMain()
|
|||||||
}
|
}
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
if (!eeprom_buffer_size) {
|
if (!eeprom_buffer_size) {
|
||||||
if (theFile.isWriting())
|
if (theFile.isWriting())
|
||||||
theFile.nextWriteStep();
|
theFile.nextWriteStep();
|
||||||
@@ -1548,7 +1548,7 @@ void perMain()
|
|||||||
if (trimsCheckTimer > 0)
|
if (trimsCheckTimer > 0)
|
||||||
trimsCheckTimer -= 1;
|
trimsCheckTimer -= 1;
|
||||||
|
|
||||||
#ifndef ASYNC_WRITE
|
#ifndef EEPROM_ASYNC_WRITE
|
||||||
eeCheck();
|
eeCheck();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
#define VERS 1
|
#define VERS 1
|
||||||
#define SUB_VERS 2
|
#define SUB_VERS 2
|
||||||
|
|
||||||
#define ASYNC_WRITE
|
#define EEPROM_ASYNC_WRITE
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|||||||
+2
-2
@@ -156,11 +156,11 @@ void menuProcModelSelect(uint8_t event) // TODO lignes sur tout du long
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(sel_editMode && subOld!=sub){
|
if(sel_editMode && subOld!=sub){
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
s_sync_write = true;
|
s_sync_write = true;
|
||||||
#endif
|
#endif
|
||||||
EFile::swap(FILE_MODEL(subOld),FILE_MODEL(sub));
|
EFile::swap(FILE_MODEL(subOld),FILE_MODEL(sub));
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
s_sync_write = false;
|
s_sync_write = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -302,7 +302,7 @@ bool eeDuplicateModel(uint8_t id)
|
|||||||
EFile theFile2;
|
EFile theFile2;
|
||||||
theFile2.openRd(FILE_MODEL(id));
|
theFile2.openRd(FILE_MODEL(id));
|
||||||
|
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
theFile.create(FILE_MODEL(i), FILE_TYP_MODEL, true);
|
theFile.create(FILE_MODEL(i), FILE_TYP_MODEL, true);
|
||||||
#else
|
#else
|
||||||
theFile.create(FILE_MODEL(i), FILE_TYP_MODEL, 600);
|
theFile.create(FILE_MODEL(i), FILE_TYP_MODEL, 600);
|
||||||
@@ -334,7 +334,7 @@ void eeReadAll()
|
|||||||
generalDefault();
|
generalDefault();
|
||||||
//alert(PSTR("default ok"));
|
//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);
|
theFile.writeRlc(FILE_GENERAL, FILE_TYP_GENERAL,(uint8_t*)&g_eeGeneral,sizeof(EEGeneral), true);
|
||||||
#else
|
#else
|
||||||
uint16_t sz = theFile.writeRlc(FILE_GENERAL,FILE_TYP_GENERAL,(uint8_t*)&g_eeGeneral,sizeof(EEGeneral), 200);
|
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);
|
modelDefault(0);
|
||||||
//alert(PSTR("modef ok"));
|
//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);
|
theFile.writeRlc(FILE_MODEL(0), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model), true);
|
||||||
#else
|
#else
|
||||||
theFile.writeRlc(FILE_MODEL(0), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model),200);
|
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;
|
uint8_t s_eeDirtyMsk;
|
||||||
#ifndef ASYNC_WRITE
|
#ifndef EEPROM_ASYNC_WRITE
|
||||||
static uint16_t s_eeDirtyTime10ms;
|
static uint16_t s_eeDirtyTime10ms;
|
||||||
#define WRITE_DELAY_10MS 100
|
#define WRITE_DELAY_10MS 100
|
||||||
#endif
|
#endif
|
||||||
void eeDirty(uint8_t msk)
|
void eeDirty(uint8_t msk)
|
||||||
{
|
{
|
||||||
s_eeDirtyMsk |= msk;
|
s_eeDirtyMsk |= msk;
|
||||||
#ifndef ASYNC_WRITE
|
#ifndef EEPROM_ASYNC_WRITE
|
||||||
if (msk)
|
if (msk)
|
||||||
s_eeDirtyTime10ms = get_tmr10ms();
|
s_eeDirtyTime10ms = get_tmr10ms();
|
||||||
#endif
|
#endif
|
||||||
@@ -371,7 +371,7 @@ void eeDirty(uint8_t msk)
|
|||||||
|
|
||||||
void eeCheck(bool immediately)
|
void eeCheck(bool immediately)
|
||||||
{
|
{
|
||||||
#ifdef ASYNC_WRITE
|
#ifdef EEPROM_ASYNC_WRITE
|
||||||
if (immediately) {
|
if (immediately) {
|
||||||
theFile.flush();
|
theFile.flush();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user