mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
[stock] 6 bytes flash saving
This commit is contained in:
parent
6f395c2563
commit
6ecf3375c2
1 changed files with 4 additions and 8 deletions
|
@ -246,7 +246,7 @@ void EeFsFormat()
|
||||||
s_sync_write = false;
|
s_sync_write = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool EeFsOpen() // TODO inline?
|
inline bool EeFsOpen()
|
||||||
{
|
{
|
||||||
eeprom_read_block(&eeFs, 0, sizeof(eeFs));
|
eeprom_read_block(&eeFs, 0, sizeof(eeFs));
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ void RlcFile::nextWriteStep()
|
||||||
s_write_err = ERR_FULL;
|
s_write_err = ERR_FULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_write_step += WRITE_NEXT_LINK_1; // TODO review all these names
|
m_write_step += WRITE_NEXT_LINK_1;
|
||||||
EeFsSetLink(m_currBlk, eeFs.freeList);
|
EeFsSetLink(m_currBlk, eeFs.freeList);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -451,13 +451,9 @@ void RlcFile::nextWriteStep()
|
||||||
return;
|
return;
|
||||||
case WRITE_NEXT_LINK_2:
|
case WRITE_NEXT_LINK_2:
|
||||||
m_write_step -= WRITE_NEXT_LINK_2;
|
m_write_step -= WRITE_NEXT_LINK_2;
|
||||||
EeFsSetLink(m_currBlk, 0); // TODO needed?
|
EeFsSetLink(m_currBlk, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!m_currBlk) { // TODO needed?
|
|
||||||
s_write_err = ERR_FULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
uint8_t tmp = BS-1-m_ofs; if(tmp>m_write_len) tmp=m_write_len;
|
uint8_t tmp = BS-1-m_ofs; if(tmp>m_write_len) tmp=m_write_len;
|
||||||
m_write_buf += tmp;
|
m_write_buf += tmp;
|
||||||
m_write_len -= tmp;
|
m_write_len -= tmp;
|
||||||
|
@ -818,7 +814,7 @@ bool eeLoadGeneral()
|
||||||
{
|
{
|
||||||
theFile.openRlc(FILE_GENERAL);
|
theFile.openRlc(FILE_GENERAL);
|
||||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, 1) == 1 && g_eeGeneral.myVers == EEPROM_VER) {
|
if (theFile.readRlc((uint8_t*)&g_eeGeneral, 1) == 1 && g_eeGeneral.myVers == EEPROM_VER) {
|
||||||
theFile.openRlc(FILE_GENERAL); // TODO include this openRlc inside readRlc
|
theFile.openRlc(FILE_GENERAL);
|
||||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(EEGeneral)) {
|
if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(EEGeneral)) {
|
||||||
if (g_eeGeneral.variants == EEPROM_VARIANTS && g_eeGeneral.chkSum == evalChkSum()) {
|
if (g_eeGeneral.variants == EEPROM_VARIANTS && g_eeGeneral.chkSum == evalChkSum()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue