Initial work creating a new memory page (pg 11)

This commit is contained in:
Josh Stewart 2017-07-20 16:54:50 +10:00
parent 4d8ca38a05
commit ccb6e194b7
5 changed files with 94 additions and 6 deletions

View File

@ -99,7 +99,7 @@
endianness = little
nPages = 10
burnCommand = "B"
pageSize = 288, 64, 288, 64, 288, 64, 64, 160, 192, 128
pageSize = 288, 64, 288, 64, 288, 64, 64, 160, 192, 128, 192
; pageIdentifier = "\$tsCanId\x01", "\$tsCanId\x02", "\$tsCanId\x03", "\$tsCanId\x04", "\$tsCanId\x05", "\$tsCanId\x06", "\$tsCanId\x07", "\$tsCanId\x08", "\$tsCanId\x09", "\$tsCanId\x0A"
pageActivationDelay = 10
pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007", "P\010", "P\011", "P\012"
@ -1307,7 +1307,7 @@ menuDialog = main
field = "Re-sync every cycle", useResync, { TrigPattern == 2 || TrigPattern == 4 || TrigPattern == 7 } ;Dual wheel, 4G63 and Audi 135
field = ""
field = "#The below option is EXPERIMENTAL! If unsure what this is, please set to No"
field = "User per tooth ignition calculation", perToothIgn, {TrigPattern == 0} ;Only works for missing tooth
field = "User per tooth ignition calculation", perToothIgn, {TrigPattern == 0 || TrigPattern == 1 } ;Only works for missing tooth
dialog = sparkSettings,"Spark Settings",4
field = "Spark output mode", sparkMode

View File

@ -109,7 +109,7 @@ const char TSfirmwareVersion[] = "Speeduino 2016.09";
const byte data_structure_version = 2; //This identifies the data structure when reading / writing.
const byte page_size = 64;
const int npage_size[11] = {0,288,64,288,64,288,64,64,160,192,128};
//const byte page10_size = 128;
//const byte page11_size = 128;
#define MAP_PAGE_SIZE 288
struct table3D fuelTable; //16x16 fuel map
@ -123,6 +123,7 @@ struct table3D trim3Table; //6x6 Fuel trim 3 map
struct table3D trim4Table; //6x6 Fuel trim 4 map
struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
struct table2D crankingEnrichTable; //4 bin cranking Enrichment map (2D)
struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D)
struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D)
struct table2D IATDensityCorrectionTable; //9 bin inlet air temperature density correction (2D)
@ -564,6 +565,64 @@ struct config10 {
} __attribute__((__packed__)); //The 32 bit systems require all structs to be fully packed
#endif
/*
Page 11 - No specific purpose. Created initially for the cranking enrich curve
192 bytes long
See ini file for further info (Config Page 11 in the ini)
*/
struct config11 {
byte crankingEnrichBins[4];
byte crankingEnrichValues[4];
byte unused11_8;
byte unused11_9;
byte unused11_10;
byte unused11_11;
byte unused11_12;
byte unused11_13;
byte unused11_14;
byte unused11_15;
byte unused11_16;
byte unused11_17;
byte unused11_18;
byte unused11_19;
byte unused11_20;
byte unused10_21;
byte unused11_22;
byte unused11_23;
byte unused11_24;
byte unused11_25;
byte unused11_26;
byte unused11_27;
byte unused11_28;
byte unused11_29;
byte unused11_107;
byte unused11_108;
byte unused11_109;
byte unused11_110;
byte unused11_111;
byte unused11_112;
byte unused11_113;
byte unused11_114;
byte unused11_115;
byte unused11_116;
byte unused11_117;
byte unused11_118;
byte unused11_119;
byte unused11_120;
byte unused11_121;
byte unused11_122;
byte unused11_123;
byte unused11_124;
byte unused11_125;
byte unused11_126;
byte unused11_127;
byte unused11_128_192[64];
#if defined(CORE_AVR)
};
#else
} __attribute__((__packed__)); //The 32 bit systems require all structs to be fully packed
#endif
byte pinInjector1; //Output pin injector 1
byte pinInjector2; //Output pin injector 2
@ -631,10 +690,12 @@ extern struct table3D ignitionTable; //16x16 ignition map
extern struct table3D afrTable; //16x16 afr target map
extern struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
extern struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
extern struct table2D crankingEnrichTable; //4 bin cranking Enrichment map (2D)
extern struct config1 configPage1;
extern struct config2 configPage2;
extern struct config3 configPage3;
extern struct config10 configPage10;
extern struct config11 configPage11;
extern unsigned long currentLoopTime; //The time the current loop started (uS)
extern unsigned long previousLoopTime; //The time the previous loop started (uS)
extern byte ignitionCount;

