Revert TS to using 1023 values for ADC calibration to allow custom WB entry

This commit is contained in:
Josh Stewart 2020-08-11 17:25:20 +10:00
parent 53c0dedde1
commit 9624985299
2 changed files with 53 additions and 41 deletions

View File

@ -4345,42 +4345,41 @@ cmdVSSratio6 = "E\x99\x06"
solution = "Custom inc File", fileBrowseGenerator
referenceTable = std_ms2geno2, "Calibrate AFR Table..."
topicHelp = "https://wiki.speeduino.com/en/configuration/Sensor_Calibration"
topicHelp = "https://wiki.speeduino.com/en/configuration/Sensor_Calibration"
tableIdentifier = 002, "AFR Table"
adcCount = 32 ; length of the table
bytesPerAdc = 1 ; using bytes
scale = 10 ; scale by 10 before sending to controller
adcCount = 1024 ; length of the table
bytesPerAdc = 1 ; using bytes
scale = 10 ; scale by 10 before sending to controller
;tableGenerator = Generator Type, Label, xUnits, yUnits, xLow, xHi, yLow, yHi
tableGenerator = linearGenerator, "Custom Linear WB", "Volts","AFR", 1, 4, 9.7, 18.7
tableGenerator = linearGenerator, "Custom Linear WB", "Volts","AFR", 1, 4, 9.7, 18.7
tableGenerator = fileBrowseGenerator, "Browse for Inc File"
; Note the addition off the 33x multiplier on all entries below. The original calibrations assumed a 10-bit adcValue but we are scaling this down, hence the additional multiplier
solutionsLabel = "EGO Sensor"
solutionsLabel = "EGO Sensor"
solution = " ", { } ; blank row in case no match found. Must reman at top.
solution = "Narrowband", { table(33*adcValue*5/1023 , "nb.inc") } ;
solution = "14Point7", { 10.0001 + ( 33 * adcValue * 0.0097752 )} ; 10.0001 causes 1 adc to round different for unique match.
solution = "AEM Linear AEM-30-42xx", { 9.72 + (33 * adcValue * 0.0096665) } ; 9.72:1 - 19.60:1
solution = "AEM Linear (30-2310 & 30-4900)", { 7.3125 + (33 * adcValue * 0.0116080) } ; 7.31:1 - 19.18:1
solution = "Autometer 0V=10:1, 4V=16:1", { 10 + (33 * adcValue * 0.0073313783) }
solution = "Ballenger AFR500 0V=9:1, 5V=16:1", { 9 + (33 * adcValue * 0.00684262) }
solution = "Ballenger AFR500 0V=6:1, 5V=20:1", { 6 + (33 * adcValue * 0.01368524) }
solution = "Daytona TwinTec", { 10.01 + (33 * adcValue * 0.0097752) }
solution = "DIY-WB", { table( 33 * adcValue/4, "WBlambda100MOT.inc")*14.7 / 100.0 }
solution = "DynoJet Wideband Commander", { 33 * adcValue * 0.00784325 + 10 }
solution = "F.A.S.T. Wideband", { 33 * adcValue * 0.01357317 + 9.6 } ; 838.8608
solution = "FJO WB", { table(33 * adcValue*5/1023 , "fjoWB.inc" ) }
solution = "Innovate LC-1 / LC-2 Default", { 7.35 + (33 * adcValue * 0.01470186 )}
solution = "Innovate / PLX 0.0-5.0 10:1-20:1", { 10 + (33 * adcValue * 0.0097752)}
solution = "Innovate 1.0-2.0", { 33 * adcValue * 0.049025}
solution = "LambdaBoy", { table(33 * adcValue*5/1023 , "lambdaBoy.inc" ) }
solution = "NGK Powerdex", { 9 + ( 33 * adcValue * 0.0068359375 ) }
solution = "TechEdge DIY Non-Linear", { table(33 * adcValue*5/1023 , "TechEdge_DIYwbo2.inc") }
solution = "TechEdge Linear", { 33 * adcValue * 0.0097752 + 9 }
solution = "Zeitronix - Non Linear", { table(33 * adcValue*5/1023 , "zeitronix.inc") }
solution = "Zeitronix - Linear Default", { 9.6 + (33 * adcValue * 0.0097752) }
solution = "Narrowband", { table(adcValue*5/1023 , "nb.inc") } ;
solution = "14Point7", { 10.0001 + ( adcValue * 0.0097752 )} ; 10.0001 causes 1 adc to round different for unique match.
solution = "AEM Linear AEM-30-42xx", { 9.72 + (adcValue * 0.0096665) } ; 9.72:1 - 19.60:1
solution = "AEM Linear (30-2310 & 30-4900)", { 7.3125 + (adcValue * 0.0116080) } ; 7.31:1 - 19.18:1
solution = "Autometer 0V=10:1, 4V=16:1", { 10 + (adcValue * 0.0073313783) }
solution = "Ballenger AFR500 0V=9:1, 5V=16:1", { 9 + (adcValue * 0.00684262) }
solution = "Ballenger AFR500 0V=6:1, 5V=20:1", { 6 + (adcValue * 0.01368524) }
solution = "Daytona TwinTec", { 10.01 + (adcValue * 0.0097752) }
solution = "DIY-WB", { table( adcValue/4, "WBlambda100MOT.inc")*14.7 / 100.0 }
solution = "DynoJet Wideband Commander", { adcValue * 0.00784325 + 10 }
solution = "F.A.S.T. Wideband", { adcValue * 0.01357317 + 9.6 } ; 838.8608
solution = "FJO WB", { table(adcValue*5/1023 , "fjoWB.inc" ) }
solution = "Innovate LC-1 / LC-2 Default", { 7.35 + (adcValue * 0.01470186 )}
solution = "Innovate / PLX 0.0-5.0 10:1-20:1", { 10 + (adcValue * 0.0097752)}
solution = "Innovate 1.0-2.0", { adcValue * 0.049025}
solution = "LambdaBoy", { table(adcValue*5/1023 , "lambdaBoy.inc" ) }
solution = "NGK Powerdex", { 9 + ( adcValue * 0.0068359375 ) }
solution = "TechEdge DIY Non-Linear", { table(adcValue*5/1023 , "TechEdge_DIYwbo2.inc") }
solution = "TechEdge Linear", { adcValue * 0.0097752 + 9 }
solution = "Zeitronix - Non Linear", { table(adcValue*5/1023 , "zeitronix.inc") }
solution = "Zeitronix - Linear Default", { 9.6 + (adcValue * 0.0097752) }
solution = "Custom Linear WB", linearGenerator
solution = "Custom inc File", fileBrowseGenerator
solution = "Custom Linear WB", linearGenerator
solution = "Custom inc File", fileBrowseGenerator
[Tools]
;addTool = toolName, PanelName

