Speeduino
Loading...
Searching...
No Matches
storage.h
Go to the documentation of this file.
1#ifndef STORAGE_H
2#define STORAGE_H
3
123void writeAllConfig(void);
125void EEPROMWriteRaw(uint16_t address, uint8_t data);
127void loadConfig(void);
128void loadCalibration(void);
129void writeCalibration(void);
131void resetConfigPages(void);
132
133//These are utility functions that prevent other files from having to use EEPROM.h directly
134byte readLastBaro(void);
135void storeLastBaro(byte newValue);
143bool isEepromWritePending(void);
144
146
147#define EEPROM_CONFIG1_MAP 3
148#define EEPROM_CONFIG2_START 291
149#define EEPROM_CONFIG2_END 419
150#define EEPROM_CONFIG3_MAP 421
151#define EEPROM_CONFIG4_START 709
152#define EEPROM_CONFIG4_END 837
153#define EEPROM_CONFIG5_MAP 839
154#define EEPROM_CONFIG6_START 1127
155#define EEPROM_CONFIG6_END 1255
156#define EEPROM_CONFIG7_MAP1 1257
157#define EEPROM_CONFIG7_MAP2 1339
158#define EEPROM_CONFIG7_MAP3 1421
159#define EEPROM_CONFIG7_END 1501
160#define EEPROM_CONFIG8_MAP1 1503
161#define EEPROM_CONFIG8_MAP2 1553
162#define EEPROM_CONFIG8_MAP3 1603
163#define EEPROM_CONFIG8_MAP4 1653
164#define EEPROM_CONFIG9_START 1710
165#define EEPROM_CONFIG9_END 1902
166#define EEPROM_CONFIG10_START 1902
167#define EEPROM_CONFIG10_END 2094
168#define EEPROM_CONFIG11_MAP 2096
169#define EEPROM_CONFIG11_END 2385
170#define EEPROM_CONFIG12_MAP 2387
171#define EEPROM_CONFIG12_MAP2 2469
172#define EEPROM_CONFIG12_MAP3 2551
173#define EEPROM_CONFIG12_END 2575
174#define EEPROM_CONFIG13_START 2580
175#define EEPROM_CONFIG13_END 2708
176#define EEPROM_CONFIG14_MAP 2710
177#define EEPROM_CONFIG14_END 2998
178//This is OUT OF ORDER as Page 8 was expanded to add fuel trim tables 5-8. The EEPROM for them is simply added here so as not to impact existing tunes
179#define EEPROM_CONFIG8_MAP5 3001
180#define EEPROM_CONFIG8_MAP6 3051
181#define EEPROM_CONFIG8_MAP7 3101
182#define EEPROM_CONFIG8_MAP8 3151
183
184//Page 15 added after OUT OF ORDER page 8
185#define EEPROM_CONFIG15_MAP 3199
186#define EEPROM_CONFIG15_START 3281
187#define EEPROM_CONFIG15_END 3457
188
189
190#define EEPROM_CALIBRATION_CLT_CRC 3674
191#define EEPROM_CALIBRATION_IAT_CRC 3678
192#define EEPROM_CALIBRATION_O2_CRC 3682
193
194//These were the values used previously when all calibration tables were 512 long. They need to be retained so the update process (202005 -> 202008) can work
195#define EEPROM_CALIBRATION_O2_OLD 2559
196#define EEPROM_CALIBRATION_IAT_OLD 3071
197#define EEPROM_CALIBRATION_CLT_OLD 3583
198
199#define EEPROM_DEFER_DELAY MICROS_PER_SEC //1.0 second pause after large comms before writing to EEPROM
200
201#endif // STORAGE_H
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
void storeLastBaro(byte newValue)
Write last acquired arometer reading to EEPROM.
Definition storage.cpp:629
void writeConfig(uint8_t pageNum)
Definition storage.cpp:158
void writeAllConfig(void)
Definition storage.cpp:46
void storePageCRC32(uint8_t pageNum, uint32_t crcValue)
Definition storage.cpp:552
byte readLastBaro(void)
Read last stored barometer reading from EEPROM.
Definition storage.cpp:627
uint8_t EEPROMReadRaw(uint16_t address)
Definition storage.cpp:150
void loadCalibration(void)
Definition storage.cpp:489
void resetConfigPages(void)
Definition storage.cpp:337
void writeCalibration(void)
Definition storage.cpp:508
void EEPROMWriteRaw(uint16_t address, uint8_t data)
Definition storage.cpp:149
void loadConfig(void)
Definition storage.cpp:416
uint16_t getEEPROMSize(void)
Definition storage.cpp:619
uint32_t readPageCRC32(uint8_t pageNum)
Definition storage.cpp:560
uint32_t deferEEPROMWritesUntil
Definition storage.cpp:37
uint32_t readCalibrationCRC32(uint8_t calibrationPageNum)
Definition storage.cpp:595
void writeCalibrationPage(uint8_t pageNum)
Definition storage.cpp:523
bool isEepromWritePending(void)
Definition storage.cpp:39
void storeCalibrationCRC32(uint8_t calibrationPageNum, uint32_t calibrationCRC)
Definition storage.cpp:570
uint8_t readEEPROMVersion(void)
Read EEPROM current data format version (from offset EEPROM_DATA_VERSION).
Definition storage.cpp:631
void storeEEPROMVersion(byte newVersion)
Store EEPROM current data format version (to offset EEPROM_DATA_VERSION).
Definition storage.cpp:633