View File

@ -54,6 +54,7 @@ struct config2 configPage2;
struct config3 configPage3;
struct config4 configPage4;
struct config10 configPage10;
struct config11 configPage11;
int req_fuel_uS, inj_opentime_uS;
@ -182,6 +183,10 @@ void setup()
WUETable.xSize = 10;
WUETable.values = configPage1.wueValues;
WUETable.axisX = configPage2.wueBins;
crankingEnrichTable.valueSize = SIZE_BYTE;
crankingEnrichTable.xSize = 4;
crankingEnrichTable.values = configPage11.crankingEnrichValues;
crankingEnrichTable.axisX = configPage11.crankingEnrichBins;
dwellVCorrectionTable.valueSize = SIZE_BYTE;
dwellVCorrectionTable.xSize = 6;
@ -1086,7 +1091,7 @@ void loop()
vvtControl();
idleControl(); //Perform any idle related actions. Even at higher frequencies, running 4x per second is sufficient.
}
if ((mainLoopCount & 1023) == 1) //Every 1024 loops
if ((mainLoopCount & 1023) == 1) //Every 1024 loops (Approx. 1 per second)
{
//Approx. once per second
readBaro();

View File

@ -48,7 +48,8 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
| 1441 |2 | X and Y size4 |
| 1443 |36 | PAGE 9 MAP4 |
| 1479 |6 | X and Y Bins4 |
| 1500 |128 | CANBUS config and data |
| 1500 |128 | CANBUS config and data (Table 10_) |
| 1628 |192 | Table 11 - General settings |
| |
| 2559 |512 | Calibration data (O2) |
| 3071 |512 | Calibration data (IAT) |
@ -115,6 +116,8 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#define EEPROM_CONFIG9_YBINS4 1485
#define EEPROM_CONFIG10_START 1500
#define EEPROM_CONFIG10_END 1628
#define EEPROM_CONFIG11_START 1628
#define EEPROM_CONFIG11_END 1820
//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 EEPROM_LAST_BARO 2558

View File

@ -271,8 +271,19 @@ void writeConfig()
{
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG10_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG10_START))); }
}
//*********************************************************************************************************************************************************************************
//*********************************************************************************************************************************************************************************
/*---------------------------------------------------
| Config page 11 (See storage.h for data layout)
| 192 byte long config table
-----------------------------------------------------*/
pnt_configPage = (byte *)&configPage11; //Create a pointer to Page 11 in memory
//As there are no 3d tables in this page, all 192 bytes can simply be read in
for(int x=EEPROM_CONFIG11_START; x<EEPROM_CONFIG11_END; x++)
{
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG11_START))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG11_START))); }
}
}
void loadConfig()
@ -476,6 +487,14 @@ void loadConfig()
//*********************************************************************************************************************************************************************************
//CONFIG PAGE (11)
pnt_configPage = (byte *)&configPage11; //Create a pointer to Page 11 in memory
//All 192 bytes can simply be pulled straight from the configTable
for(int x=EEPROM_CONFIG11_START; x<EEPROM_CONFIG11_END; x++)
{
*(pnt_configPage + byte(x - EEPROM_CONFIG11_START)) = EEPROM.read(x);
}
}
/*