View File

@ -1745,14 +1745,26 @@ void receiveCalibration(byte tableID)
int tempValue;
byte tempBuffer[2];
for (byte x = 0; x < 32; x++)
if(tableID == 2)
{
if (BYTES_PER_VALUE == 1)
//O2 calibration. Comes through as 1024 8-bit values of which we use every 32nd
for (int x = 0; x < 1024; x++)
{
while ( Serial.available() < 1 ) {}
tempValue = Serial.read();
if( (x % 32) == 0)
{
((uint8_t*)pnt_TargetTable_values)[(x/32)] = (byte)tempValue; //O2 table stores 8 bit values
pnt_TargetTable_bins[(x/32)] = (x);
}
}
else
}
else
{
//Temperature calibrations are sent as 32 16-bit values
for (byte x = 0; x < 32; x++)
{
while ( Serial.available() < 2 ) {}
tempBuffer[0] = Serial.read();
@ -1760,16 +1772,17 @@ void receiveCalibration(byte tableID)
tempValue = div(int(word(tempBuffer[1], tempBuffer[0])), DIVISION_FACTOR).quot; //Read 2 bytes, convert to word (an unsigned int), convert to signed int. These values come through * 10 from Tuner Studio
tempValue = ((tempValue - 32) * 5) / 9; //Convert from F to C
}
//Apply the temp offset and check that it results in all values being positive
tempValue = tempValue + OFFSET;
if (tempValue < 0) { tempValue = 0; }
//Apply the temp offset and check that it results in all values being positive
tempValue = tempValue + OFFSET;
if (tempValue < 0) { tempValue = 0; }
if(tableID == 2) { ((uint8_t*)pnt_TargetTable_values)[x] = (byte)tempValue; } //O2 table stores 8 bit values
else { ((uint16_t*)pnt_TargetTable_values)[x] = tempValue; } //Both temp tables have 16-bit values
pnt_TargetTable_bins[x] = (x * 32);
((uint16_t*)pnt_TargetTable_values)[x] = tempValue; //Both temp tables have 16-bit values
pnt_TargetTable_bins[x] = (x * 32);
}
}
writeCalibration();
}