[Horus] Refactoring continued
This commit is contained in:
@@ -747,7 +747,7 @@ PACK(typedef struct {
|
||||
|
||||
TelemetrySensor telemetrySensors[MAX_SENSORS];
|
||||
|
||||
TARANIS_REV9E_FIELD(uint8_t topLcdTimer)
|
||||
TARANIS_REV9E_FIELD(uint8_t toplcdTimer)
|
||||
}) ModelData_v217;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -1356,7 +1356,7 @@ void ConvertModel_217_to_218(ModelData & model)
|
||||
newModel.telemetrySensors[i] = oldModel.telemetrySensors[i];
|
||||
}
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
newModel.topLcdTimer = oldModel.topLcdTimer;
|
||||
newModel.toplcdTimer = oldModel.toplcdTimer;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1375,7 +1375,7 @@ void ConvertModel(int id, int version)
|
||||
|
||||
uint8_t currModel = g_eeGeneral.currModel;
|
||||
g_eeGeneral.currModel = id;
|
||||
s_storageDirtyMsk = EE_MODEL;
|
||||
storageDirty(EE_MODEL);
|
||||
storageCheck(true);
|
||||
g_eeGeneral.currModel = currModel;
|
||||
}
|
||||
@@ -1421,7 +1421,7 @@ bool eeConvert()
|
||||
version = 218;
|
||||
ConvertGeneralSettings_217_to_218(g_eeGeneral);
|
||||
}
|
||||
s_storageDirtyMsk = EE_GENERAL;
|
||||
storageDirty(EE_GENERAL);
|
||||
storageCheck(true);
|
||||
|
||||
#if defined(COLORLCD)
|
||||
|
||||
@@ -375,9 +375,9 @@ void storageCheck(bool immediately)
|
||||
|
||||
assert(eepromWriteState == EEPROM_IDLE);
|
||||
|
||||
if (s_storageDirtyMsk & EE_GENERAL) {
|
||||
if (storageDirtyMsk & EE_GENERAL) {
|
||||
TRACE("eeprom write general");
|
||||
s_storageDirtyMsk -= EE_GENERAL;
|
||||
storageDirtyMsk -= EE_GENERAL;
|
||||
writeGeneralSettings();
|
||||
if (immediately)
|
||||
eepromWriteWait();
|
||||
@@ -385,9 +385,9 @@ void storageCheck(bool immediately)
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_storageDirtyMsk & EE_MODEL) {
|
||||
if (storageDirtyMsk & EE_MODEL) {
|
||||
TRACE("eeprom write model");
|
||||
s_storageDirtyMsk -= EE_MODEL;
|
||||
storageDirtyMsk -= EE_MODEL;
|
||||
writeModel(g_eeGeneral.currModel);
|
||||
if (immediately)
|
||||
eepromWriteWait();
|
||||
|
||||
@@ -865,8 +865,8 @@ void RlcFile::flush()
|
||||
#if defined (EEPROM_PROGRESS_BAR)
|
||||
void RlcFile::DisplayProgressBar(uint8_t x)
|
||||
{
|
||||
if (s_storageDirtyMsk || isWriting() || eeprom_buffer_size) {
|
||||
uint8_t len = s_storageDirtyMsk ? 1 : limit((uint8_t)1, (uint8_t)(7 - (m_rlc_len/m_ratio)), (uint8_t)7);
|
||||
if (storageDirtyMsk || isWriting() || eeprom_buffer_size) {
|
||||
uint8_t len = storageDirtyMsk ? 1 : limit((uint8_t)1, (uint8_t)(7 - (m_rlc_len/m_ratio)), (uint8_t)7);
|
||||
drawFilledRect(x+1, 0, 5, FH, SOLID, ERASE);
|
||||
drawFilledRect(x+2, 7-len, 3, len);
|
||||
}
|
||||
@@ -940,16 +940,16 @@ void storageCheck(bool immediately)
|
||||
eeFlush();
|
||||
}
|
||||
|
||||
if (s_storageDirtyMsk & EE_GENERAL) {
|
||||
if (storageDirtyMsk & EE_GENERAL) {
|
||||
TRACE("eeprom write general");
|
||||
s_storageDirtyMsk -= EE_GENERAL;
|
||||
storageDirtyMsk -= EE_GENERAL;
|
||||
theFile.writeRlc(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&g_eeGeneral, sizeof(EEGeneral), immediately);
|
||||
if (!immediately) return;
|
||||
}
|
||||
|
||||
if (s_storageDirtyMsk & EE_MODEL) {
|
||||
if (storageDirtyMsk & EE_MODEL) {
|
||||
TRACE("eeprom write model");
|
||||
s_storageDirtyMsk = 0;
|
||||
storageDirtyMsk = 0;
|
||||
theFile.writeRlc(FILE_MODEL(g_eeGeneral.currModel), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model), immediately);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,9 +165,9 @@ void storageCheck(bool immediately)
|
||||
// eepromWriteWait();
|
||||
// }
|
||||
|
||||
if (s_storageDirtyMsk & EE_GENERAL) {
|
||||
if (storageDirtyMsk & EE_GENERAL) {
|
||||
TRACE("eeprom write general");
|
||||
s_storageDirtyMsk -= EE_GENERAL;
|
||||
storageDirtyMsk -= EE_GENERAL;
|
||||
writeGeneralSettings();
|
||||
// if (immediately)
|
||||
// eepromWriteWait();
|
||||
@@ -175,9 +175,9 @@ void storageCheck(bool immediately)
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_storageDirtyMsk & EE_MODEL) {
|
||||
if (storageDirtyMsk & EE_MODEL) {
|
||||
TRACE("eeprom write model");
|
||||
s_storageDirtyMsk -= EE_MODEL;
|
||||
storageDirtyMsk -= EE_MODEL;
|
||||
const char * error = writeModel();
|
||||
if (error) {
|
||||
TRACE("writeModel error=%s", error);
|
||||
|
||||
@@ -49,10 +49,10 @@
|
||||
#define WRITE_DELAY_10MS 200
|
||||
#endif
|
||||
|
||||
extern uint8_t s_storageDirtyMsk;
|
||||
extern tmr10ms_t s_storageDirtyTime10ms;
|
||||
extern uint8_t storageDirtyMsk;
|
||||
extern tmr10ms_t storageDirtyTime10ms;
|
||||
|
||||
#define TIME_TO_WRITE() (s_storageDirtyMsk && (tmr10ms_t)(get_tmr10ms() - s_storageDirtyTime10ms) >= (tmr10ms_t)WRITE_DELAY_10MS)
|
||||
#define TIME_TO_WRITE() (storageDirtyMsk && (tmr10ms_t)(get_tmr10ms() - storageDirtyTime10ms) >= (tmr10ms_t)WRITE_DELAY_10MS)
|
||||
|
||||
void storageEraseAll(bool warn);
|
||||
void storageFormat();
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
|
||||
#include "../opentx.h"
|
||||
|
||||
uint8_t s_storageDirtyMsk;
|
||||
tmr10ms_t s_storageDirtyTime10ms;
|
||||
uint8_t storageDirtyMsk;
|
||||
tmr10ms_t storageDirtyTime10ms;
|
||||
|
||||
void storageDirty(uint8_t msk)
|
||||
{
|
||||
s_storageDirtyMsk |= msk;
|
||||
s_storageDirtyTime10ms = get_tmr10ms() ;
|
||||
storageDirtyMsk |= msk;
|
||||
storageDirtyTime10ms = get_tmr10ms() ;
|
||||
}
|
||||
|
||||
void preModelLoad()
|
||||
|
||||
Reference in New Issue
Block a user