public override void NameKnownMaps(byte[] allBytes, SymbolCollection newSymbols, List<CodeBlock> newCodeBlocks)
{
SymbolAxesTranslator st = new SymbolAxesTranslator();
foreach(SymbolHelper sh in newSymbols) {
if (Tools.Instance.m_carMake == CarMakes.BMW)
{
//Console.WriteLine("Flash startadress: " + sh.Flash_start_address);
// Look in X-axis for RPM
int maxX = 0;
int minX = 0;
int maxY = 0;
int minY = 0;
if (sh.Is1D)
{
maxX = (sh.Currentdata[2 + sh.X_axis_length * 2 - 2]) * 256 +
(sh.Currentdata[2 + sh.X_axis_length * 2 - 1]);
minX = maxX;/* (sh.Currentdata[2]) * 256 + (sh.Currentdata[3]); */
}
else
{
maxX = (sh.Currentdata[4 + sh.X_axis_length * 2 - 2]) * 256 +
(sh.Currentdata[4 + sh.X_axis_length * 2 - 1]);
minX = (sh.Currentdata[4]) * 256 + (sh.Currentdata[5]);
}
//Console.WriteLine("" + sh.Flash_start_address + sh.Y_axis_offset);
// Check max value in Y for 9200 -> RPM
if (sh.Is1D)
{
maxY = (sh.Currentdata[2 + sh.X_axis_length * 2 + sh.Y_axis_length * 2 - 2]) * 256 +
(sh.Currentdata[2 + sh.X_axis_length * 2 + sh.Y_axis_length * 2 - 1]);
minY = (sh.Currentdata[2 + sh.X_axis_length * 2]) * 256 +
(sh.Currentdata[2 + sh.X_axis_length * 2 + 1]);
}
else
{
maxY = (sh.Currentdata[4 + sh.X_axis_length * 2 + sh.Y_axis_length * 2 - 2]) * 256 +
(sh.Currentdata[4 + sh.X_axis_length * 2 + sh.Y_axis_length * 2 - 1]);
minY = (sh.Currentdata[4 + sh.X_axis_length * 2]) * 256 +
(sh.Currentdata[4 + sh.X_axis_length * 2 + 1]);
}
//Console.WriteLine("MinX=" + minX + ", maxX=" + maxX);
//Console.WriteLine("MinY=" + minY + ", maxY=" + maxY);
/*
if((maxX == 10000 && minX == 1400) || // 750->5000rpm
(maxX == 10000 && minX == 1000) || // 500->5000rpm
(maxX == 9200)) { // ->4600rpm
//sh.Category = "Partly detected maps";
//sh.Subcategory = "RPM";
sh.Y_axis_correction = 0.5;
sh.YaxisUnits = "rpm";
sh.Y_axis_descr = "rpm";
}
*/
// Temp-related X-axis
if ((minX >= 1731 && maxX <= 3931) &&
((minX - 31) % 50 == 0 ||
(maxX - 31) % 50 == 0
))
{
sh.X_axis_correction = 0.1;
sh.X_axis_offset = -273.1;
//sh.Correction = 0.1;
sh.Category = "Partly detected maps - temp";
sh.X_axis_descr = "Temperature";
sh.XaxisUnits = "C";
}
if ((sh.X_axis_length == 16 || sh.X_axis_length == 17) && sh.Y_axis_length == 40)
{
//Injection time
sh.Category = "Detected maps";
sh.Subcategory = "Injection timing";
sh.Varname = "Injection time [" + sh.Flash_start_address.ToString("X8") + "]";
sh.X_axis_correction = 0.01;
sh.XaxisUnits = "mm3/inj";
sh.X_axis_descr = "mm3/inj";
sh.Z_axis_descr = "time";
sh.Correction = 0.4;
sh.Y_axis_correction = 0.1;
sh.YaxisUnits = "bar";
sh.Y_axis_descr = "bar";
}
if (sh.X_axis_length == 16 && sh.Y_axis_length == 16 && (maxY == 7000 || maxY == 7500) && minY == 0)
{
// Todo! Check steps in X and/or Y to further isolate maps!
// Injection timing
sh.Category = "Detected maps";
sh.Subcategory = "Injection timing";
sh.Varname = "Injection timing map [" + sh.Flash_start_address.ToString("X8") + "]";
sh.X_axis_correction = 0.01;
sh.XaxisUnits = "mm3/cyc";
sh.X_axis_descr = "mm3/cyc";
sh.Z_axis_descr = "Injection timing";
sh.Correction = 0.021969;
}
if ((sh.X_axis_length == 14 && sh.Y_axis_length == 8))
{ //|| // 14x8
//(sh.X_axis_length == 8 && sh.Y_axis_length == 1 ) ) { // 8x1(0) torquelimiter
sh.Category = "Detected maps";
sh.Subcategory = "Torque";
sh.Varname = "Pedal request map [" + sh.Flash_start_address.ToString("X8") + "]";
sh.X_axis_correction = 0.01220703125;
sh.X_axis_descr = "Percent";
sh.Y_axis_correction = 0.5;
sh.Y_axis_descr = "RPM";
sh.Z_axis_descr = "Torque (Nm)";
sh.XaxisUnits = "%";
sh.Correction = 0.1;
}
if (sh.X_axis_length == 8 && sh.Y_axis_length == 10 &&
(maxY % 2 == 1 || minY % 2 == 1))
{ // 8x10 and odd data
sh.Category = "Detected maps";
sh.Subcategory = "Torque";
sh.Varname = "Torque limit given temp [" + sh.Flash_start_address.ToString("X8") + "]";
sh.Y_axis_correction = 0.5;
sh.Y_axis_descr = "RPM";
sh.X_axis_correction = 0.1;
sh.X_axis_offset = -273.1;
sh.Correction = 0.1;
sh.X_axis_descr = "Temperature";
sh.Z_axis_descr = "Torque (Nm)";
sh.XaxisUnits = "C";
}
if (sh.X_axis_length == 21 && sh.Y_axis_length == 3)
{ // 21x3, only one exist in BMW-files
sh.Category = "Detected maps";
sh.Subcategory = "Torque";
sh.Varname = "Torque limit for speed [" + sh.Flash_start_address.ToString("X8") + "]";
sh.Y_axis_correction = 0.5;
sh.Y_axis_descr = "RPM";
sh.X_axis_correction = 1;
sh.Correction = 0.1;
sh.X_axis_descr = "#";
sh.Z_axis_descr = "Torque (Nm)";
sh.XaxisUnits = "#";
}
/* // These addresses are only valid for one specific boschnumber.... Needs to be more general
if(sh.Flash_start_address == 0x75200 ||
sh.Flash_start_address == 0x75444 ||
sh.Flash_start_address == 0x75688) {
sh.Varname = "Fuel quantity injected [" + sh.Flash_start_address.ToString("X8") + "]";
sh.Category = "Detected maps";
sh.Subcategory = "Injected Fuel";
sh.Y_axis_correction = 0.5;
sh.YaxisUnits = "RPM";
sh.Y_axis_descr = "rpm";
sh.X_axis_correction = 0.1;
sh.XaxisUnits = "Nm";
sh.X_axis_descr = "Nm";
sh.Z_axis_descr = "Fuel injected quantity f(RPM,Trq)";
sh.Correction = 0.01;
}
if(sh.Flash_start_address == 0x52036) {
sh.Varname = "Gas quantity recirculation [" + sh.Flash_start_address.ToString("X8") + "]";
sh.Category = "Detected maps";
sh.Subcategory = "Air control";
sh.Y_axis_correction = 0.5;
sh.YaxisUnits = "RPM";
sh.Y_axis_descr = "rpm";
sh.X_axis_correction = 0.01;
sh.XaxisUnits = "mm3/hub";
sh.X_axis_descr = "mm3";
sh.Z_axis_descr = "Gas quantity";
sh.Correction = 0.1;
}
if(sh.Flash_start_address == 0x6EFE4) {
sh.Varname = "Limiter of turbo f(APS)[" + sh.Flash_start_address.ToString("X8") + "]";
sh.Category = "Detected maps";
sh.Subcategory = "Turbo";
sh.Y_axis_correction = 0.5;
sh.YaxisUnits = "RPM";
sh.Y_axis_descr = "rpm";
sh.X_axis_correction = 1;
sh.XaxisUnits = "hPa";
sh.X_axis_descr = "hPa";
sh.Z_axis_descr = "Pressure";
sh.Correction = 1;
}
*/
}
}
}