Narrow scope of EEPROM_MAX_WRITE_BLOCK to writeConfig (#881)
* EEPROM_MAX_WRITE_BLOCK can be local to writeConfig() This saves a byte of memory ;-) * Fix MISRA/lint warnings Correctly cast address parameter of eeprom_read_block Statically access table 3d type_key member * Remove force burn code - unused * Replace eepromWritesPending with bit set/check * Refactor: chain write_location instances. Clearer code.
This commit is contained in:
parent
bf23114b13
commit
3009c39767
|
@ -14,18 +14,9 @@ A full copy of the license may be found in the projects root directory
|
|||
#include "table3d_axis_io.h"
|
||||
|
||||
|
||||
|
||||
//The maximum number of write operations that will be performed in one go. If we try to write to the EEPROM too fast (Each write takes ~3ms) then the rest of the system can hang)
|
||||
#if defined(CORE_STM32) || defined(CORE_TEENSY) & !defined(USE_SPI_EEPROM)
|
||||
//#define EEPROM_MAX_WRITE_BLOCK 64
|
||||
uint8_t EEPROM_MAX_WRITE_BLOCK = 64;
|
||||
#else
|
||||
uint8_t EEPROM_MAX_WRITE_BLOCK = 24;
|
||||
//#define EEPROM_MAX_WRITE_BLOCK 8
|
||||
#endif
|
||||
|
||||
#define EEPROM_DATA_VERSION 0
|
||||
|
||||
|
||||
// Calibration data is stored at the end of the EEPROM (This is in case any further calibration tables are needed as they are large blocks)
|
||||
#define STORAGE_END 0xFFF // Should be E2END?
|
||||
#define EEPROM_CALIBRATION_CLT_VALUES (STORAGE_END-sizeof(cltCalibration_values))
|
||||
|
@ -36,13 +27,12 @@ A full copy of the license may be found in the projects root directory
|
|||
#define EEPROM_CALIBRATION_O2_BINS (EEPROM_CALIBRATION_O2_VALUES-sizeof(o2Calibration_bins))
|
||||
#define EEPROM_LAST_BARO (EEPROM_CALIBRATION_O2_BINS-1)
|
||||
|
||||
static bool eepromWritesPending = false;
|
||||
static bool forceBurn = false;
|
||||
|
||||
uint32_t deferEEPROMWritesUntil = 0;
|
||||
|
||||
bool isEepromWritePending()
|
||||
{
|
||||
return eepromWritesPending;
|
||||
return BIT_CHECK(currentStatus.status4, BIT_STATUS4_BURNPENDING);
|
||||
}
|
||||
|
||||
/** Write all config pages to EEPROM.
|
||||
|
@ -51,21 +41,21 @@ void writeAllConfig()
|
|||
{
|
||||
uint8_t pageCount = getPageCount();
|
||||
uint8_t page = 1U;
|
||||
writeConfig(page++);
|
||||
while (page<pageCount && ( !eepromWritesPending || forceBurn ) )
|
||||
writeConfig(page);
|
||||
page = page + 1;
|
||||
while (page<pageCount && !isEepromWritePending())
|
||||
{
|
||||
writeConfig(page++);
|
||||
writeConfig(page);
|
||||
page = page + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void enableForceBurn() { forceBurn = true; }
|
||||
void disableForceBurn() { forceBurn = false; }
|
||||
|
||||
|
||||
// ================================= Internal write support ===============================
|
||||
struct write_location {
|
||||
eeprom_address_t address;
|
||||
uint16_t counter;
|
||||
eeprom_address_t address; // EEPROM address to write next
|
||||
uint16_t counter; // Number of bytes written
|
||||
uint8_t write_block_size; // Maximum number of bytes to write
|
||||
|
||||
/** Update byte to EEPROM by first comparing content and the need to write it.
|
||||
We only ever write to the EEPROM where the new value is different from the currently stored byte
|
||||
|
@ -80,6 +70,13 @@ struct write_location {
|
|||
}
|
||||
}
|
||||
|
||||
/** Create a copy with a different write address.
|
||||
* Allows chaining of instances.
|
||||
*/
|
||||
write_location changeWriteAddress(eeprom_address_t newAddress) const {
|
||||
return { newAddress, counter, write_block_size };
|
||||
}
|
||||
|
||||
write_location& operator++()
|
||||
{
|
||||
++address;
|
||||
|
@ -89,8 +86,8 @@ struct write_location {
|
|||
bool can_write() const
|
||||
{
|
||||
bool canWrite = false;
|
||||
if(currentStatus.RPM > 0) { canWrite = (counter <= EEPROM_MAX_WRITE_BLOCK); }
|
||||
else { canWrite = (counter <= (EEPROM_MAX_WRITE_BLOCK * 8)); } //Write to EEPROM more aggressively if the engine is not running
|
||||
if(currentStatus.RPM > 0) { canWrite = (counter <= write_block_size); }
|
||||
else { canWrite = (counter <= (write_block_size * 8)); } //Write to EEPROM more aggressively if the engine is not running
|
||||
|
||||
return canWrite;
|
||||
}
|
||||
|
@ -98,7 +95,7 @@ struct write_location {
|
|||
|
||||
static inline write_location write_range(const byte *pStart, const byte *pEnd, write_location location)
|
||||
{
|
||||
while ( (location.can_write() || forceBurn) && pStart!=pEnd)
|
||||
while ( location.can_write() && pStart!=pEnd)
|
||||
{
|
||||
location.update(*pStart);
|
||||
++pStart;
|
||||
|
@ -114,7 +111,7 @@ static inline write_location write(const table_row_iterator &row, write_location
|
|||
|
||||
static inline write_location write(table_value_iterator it, write_location location)
|
||||
{
|
||||
while ((location.can_write() || forceBurn) && !it.at_end())
|
||||
while (location.can_write() && !it.at_end())
|
||||
{
|
||||
location = write(*it, location);
|
||||
++it;
|
||||
|
@ -125,7 +122,7 @@ static inline write_location write(table_value_iterator it, write_location locat
|
|||
static inline write_location write(table_axis_iterator it, write_location location)
|
||||
{
|
||||
const int16_byte *pConverter = table3d_axis_io::get_converter(it.domain());
|
||||
while ((location.can_write() || forceBurn) && !it.at_end())
|
||||
while (location.can_write() && !it.at_end())
|
||||
{
|
||||
location.update(pConverter->to_byte(*it));
|
||||
++location;
|
||||
|
@ -154,17 +151,30 @@ and writes them to EEPROM as per the layout defined in storage.h.
|
|||
*/
|
||||
void writeConfig(uint8_t pageNum)
|
||||
{
|
||||
write_location result = { 0, 0 };
|
||||
//The maximum number of write operations that will be performed in one go.
|
||||
//If we try to write to the EEPROM too fast (Each write takes ~3ms) then
|
||||
//the rest of the system can hang)
|
||||
#if defined(CORE_STM32) || defined(CORE_TEENSY) & !defined(USE_SPI_EEPROM)
|
||||
uint8_t EEPROM_MAX_WRITE_BLOCK = 64;
|
||||
#else
|
||||
uint8_t EEPROM_MAX_WRITE_BLOCK = 24;
|
||||
|
||||
#ifdef CORE_AVR
|
||||
//In order to prevent missed pulses during EEPROM writes on AVR, scale the maximum write block size based on the RPM
|
||||
//This calculation is based on EEPROM writes taking approximately 4ms per byte (Actual value is 3.8ms, so 4ms has some safety margin)
|
||||
if(currentStatus.RPM > 65) { EEPROM_MAX_WRITE_BLOCK = (15000 / currentStatus.RPM); } //Min RPM of 65 prevents overflow of uint8_t.
|
||||
else { EEPROM_MAX_WRITE_BLOCK = 24; }
|
||||
#ifdef CORE_AVR
|
||||
//In order to prevent missed pulses during EEPROM writes on AVR, scale the
|
||||
//maximum write block size based on the RPM.
|
||||
//This calculation is based on EEPROM writes taking approximately 4ms per byte
|
||||
//(Actual value is 3.8ms, so 4ms has some safety margin)
|
||||
if(currentStatus.RPM > 65) //Min RPM of 65 prevents overflow of uint8_t
|
||||
{
|
||||
EEPROM_MAX_WRITE_BLOCK = (uint8_t)(15000U / currentStatus.RPM);
|
||||
EEPROM_MAX_WRITE_BLOCK = max(EEPROM_MAX_WRITE_BLOCK, 1);
|
||||
EEPROM_MAX_WRITE_BLOCK = min(EEPROM_MAX_WRITE_BLOCK, 24); //Any higher than this will cause comms timeouts on AVR
|
||||
}
|
||||
#endif
|
||||
|
||||
if(EEPROM_MAX_WRITE_BLOCK < 1) { EEPROM_MAX_WRITE_BLOCK = 1; }
|
||||
if(EEPROM_MAX_WRITE_BLOCK > 24) { EEPROM_MAX_WRITE_BLOCK = 24; } //Any higher than this will cause comms timeouts on AVR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
write_location result = { 0, 0, EEPROM_MAX_WRITE_BLOCK };
|
||||
|
||||
switch(pageNum)
|
||||
{
|
||||
|
@ -173,7 +183,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Fuel table (See storage.h for data layout) - Page 1
|
||||
| 16x16 table itself + the 16 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&fuelTable, fuelTable.type_key, { EEPROM_CONFIG1_MAP, 0 });
|
||||
result = writeTable(&fuelTable, decltype(fuelTable)::type_key, result.changeWriteAddress(EEPROM_CONFIG1_MAP));
|
||||
break;
|
||||
|
||||
case veSetPage:
|
||||
|
@ -181,7 +191,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Config page 2 (See storage.h for data layout)
|
||||
| 64 byte long config table
|
||||
-----------------------------------------------------*/
|
||||
result = write_range((byte *)&configPage2, (byte *)&configPage2+sizeof(configPage2), { EEPROM_CONFIG2_START, 0 });
|
||||
result = write_range((byte *)&configPage2, (byte *)&configPage2+sizeof(configPage2), result.changeWriteAddress(EEPROM_CONFIG2_START));
|
||||
break;
|
||||
|
||||
case ignMapPage:
|
||||
|
@ -189,7 +199,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Ignition table (See storage.h for data layout) - Page 1
|
||||
| 16x16 table itself + the 16 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&ignitionTable, ignitionTable.type_key, { EEPROM_CONFIG3_MAP, 0 });
|
||||
result = writeTable(&ignitionTable, decltype(ignitionTable)::type_key, result.changeWriteAddress(EEPROM_CONFIG3_MAP));
|
||||
break;
|
||||
|
||||
case ignSetPage:
|
||||
|
@ -197,7 +207,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Config page 2 (See storage.h for data layout)
|
||||
| 64 byte long config table
|
||||
-----------------------------------------------------*/
|
||||
result = write_range((byte *)&configPage4, (byte *)&configPage4+sizeof(configPage4), { EEPROM_CONFIG4_START, 0 });
|
||||
result = write_range((byte *)&configPage4, (byte *)&configPage4+sizeof(configPage4), result.changeWriteAddress(EEPROM_CONFIG4_START));
|
||||
break;
|
||||
|
||||
case afrMapPage:
|
||||
|
@ -205,7 +215,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| AFR table (See storage.h for data layout) - Page 5
|
||||
| 16x16 table itself + the 16 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&afrTable, afrTable.type_key, { EEPROM_CONFIG5_MAP, 0 });
|
||||
result = writeTable(&afrTable, decltype(afrTable)::type_key, result.changeWriteAddress(EEPROM_CONFIG5_MAP));
|
||||
break;
|
||||
|
||||
case afrSetPage:
|
||||
|
@ -213,7 +223,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Config page 3 (See storage.h for data layout)
|
||||
| 64 byte long config table
|
||||
-----------------------------------------------------*/
|
||||
result = write_range((byte *)&configPage6, (byte *)&configPage6+sizeof(configPage6), { EEPROM_CONFIG6_START, 0 });
|
||||
result = write_range((byte *)&configPage6, (byte *)&configPage6+sizeof(configPage6), result.changeWriteAddress(EEPROM_CONFIG6_START));
|
||||
break;
|
||||
|
||||
case boostvvtPage:
|
||||
|
@ -221,9 +231,9 @@ void writeConfig(uint8_t pageNum)
|
|||
| Boost and vvt tables (See storage.h for data layout) - Page 8
|
||||
| 8x8 table itself + the 8 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&boostTable, boostTable.type_key, { EEPROM_CONFIG7_MAP1, 0 });
|
||||
result = writeTable(&vvtTable, vvtTable.type_key, { EEPROM_CONFIG7_MAP2, result.counter });
|
||||
result = writeTable(&stagingTable, stagingTable.type_key, { EEPROM_CONFIG7_MAP3, result.counter });
|
||||
result = writeTable(&boostTable, decltype(boostTable)::type_key, result.changeWriteAddress(EEPROM_CONFIG7_MAP1));
|
||||
result = writeTable(&vvtTable, decltype(vvtTable)::type_key, result.changeWriteAddress(EEPROM_CONFIG7_MAP2));
|
||||
result = writeTable(&stagingTable, decltype(stagingTable)::type_key, result.changeWriteAddress(EEPROM_CONFIG7_MAP3));
|
||||
break;
|
||||
|
||||
case seqFuelPage:
|
||||
|
@ -231,14 +241,14 @@ void writeConfig(uint8_t pageNum)
|
|||
| Fuel trim tables (See storage.h for data layout) - Page 9
|
||||
| 6x6 tables itself + the 6 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&trim1Table, trim1Table.type_key, { EEPROM_CONFIG8_MAP1, 0 });
|
||||
result = writeTable(&trim2Table, trim2Table.type_key, { EEPROM_CONFIG8_MAP2, result.counter });
|
||||
result = writeTable(&trim3Table, trim3Table.type_key, { EEPROM_CONFIG8_MAP3, result.counter });
|
||||
result = writeTable(&trim4Table, trim4Table.type_key, { EEPROM_CONFIG8_MAP4, result.counter });
|
||||
result = writeTable(&trim5Table, trim5Table.type_key, { EEPROM_CONFIG8_MAP5, result.counter });
|
||||
result = writeTable(&trim6Table, trim6Table.type_key, { EEPROM_CONFIG8_MAP6, result.counter });
|
||||
result = writeTable(&trim7Table, trim7Table.type_key, { EEPROM_CONFIG8_MAP7, result.counter });
|
||||
result = writeTable(&trim8Table, trim8Table.type_key, { EEPROM_CONFIG8_MAP8, result.counter });
|
||||
result = writeTable(&trim1Table, decltype(trim1Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG8_MAP1));
|
||||
result = writeTable(&trim2Table, decltype(trim2Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG8_MAP2));
|
||||
result = writeTable(&trim3Table, decltype(trim3Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG8_MAP3));
|
||||
result = writeTable(&trim4Table, decltype(trim4Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG8_MAP4));
|
||||
result = writeTable(&trim5Table, decltype(trim5Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG8_MAP5));
|
||||
result = writeTable(&trim6Table, decltype(trim6Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG8_MAP6));
|
||||
result = writeTable(&trim7Table, decltype(trim7Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG8_MAP7));
|
||||
result = writeTable(&trim8Table, decltype(trim8Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG8_MAP8));
|
||||
break;
|
||||
|
||||
case canbusPage:
|
||||
|
@ -246,7 +256,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Config page 10 (See storage.h for data layout)
|
||||
| 192 byte long config table
|
||||
-----------------------------------------------------*/
|
||||
result = write_range((byte *)&configPage9, (byte *)&configPage9+sizeof(configPage9), { EEPROM_CONFIG9_START, 0 });
|
||||
result = write_range((byte *)&configPage9, (byte *)&configPage9+sizeof(configPage9), result.changeWriteAddress(EEPROM_CONFIG9_START));
|
||||
break;
|
||||
|
||||
case warmupPage:
|
||||
|
@ -254,7 +264,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Config page 11 (See storage.h for data layout)
|
||||
| 192 byte long config table
|
||||
-----------------------------------------------------*/
|
||||
result = write_range((byte *)&configPage10, (byte *)&configPage10+sizeof(configPage10), { EEPROM_CONFIG10_START, 0});
|
||||
result = write_range((byte *)&configPage10, (byte *)&configPage10+sizeof(configPage10), result.changeWriteAddress(EEPROM_CONFIG10_START));
|
||||
break;
|
||||
|
||||
case fuelMap2Page:
|
||||
|
@ -262,7 +272,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Fuel table 2 (See storage.h for data layout)
|
||||
| 16x16 table itself + the 16 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&fuelTable2, fuelTable2.type_key, { EEPROM_CONFIG11_MAP, 0 });
|
||||
result = writeTable(&fuelTable2, decltype(fuelTable2)::type_key, result.changeWriteAddress(EEPROM_CONFIG11_MAP));
|
||||
break;
|
||||
|
||||
case wmiMapPage:
|
||||
|
@ -272,16 +282,16 @@ void writeConfig(uint8_t pageNum)
|
|||
| 8x8 VVT2 table + the 8 values along each of the axis
|
||||
| 4x4 Dwell table itself + the 4 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&wmiTable, wmiTable.type_key, { EEPROM_CONFIG12_MAP, 0 });
|
||||
result = writeTable(&vvt2Table, vvt2Table.type_key, { EEPROM_CONFIG12_MAP2, result.counter });
|
||||
result = writeTable(&dwellTable, dwellTable.type_key, { EEPROM_CONFIG12_MAP3, result.counter });
|
||||
result = writeTable(&wmiTable, decltype(wmiTable)::type_key, result.changeWriteAddress(EEPROM_CONFIG12_MAP));
|
||||
result = writeTable(&vvt2Table, decltype(vvt2Table)::type_key, result.changeWriteAddress(EEPROM_CONFIG12_MAP2));
|
||||
result = writeTable(&dwellTable, decltype(dwellTable)::type_key, result.changeWriteAddress(EEPROM_CONFIG12_MAP3));
|
||||
break;
|
||||
|
||||
case progOutsPage:
|
||||
/*---------------------------------------------------
|
||||
| Config page 13 (See storage.h for data layout)
|
||||
-----------------------------------------------------*/
|
||||
result = write_range((byte *)&configPage13, (byte *)&configPage13+sizeof(configPage13), { EEPROM_CONFIG13_START, 0});
|
||||
result = write_range((byte *)&configPage13, (byte *)&configPage13+sizeof(configPage13), result.changeWriteAddress(EEPROM_CONFIG13_START));
|
||||
break;
|
||||
|
||||
case ignMap2Page:
|
||||
|
@ -289,7 +299,7 @@ void writeConfig(uint8_t pageNum)
|
|||
| Ignition table (See storage.h for data layout) - Page 1
|
||||
| 16x16 table itself + the 16 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&ignitionTable2, ignitionTable2.type_key, { EEPROM_CONFIG14_MAP, 0 });
|
||||
result = writeTable(&ignitionTable2, decltype(ignitionTable2)::type_key, result.changeWriteAddress(EEPROM_CONFIG14_MAP));
|
||||
break;
|
||||
|
||||
case boostvvtPage2:
|
||||
|
@ -297,21 +307,19 @@ void writeConfig(uint8_t pageNum)
|
|||
| Boost duty cycle lookuptable (See storage.h for data layout) - Page 15
|
||||
| 8x8 table itself + the 8 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
result = writeTable(&boostTableLookupDuty, boostTableLookupDuty.type_key, { EEPROM_CONFIG15_MAP, result.counter });
|
||||
result = writeTable(&boostTableLookupDuty, decltype(boostTableLookupDuty)::type_key, result.changeWriteAddress(EEPROM_CONFIG15_MAP));
|
||||
|
||||
/*---------------------------------------------------
|
||||
| Config page 15 (See storage.h for data layout)
|
||||
-----------------------------------------------------*/
|
||||
result = write_range((byte *)&configPage15, (byte *)&configPage15+sizeof(configPage15), { EEPROM_CONFIG15_START, 0});
|
||||
result = write_range((byte *)&configPage15, (byte *)&configPage15+sizeof(configPage15), result.changeWriteAddress(EEPROM_CONFIG15_START));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
eepromWritesPending = !result.can_write();
|
||||
if(eepromWritesPending == true) { BIT_SET(currentStatus.status4, BIT_STATUS4_BURNPENDING); }
|
||||
else { BIT_CLEAR(currentStatus.status4, BIT_STATUS4_BURNPENDING); }
|
||||
BIT_WRITE(currentStatus.status4, BIT_STATUS4_BURNPENDING, !result.can_write());
|
||||
}
|
||||
|
||||
/** Reset all configPage* structs (2,4,6,9,10,13) and write them full of null-bytes.
|
||||
|
@ -344,7 +352,7 @@ static inline eeprom_address_t load_range(eeprom_address_t address, byte *pFirst
|
|||
#if defined(CORE_AVR)
|
||||
// The generic code in the #else branch works but this provides a 45% speed up on AVR
|
||||
size_t size = pLast-pFirst;
|
||||
eeprom_read_block(pFirst, (void*)address, size);
|
||||
eeprom_read_block(pFirst, (const void*)(size_t)address, size);
|
||||
return address+size;
|
||||
#else
|
||||
for (; pFirst != pLast; ++address, (void)++pFirst)
|
||||
|
@ -383,7 +391,7 @@ static inline eeprom_address_t load(table_axis_iterator it, eeprom_address_t add
|
|||
}
|
||||
|
||||
|
||||
static inline eeprom_address_t loadTable(void *pTable, table_type_t key, eeprom_address_t address)
|
||||
static inline eeprom_address_t loadTable(const void *pTable, table_type_t key, eeprom_address_t address)
|
||||
{
|
||||
return load(y_begin(pTable, key).reverse(),
|
||||
load(x_begin(pTable, key),
|
||||
|
@ -397,37 +405,37 @@ static inline eeprom_address_t loadTable(void *pTable, table_type_t key, eeprom_
|
|||
*/
|
||||
void loadConfig()
|
||||
{
|
||||
loadTable(&fuelTable, fuelTable.type_key, EEPROM_CONFIG1_MAP);
|
||||
loadTable(&fuelTable, decltype(fuelTable)::type_key, EEPROM_CONFIG1_MAP);
|
||||
load_range(EEPROM_CONFIG2_START, (byte *)&configPage2, (byte *)&configPage2+sizeof(configPage2));
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
//IGNITION CONFIG PAGE (2)
|
||||
|
||||
loadTable(&ignitionTable, ignitionTable.type_key, EEPROM_CONFIG3_MAP);
|
||||
loadTable(&ignitionTable, decltype(ignitionTable)::type_key, EEPROM_CONFIG3_MAP);
|
||||
load_range(EEPROM_CONFIG4_START, (byte *)&configPage4, (byte *)&configPage4+sizeof(configPage4));
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
//AFR TARGET CONFIG PAGE (3)
|
||||
|
||||
loadTable(&afrTable, afrTable.type_key, EEPROM_CONFIG5_MAP);
|
||||
loadTable(&afrTable, decltype(afrTable)::type_key, EEPROM_CONFIG5_MAP);
|
||||
load_range(EEPROM_CONFIG6_START, (byte *)&configPage6, (byte *)&configPage6+sizeof(configPage6));
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
// Boost and vvt tables load
|
||||
loadTable(&boostTable, boostTable.type_key, EEPROM_CONFIG7_MAP1);
|
||||
loadTable(&vvtTable, vvtTable.type_key, EEPROM_CONFIG7_MAP2);
|
||||
loadTable(&stagingTable, stagingTable.type_key, EEPROM_CONFIG7_MAP3);
|
||||
loadTable(&boostTable, decltype(boostTable)::type_key, EEPROM_CONFIG7_MAP1);
|
||||
loadTable(&vvtTable, decltype(vvtTable)::type_key, EEPROM_CONFIG7_MAP2);
|
||||
loadTable(&stagingTable, decltype(stagingTable)::type_key, EEPROM_CONFIG7_MAP3);
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
// Fuel trim tables load
|
||||
loadTable(&trim1Table, trim1Table.type_key, EEPROM_CONFIG8_MAP1);
|
||||
loadTable(&trim2Table, trim2Table.type_key, EEPROM_CONFIG8_MAP2);
|
||||
loadTable(&trim3Table, trim3Table.type_key, EEPROM_CONFIG8_MAP3);
|
||||
loadTable(&trim4Table, trim4Table.type_key, EEPROM_CONFIG8_MAP4);
|
||||
loadTable(&trim5Table, trim5Table.type_key, EEPROM_CONFIG8_MAP5);
|
||||
loadTable(&trim6Table, trim6Table.type_key, EEPROM_CONFIG8_MAP6);
|
||||
loadTable(&trim7Table, trim7Table.type_key, EEPROM_CONFIG8_MAP7);
|
||||
loadTable(&trim8Table, trim8Table.type_key, EEPROM_CONFIG8_MAP8);
|
||||
loadTable(&trim1Table, decltype(trim1Table)::type_key, EEPROM_CONFIG8_MAP1);
|
||||
loadTable(&trim2Table, decltype(trim2Table)::type_key, EEPROM_CONFIG8_MAP2);
|
||||
loadTable(&trim3Table, decltype(trim3Table)::type_key, EEPROM_CONFIG8_MAP3);
|
||||
loadTable(&trim4Table, decltype(trim4Table)::type_key, EEPROM_CONFIG8_MAP4);
|
||||
loadTable(&trim5Table, decltype(trim5Table)::type_key, EEPROM_CONFIG8_MAP5);
|
||||
loadTable(&trim6Table, decltype(trim6Table)::type_key, EEPROM_CONFIG8_MAP6);
|
||||
loadTable(&trim7Table, decltype(trim7Table)::type_key, EEPROM_CONFIG8_MAP7);
|
||||
loadTable(&trim8Table, decltype(trim8Table)::type_key, EEPROM_CONFIG8_MAP8);
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
//canbus control page load
|
||||
|
@ -440,13 +448,13 @@ void loadConfig()
|
|||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
//Fuel table 2 (See storage.h for data layout)
|
||||
loadTable(&fuelTable2, fuelTable2.type_key, EEPROM_CONFIG11_MAP);
|
||||
loadTable(&fuelTable2, decltype(fuelTable2)::type_key, EEPROM_CONFIG11_MAP);
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
// WMI, VVT2 and Dwell table load
|
||||
loadTable(&wmiTable, wmiTable.type_key, EEPROM_CONFIG12_MAP);
|
||||
loadTable(&vvt2Table, vvt2Table.type_key, EEPROM_CONFIG12_MAP2);
|
||||
loadTable(&dwellTable, dwellTable.type_key, EEPROM_CONFIG12_MAP3);
|
||||
loadTable(&wmiTable, decltype(wmiTable)::type_key, EEPROM_CONFIG12_MAP);
|
||||
loadTable(&vvt2Table, decltype(vvt2Table)::type_key, EEPROM_CONFIG12_MAP2);
|
||||
loadTable(&dwellTable, decltype(dwellTable)::type_key, EEPROM_CONFIG12_MAP3);
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
//CONFIG PAGE (13)
|
||||
|
@ -455,11 +463,11 @@ void loadConfig()
|
|||
//*********************************************************************************************************************************************************************************
|
||||
//SECOND IGNITION CONFIG PAGE (14)
|
||||
|
||||
loadTable(&ignitionTable2, ignitionTable2.type_key, EEPROM_CONFIG14_MAP);
|
||||
loadTable(&ignitionTable2, decltype(ignitionTable2)::type_key, EEPROM_CONFIG14_MAP);
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
//CONFIG PAGE (15) + boost duty lookup table (LUT)
|
||||
loadTable(&boostTableLookupDuty, boostTableLookupDuty.type_key, EEPROM_CONFIG15_MAP);
|
||||
loadTable(&boostTableLookupDuty, decltype(boostTableLookupDuty)::type_key, EEPROM_CONFIG15_MAP);
|
||||
load_range(EEPROM_CONFIG15_START, (byte *)&configPage15, (byte *)&configPage15+sizeof(configPage15));
|
||||
|
||||
//*********************************************************************************************************************************************************************************
|
||||
|
|
|
@ -125,8 +125,6 @@ void loadCalibration();
|
|||
void writeCalibration();
|
||||
void writeCalibrationPage(uint8_t pageNum);
|
||||
void resetConfigPages();
|
||||
void enableForceBurn();
|
||||
void disableForceBurn();
|
||||
|
||||
//These are utility functions that prevent other files from having to use EEPROM.h directly
|
||||
byte readLastBaro();
|
||||
|
|
Loading…
Reference in New Issue