Merge branch 'master' into pr/435

This commit is contained in:
Josh Stewart 2020-08-23 08:24:59 +10:00
commit 5e3cf3fca6
24 changed files with 2479 additions and 1538 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
MTversion = 2.25
queryCommand = "Q"
signature = "speeduino 202006-dev"
signature = "speeduino 202009-dev"
versionInfo = "S" ;This info is what is displayed to user
[TunerStudio]
@ -79,7 +79,7 @@
#define fullStatus_def = $fullStatus_def_1, $fullStatus_def_2, $fullStatus_def_3, $fullStatus_def_4
boostTableLabels = bits, U08, [0:1], "Duty Cycle %", "kPa"
prgm_out_selection = bits, U08, [0:7], "1", "2", "3", "4", "5", "6", "7", "8"
prgm_out_selection = bits, U08, [0:2], "1", "2", "3", "4", "5", "6", "7", "8"
fuelLoadMax = scalar, U08, "", 1, 0, 0, 511, 0
ignLoadMax = scalar, U08, "", 1, 0, 0, 511, 0
@ -614,7 +614,7 @@ page = 6
fuelTrimEnabled= bits, U08, 60, [2:2], "No", "Yes"
flatSEnable = bits, U08, 60, [3:3], "No", "Yes"
; Baro Sensor pin
baroPin = bits, U08, 60, [4:7], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A8", "A10", "A11", "A12", "A13", "A14", "A15"
baroPin = bits, U08, 60, [4:7], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15"
; Flat shift
flatSSoftWin = scalar, U08, 61, "rpm", 100, 0.0, 100, 25500, 0
@ -959,7 +959,7 @@ page = 10
rotaryType = bits , U08, 8, [0:1], "FC", "FD", "RX8", "INVALID"
stagingEnabled = bits , U08, 8, [2:2], "Off","On"
stagingMode = bits , U08, 8, [3:3], "Table","Automatic"
EMAPPin = bits, U08, 8, [4:7], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A8", "A10", "A11", "A12", "A13", "A14", "A15"
EMAPPin = bits, U08, 8, [4:7], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15"
rotarySplitValues = array, U08, 9, [8], "degrees", 1.0, 0.0, 0.0, 40, 0
rotarySplitBins = array, U08, 17, [8], { bitStringValue(algorithmUnits , algorithm) }, 2.0, 0.0, 0.0, {fuelLoadMax}, 0
@ -1058,8 +1058,8 @@ page = 10
oilPressureEnable = bits, U08, 135, [1:1], "Off", "On"
oilPressureProtEnbl = bits, U08, 135, [2:2], "Off", "On"
fuelPressurePin = bits, U08, 136, [0:3], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A8", "A10", "A11", "A12", "A13", "A14", "A15"
oilPressurePin = bits, U08, 136, [4:7], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A8", "A10", "A11", "A12", "A13", "A14", "A15"
fuelPressurePin = bits, U08, 136, [0:3], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15"
oilPressurePin = bits, U08, 136, [4:7], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15"
fuelPressureMin = scalar, S08, 137, "psi", 1.0, 0.0, -100, 127, 0 ;Note signed int
fuelPressureMax = scalar, U08, 138, "psi", 1.0, 0.0, 0.0, 255, 0
@ -1101,8 +1101,16 @@ page = 10
vvtCLminDuty = scalar, U08, 171, "%", 1.0, 0.0, 0.0, 100.0, 0 ; Minimum and maximum duty cycles when using closed loop
vvtCLmaxDuty = scalar, U08, 172, "%", 1.0, 0.0, 0.0, 100.0, 0
vvt2Pin = bits , U08, 173, [0:5], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
unused11_174_191 = array, U08, 174, [18], "RPM", 100.0, 0.0, 100, 25500, 0
;Fuel temperature correction
#if CELSIUS
fuelTempBins = array, U08, 174, [6], "C", 1.0, -40, -40, 215, 0
#else
fuelTempBins = array, U08, 174, [6], "F", 1.8, -22.23, -40, 215, 0
#endif
fuelTempValues = array, U08, 180, [6], "%", 1.0, 0.0, 0, 255, 0
unused11_187_191 = array, U08, 186, [6], "RPM", 100.0, 0.0, 100, 25500, 0
;Page 11 is the fuel map and axis bins only
page = 11
@ -1143,24 +1151,25 @@ page = 13
outputPin6 = bits U08, 8, [0:7], $comp_IO_Pins
outputPin7 = bits U08, 9, [0:7], $comp_IO_Pins
outputDelay = array, U08, 10, [ 8], "S", 0.1, 0.0, 0.0, 25.5, 1
firstDataIn = array, U16, 18, [ 8], "", 1.0, 0.0, 0.0, 65535.0, 0
firstDataIn0= bits U16, 18, [0:7], $fullStatus_def
firstDataIn1= bits U16, 20, [0:7], $fullStatus_def
firstDataIn2= bits U16, 22, [0:7], $fullStatus_def
firstDataIn3= bits U16, 24, [0:7], $fullStatus_def
firstDataIn4= bits U16, 26, [0:7], $fullStatus_def
firstDataIn5= bits U16, 28, [0:7], $fullStatus_def
firstDataIn6= bits U16, 30, [0:7], $fullStatus_def
firstDataIn7= bits U16, 32, [0:7], $fullStatus_def
secondDataIn = array, U16, 34, [ 8], "", 1.0, 0.0, 0.0, 65535.0, 0
secondDataIn0= bits U16, 34, [0:7], $fullStatus_def
secondDataIn1= bits U16, 36, [0:7], $fullStatus_def
secondDataIn2= bits U16, 38, [0:7], $fullStatus_def
secondDataIn3= bits U16, 40, [0:7], $fullStatus_def
secondDataIn4= bits U16, 42, [0:7], $fullStatus_def
secondDataIn5= bits U16, 44, [0:7], $fullStatus_def
secondDataIn6= bits U16, 46, [0:7], $fullStatus_def
secondDataIn7= bits U16, 48, [0:7], $fullStatus_def
firstDataIn = array, U08, 18, [ 8], "", 1.0, 0.0, 0.0, 65535.0, 0
firstDataIn0= bits U08, 18, [0:7], $fullStatus_def
firstDataIn1= bits U08, 19, [0:7], $fullStatus_def
firstDataIn2= bits U08, 20, [0:7], $fullStatus_def
firstDataIn3= bits U08, 21, [0:7], $fullStatus_def
firstDataIn4= bits U08, 22, [0:7], $fullStatus_def
firstDataIn5= bits U08, 23, [0:7], $fullStatus_def
firstDataIn6= bits U08, 24, [0:7], $fullStatus_def
firstDataIn7= bits U08, 25, [0:7], $fullStatus_def
secondDataIn = array, U08, 26, [ 8], "", 1.0, 0.0, 0.0, 65535.0, 0
secondDataIn0= bits U08, 27, [0:7], $fullStatus_def
secondDataIn1= bits U08, 28, [0:7], $fullStatus_def
secondDataIn2= bits U08, 29, [0:7], $fullStatus_def
secondDataIn3= bits U08, 30, [0:7], $fullStatus_def
secondDataIn4= bits U08, 31, [0:7], $fullStatus_def
secondDataIn5= bits U08, 32, [0:7], $fullStatus_def
secondDataIn6= bits U08, 33, [0:7], $fullStatus_def
secondDataIn7= bits U08, 34, [0:7], $fullStatus_def
unused13_35_49 = array, U08, 35, [ 16] "%", 1.0, 0.0, 0.0, 100.0, 0
firstTarget = array, S16, 50, [ 8], "", 1.0, 0.0, -32768.0, 32768.0, 0
secondTarget = array, S16, 66, [ 8], "", 1.0, 0.0, -32768.0, 32768.0, 0
firstCompType0 = bits, U08, 82, [0:2], $comparator_def
@ -1528,7 +1537,7 @@ menuDialog = main
subMenu = std_realtime, "Realtime Display"
subMenu = accelEnrichments, "Acceleration Enrichment"
subMenu = egoControl, "AFR/O2", 3
subMenu = RevLimiterS, "Limiters", 2
subMenu = RevLimiterS, "Engine Protection", 2
subMenu = flexFueling, "Flex Fuel", 2
subMenu = veTableDialog, "VE Table", 0
subMenu = sparkTbl, "Spark Table", 2
@ -1538,6 +1547,8 @@ menuDialog = main
subMenu = spark2Tbl, "Second spark Table", 14, { fuel2Mode }
subMenu = inj_trimad, "Sequential fuel trim", 9
subMenu = stagingTableDialog, "Staged Injection", 10, { nCylinders <= 4 } ; Can't do staging on more than 4 cylinder engines
subMenu = std_separator
subMenu = fuelTemp_curve, "Fuel Temp Correction", { flexEnabled }
menu = "&Spark"
subMenu = sparkSettings, "Spark Settings"
@ -3631,28 +3642,151 @@ menuDialog = main
panel = prgm_out_pin_selection_8
panel = prgm_out_pin_selection_9
dialog = prgm_out_rules_1_condition_1, "", xAxis
;Rule 1
dialog = prgm_out_rules_1_condition_1, "Condition 1", xAxis
field = "", firstDataIn0, {outputPin[0]}
field = "", firstCompType0, {outputPin[0]}
field = "", firstTarget[0], {outputPin[0]}
dialog = prgm_out_rules_1_condition_2, "", xAxis
field = "", bitwise0, {outputPin[0] && bitwise0}
dialog = prgm_out_rules_1_condition_2, "Condition 2", xAxis
field = "", secondDataIn0, {outputPin[0] && bitwise0}
field = "", secondCompType0, {outputPin[0] && bitwise0}
field = "", secondTarget[0], {outputPin[0] && bitwise0}
;Rule 2
dialog = prgm_out_rules_2_condition_1, "Condition 1", xAxis
field = "", firstDataIn1, {outputPin[1]}
field = "", firstCompType1, {outputPin[1]}
field = "", firstTarget[1], {outputPin[1]}
dialog = prgm_out_rules_2_condition_2, "Condition 2", xAxis
field = "", secondDataIn1, {outputPin[1] && bitwise1}
field = "", secondCompType1, {outputPin[1] && bitwise1}
field = "", secondTarget[1], {outputPin[1] && bitwise1}
;Rule 3
dialog = prgm_out_rules_3_condition_1, "Condition 1", xAxis
field = "", firstDataIn2, {outputPin[2]}
field = "", firstCompType2, {outputPin[2]}
field = "", firstTarget[2], {outputPin[2]}
dialog = prgm_out_rules_3_condition_2, "Condition 2", xAxis
field = "", secondDataIn2, {outputPin[2] && bitwise2}
field = "", secondCompType2, {outputPin[2] && bitwise2}
field = "", secondTarget[2], {outputPin[2] && bitwise2}
;Rule 4
dialog = prgm_out_rules_4_condition_1, "Condition 1", xAxis
field = "", firstDataIn3, {outputPin[3]}
field = "", firstCompType3, {outputPin[3]}
field = "", firstTarget[3], {outputPin[3]}
dialog = prgm_out_rules_4_condition_2, "Condition 2", xAxis
field = "", secondDataIn3, {outputPin[3] && bitwise3}
field = "", secondCompType3, {outputPin[3] && bitwise3}
field = "", secondTarget[3], {outputPin[3] && bitwise3}
;Rule 5
dialog = prgm_out_rules_5_condition_1, "Condition 1", xAxis
field = "", firstDataIn4, {outputPin[4]}
field = "", firstCompType4, {outputPin[4]}
field = "", firstTarget[4], {outputPin[4]}
dialog = prgm_out_rules_5_condition_2, "Condition 2", xAxis
field = "", secondDataIn4, {outputPin[4] && bitwise4}
field = "", secondCompType4, {outputPin[4] && bitwise4}
field = "", secondTarget[4], {outputPin[4] && bitwise4}
;Rule 6
dialog = prgm_out_rules_6_condition_1, "Condition 1", xAxis
field = "", firstDataIn5, {outputPin[5]}
field = "", firstCompType5, {outputPin[5]}
field = "", firstTarget[5], {outputPin[5]}
dialog = prgm_out_rules_6_condition_2, "Condition 2", xAxis
field = "", secondDataIn5, {outputPin[5] && bitwise5}
field = "", secondCompType5, {outputPin[5] && bitwise5}
field = "", secondTarget[5], {outputPin[5] && bitwise5}
;Rule 7
dialog = prgm_out_rules_7_condition_1, "Condition 1", xAxis
field = "", firstDataIn6, {outputPin[6]}
field = "", firstCompType6, {outputPin[6]}
field = "", firstTarget[6], {outputPin[6]}
dialog = prgm_out_rules_7_condition_2, "Condition 2", xAxis
field = "", secondDataIn6, {outputPin[6] && bitwise6}
field = "", secondCompType6, {outputPin[6] && bitwise6}
field = "", secondTarget[6], {outputPin[6] && bitwise6}
;Rule 8
dialog = prgm_out_rules_8_condition_1, "Condition 1", xAxis
field = "", firstDataIn7, {outputPin[7]}
field = "", firstCompType7, {outputPin[7]}
field = "", firstTarget[7], {outputPin[7]}
dialog = prgm_out_rules_8_condition_2, "Condition 2", xAxis
field = "", secondDataIn7, {outputPin[7] && bitwise7}
field = "", secondCompType7, {outputPin[7] && bitwise7}
field = "", secondTarget[7], {outputPin[7] && bitwise7}
dialog = prgm_out_rules_1, "Rule 1", yAxis
field = "Pin Num", outputPin0
field = "", prgm_out00Alias, {outputPin[0]}
field = "#Condition 1"
panel = prgm_out_rules_1_condition_1
field = "#Condition 1"
field = "Output Pin Num", outputPin0
field = "Rule Alias", prgm_out00Alias, {outputPin[0]}
field = "Output Polarity", outputInverted0, {outputPin[0]}
field = "Activation Delay", outputDelay[0], {outputPin[0]}
field = "2nd Condition", bitwise0, {outputPin[0]}
panel = prgm_out_rules_1_condition_1
panel = prgm_out_rules_1_condition_2
dialog = prgm_out_rules_2, "Rule 2", xAxis
field = "Pin No:"
field = "", outputPin1
dialog = prgm_out_rules_2, "Rule 2", yAxis
field = "Output Pin Num", outputPin1
field = "Rule Alias", prgm_out01Alias, {outputPin[1]}
field = "Output Polarity", outputInverted1, {outputPin[1]}
field = "Activation Delay", outputDelay[1], {outputPin[1]}
field = "2nd Condition", bitwise1, {outputPin[1]}
panel = prgm_out_rules_2_condition_1
panel = prgm_out_rules_2_condition_2
dialog = prgm_out_rules_3, "Rule 3", yAxis
field = "Output Pin Num", outputPin2
field = "Rule Alias", prgm_out02Alias, {outputPin[2]}
field = "Output Polarity", outputInverted2, {outputPin[2]}
field = "Activation Delay", outputDelay[2], {outputPin[2]}
field = "2nd Condition", bitwise2, {outputPin[2]}
panel = prgm_out_rules_3_condition_1
panel = prgm_out_rules_3_condition_2
dialog = prgm_out_rules_4, "Rule 4", yAxis
field = "Output Pin Num", outputPin3
field = "Rule Alias", prgm_out03Alias, {outputPin[3]}
field = "Output Polarity", outputInverted3, {outputPin[3]}
field = "Activation Delay", outputDelay[3], {outputPin[3]}
field = "2nd Condition", bitwise3, {outputPin[3]}
panel = prgm_out_rules_4_condition_1
panel = prgm_out_rules_4_condition_2
dialog = prgm_out_rules_5, "Rule 5", yAxis
field = "Output Pin Num", outputPin4
field = "Rule Alias", prgm_out04Alias, {outputPin[4]}
field = "Output Polarity", outputInverted4, {outputPin[4]}
field = "Activation Delay", outputDelay[4], {outputPin[4]}
field = "2nd Condition", bitwise4, {outputPin[4]}
panel = prgm_out_rules_5_condition_1
panel = prgm_out_rules_5_condition_2
dialog = prgm_out_rules_6, "Rule 6", yAxis
field = "Output Pin Num", outputPin5
field = "Rule Alias", prgm_out05Alias, {outputPin[5]}
field = "Output Polarity", outputInverted5, {outputPin[5]}
field = "Activation Delay", outputDelay[5], {outputPin[5]}
field = "2nd Condition", bitwise5, {outputPin[5]}
panel = prgm_out_rules_6_condition_1
panel = prgm_out_rules_6_condition_2
dialog = prgm_out_rules_7, "Rule 7", yAxis
field = "Output Pin Num", outputPin6
field = "Rule Alias", prgm_out06Alias, {outputPin[6]}
field = "Output Polarity", outputInverted6, {outputPin[6]}
field = "Activation Delay", outputDelay[6], {outputPin[6]}
field = "2nd Condition", bitwise6, {outputPin[6]}
panel = prgm_out_rules_7_condition_1
panel = prgm_out_rules_7_condition_2
dialog = prgm_out_rules_8, "Rule 8", yAxis
field = "Output Pin Num", outputPin7
field = "Rule Alias", prgm_out07Alias, {outputPin[7]}
field = "Output Polarity", outputInverted7, {outputPin[7]}
field = "Activation Delay", outputDelay[7], {outputPin[7]}
field = "2nd Condition", bitwise7, {outputPin[7]}
panel = prgm_out_rules_8_condition_1
panel = prgm_out_rules_8_condition_2
dialog = prgm_out_rules_master, "", card
panel = prgm_out_rules_1, Center, { prgm_out_selection == 0 }
@ -3665,9 +3799,9 @@ menuDialog = main
panel = prgm_out_rules_8, Center, { prgm_out_selection == 7 }
dialog = prgm_out_config, "",yAxis
panel = prgm_out_unique
;;field = "Rule Number", prgm_out_selection
;;panel = prgm_out_rules_master
;panel = prgm_out_unique
field = "Select Rule Number", prgm_out_selection
panel = prgm_out_rules_master
;-------------------------------------------------------------------------------
; General help text
@ -3813,6 +3947,14 @@ cmdVSSratio6 = "E\x99\x06"
xBins = baroFuelBins, baro
yBins = baroFuelValues
; Correction curve for fuel temperature fuel adjustment
curve = fuelTemp_curve, "Fuel temp correction"
columnLabel = "Fuel Temperature", "Fuel Amount"
xAxis = -40, 125, 6
yAxis = 0, 255, 6
xBins = fuelTempBins, fuelTemp
yBins = fuelTempValues
; IAT based ignition timing retard
curve = iat_retard_curve, "IAT timing retard"
columnLabel = "Inlet Air Temp", "Retard"
@ -4195,9 +4337,10 @@ cmdVSSratio6 = "E\x99\x06"
iatCorrectGauge = airCorrection, "IAT Correction", "%", 0, 200, 130, 140, 140, 150, 0, 0
baroCorrectGauge = baroCorrection,"Baro Correction", "%", 0, 200, 130, 140, 140, 150, 0, 0
flexEnrich = flexFuelCor, "Flex Correction", "%", 0, 200, 130, 140, 140, 150, 0, 0
advanceGauge = advance, "Current Spark Advance", "deg BTDC", 50, -10, 0, 0, 35, 45, 0, 0
advance1Gauge = advance1, "advance1 (Spark Table 1)", "%", 50, -10, 0, 0, 35, 45, 0, 0
advance2Gauge = advance2, "advance2 (Spark Table 2)", "%", 50, -10, 0, 0, 35, 45, 0, 0
fuelTempCorGauge = fuelTempCor, "Fuel Temp Correction", "%", 0, 200, 130, 140, 140, 150, 0, 0
advanceGauge = advance, "Current Advance", "deg", 50, -10, 0, 0, 35, 45, 0, 0
advance1Gauge = advance1, "Advance1 (Spark Table 1)", "%",50, -10, 0, 0, 35, 45, 0, 0
advance2Gauge = advance2, "Advance2 (Spark Table 2)", "%",50, -10, 0, 0, 35, 45, 0, 0
dwellGauge = dwell, "Ign Dwell", "mSec", 0, 35.0, 1.0, 1.2, 20, 25, 3, 3
boostTargetGauge = boostTarget, "Target Boost", "kPa", 0, {maphigh}, 0, 20, {mapwarn}, {mapdang}, 0, 0
boostDutyGauge = boostDuty, "Boost Duty Cycle", "%", 0, 100, -1, -1, 101, 110, 1, 1
@ -4215,13 +4358,14 @@ cmdVSSratio6 = "E\x99\x06"
WMIdutyCycleGauge = wmiPW, "WMI Duty Cycle", "%", 0, 100, -1, -1, 101, 110, 1, 1
gaugeCategory = "Sensor inputs"
mapGauge = map, "Engine MAP", "kPa", 0, {maphigh}, 0, 20, {mapwarn}, {mapdang}, 0, 0
mapGauge_psi = map_psi, "Engine MAP (PSI)", "PSI", -15, 100, 0, 20, 200, 245, 0, 0
mapGauge_bar = map_bar, "Engine MAP (BAR)", "Bar", -1, 3, -1, -1, 5, 5, 2, 2
mapGauge_vacBoost = map_vacboost, "Engine MAP (in-Hg/PSI)", "in-Hg/PSI", -30, 30, -30, -30, 30, 30, 1, 1
baroGauge = baro, "Baro Pressure", "kPa", 0, {maphigh}, 0, 20, {mapwarn}, {mapdang}, 0, 0
batteryVoltage = batteryVoltage,"Battery Voltage", "volts", 0, 25, 8, 9, 15, 16, 2, 2
vssGauge = vss, "Vehicle Speed", "km/h", 0, 250, 5, 10, 180, 200, 0, 0
mapGauge = map, "Engine MAP", "kPa", 0, {maphigh}, 0, 20, {mapwarn}, {mapdang}, 0, 0
mapGauge_psi = map_psi, "Engine MAP (PSI)", "PSI", -15, 100, 0, 20, 200, 245, 0, 0
mapGauge_bar = map_bar, "Engine MAP (BAR)", "Bar", -1, 3, -1, -1, 5, 5, 2, 2
mapGauge_vacBoost = map_vacboost, "Engine MAP (in-Hg/PSI)", "in-Hg/PSI", -30, 30, -30, -30, 30, 30, 1, 1
baroGauge = baro, "Baro Pressure", "kPa", 0, {maphigh}, 0, 20, {mapwarn}, {mapdang}, 0, 0
batteryVoltage = batteryVoltage,"Battery Voltage", "volts", 0, 25, 8, 9, 15, 16, 2, 2
vssGauge = vss, "Vehicle Speed (kph)", "km/h", 0, 250, 5, 10, 180, 200, 0, 0
vssGaugeMPH = vssMPH, "Vehicle Speed (mph)", "mph", 0, 250, 5, 10, 180, 200, 0, 0
tpsADCGauge = tpsADC, "TPS ADC", "", 0, 255, -1, -1, 256, 256, 0, 0
throttleGauge = throttle, "Throttle Position", "%TPS", 0, 100, -1, 1, 90, 100, 0, 0
@ -4233,9 +4377,11 @@ cmdVSSratio6 = "E\x99\x06"
#if CELSIUS
cltGauge = coolant, "Coolant Temp", "TEMP", -40, 215, -15, 0, 95, 105, 0, 0
iatGauge = iat, "Inlet Air Temp", "TEMP", -40, 215, -15, 0, 95, 100, 0, 0
fuelTempGauge = fuelTemp, "Fuel Temp", "TEMP", -40, 215, -15, 0, 95, 100, 0, 0
#else
cltGauge = coolant, "Coolant Temp", "TEMP", -40, 215, 0, 30, 200, 220, 0, 0
iatGauge = iat, "Inlet Air Temp", "TEMP", -40, 215, 0, 30, 200, 210, 0, 0
fuelTempGauge = fuelTemp, "Fuel Temp", "TEMP", -40, 215, 0, 30, 200, 210, 0, 0
#endif
flexGauge = flex, "Flex sensor", "%", 0, 100, -1, -1, 999, 999, 0, 0
@ -4311,6 +4457,7 @@ cmdVSSratio6 = "E\x99\x06"
indicator = { resetLockOn }, "Reset Lock OFF","Reset Lock ON", red, black, green, black
indicator = { bootloaderCaps > 0 }, "Std. Boot", "Custom Boot", white, black, white, black
indicator = { nitrousOn }, "Nitrous Off", "Nitrous On", white, black, red, black
indicator = { IOError }, "I/O Ok", "I/O Error!", white, black, red, black
;Engine Protection status indicators
indicator = { engineProtectStatus}, "Engine Protect OFF", "Engine Protect ON", white, black, red, black
indicator = { engineProtectRPM }, "Rev Limiter Off", "Rev Limiter ON", white, black, red, black
@ -4336,7 +4483,7 @@ cmdVSSratio6 = "E\x99\x06"
; you change it.
ochGetCommand = "r\$tsCanId\x30%2o%2c"
ochBlockSize = 114
ochBlockSize = 116
secl = scalar, U08, 0, "sec", 1.000, 0.000
status1 = scalar, U08, 1, "bits", 1.000, 0.000
@ -4435,7 +4582,8 @@ cmdVSSratio6 = "E\x99\x06"
engineProtectMAP = bits, U08, 84, [1:1]
engineProtectOil = bits, U08, 84, [2:2]
engineProtectAFR = bits, U08, 84, [3:3]
engineProtectOth = bits, U08, 84, [4:7] ; Unused for now
engineProtectOth = bits, U08, 84, [4:6] ; Unused for now
IOError = bits, U08, 84, [7:7]
unused1 = scalar, U08, 84, "ADC",1.000, 0.000
fuelLoad = scalar, S16, 85, { bitStringValue( algorithmUnits , algorithm ) }, 1.000, 0.000
ignLoad = scalar, S16, 87, { bitStringValue( algorithmUnits , ignAlgorithm ) }, 1.000, 0.000
@ -4467,16 +4615,20 @@ cmdVSSratio6 = "E\x99\x06"
outputsStatus5 = bits, U08, 111, [5:5]
outputsStatus6 = bits, U08, 111, [6:6]
outputsStatus7 = bits, U08, 111, [7:7]
advance1 = scalar, U08, 112, "%", 1.000, 0.000
advance2 = scalar, U08, 113, "%", 1.000, 0.000
fuelTempRaw = scalar, U08, 112, "°C", 1.000, 0.000
fuelTempCor = scalar, U08, 113, "%", 1.000, 0.000
advance1 = scalar, U08, 114, "%", 1.000, 0.000
advance2 = scalar, U08, 115, "%", 1.000, 0.000
#sd_status = scalar, U08, 99, "", 1.0, 0.0
#if CELSIUS
coolant = { coolantRaw - 40 } ; Temperature readings are offset by 40 to allow for negatives
iat = { iatRaw - 40 } ; Temperature readings are offset by 40 to allow for negatives
fuelTemp = { fuelTempRaw - 40 } ; Temperature readings are offset by 40 to allow for negatives
#else
coolant = { (coolantRaw - 40) * 1.8 + 32 } ;Convert C to F (Offset by 40)
iat = { (iatRaw - 40) * 1.8 + 32 } ;Convert C to F (Offset by 40)
fuelTemp = { (fuelTempRaw - 40) * 1.8 + 32 } ;Convert C to F (Offset by 40)
#endif
time = { timeNow }
seconds = { secl }
@ -4514,6 +4666,8 @@ cmdVSSratio6 = "E\x99\x06"
map_inhg = { (baro - map) * 0.2953007 } ;in-Hg
map_vacboost = { map < baro ? -map_inhg : map_psi }
vssMPH = { vss / 1.60934 }
;fuelLoadMax = { arrayValue(algorithmLimits , algorithm) } ;Doesn't work, no idea why.
fuelLoadMax = { (algorithm == 0 || algorithm == 2) ? 511 : 100 }
ignLoadMax = { (ignAlgorithm == 0 || ignAlgorithm == 2) ? 511 : 100 }
@ -4542,67 +4696,71 @@ cmdVSSratio6 = "E\x99\x06"
; Type - Data type of output, converted before writing.
; Format - C-style output format of data.
;
; Channel Label Type Format
; -------------- ---------- ----- ------
entry = time, "Time", float, "%.3f"
entry = secl, "SecL", int, "%d"
entry = rpm, "RPM", int, "%d"
entry = map, "MAP", int, "%d"
entry = MAPxRPM, "MAPxRPM", int, "%d"
entry = tps, "TPS", int, "%d"
entry = afr, "AFR", float, "%.3f"
entry = lambda, "Lambda", float, "%.3f"
entry = iat, "IAT", int, "%d"
entry = coolant, "CLT", int, "%d"
entry = engine, "Engine", int, "%d"
entry = DFCOOn, "DFCO", int, "%d"
entry = egoCorrection, "Gego", int, "%d"
entry = airCorrection, "Gair", int, "%d"
entry = bat_correction, "Gbattery", int, "%d"
entry = warmupEnrich, "Gwarm", int, "%d"
entry = baroCorrection, "Gbaro", int, "%d"
entry = gammaEnrich, "Gammae", int, "%d"
entry = accelEnrich, "Accel Enrich", int, "%d"
entry = veCurr, "Current VE", int, "%d"
entry = VE1, "VE1", int, "%d"
entry = VE2, "VE2", int, "%d"
entry = pulseWidth, "PW", float, "%.3f"
entry = afrTarget, "AFR Target", float, "%.3f"
entry = lambdaTarget, "Lambda Target",float, "%.3f"
entry = pulseWidth, "PW2", float, "%.3f"
entry = dutyCycle, "DutyCycle1", float, "%.1f"
entry = dutyCycle, "DutyCycle2", float, "%.1f"
entry = TPSdot, "TPS DOT", int, "%d"
entry = advance, "Advance", int, "%d"
entry = dwell, "Dwell", float, "%.1f"
entry = batteryVoltage, "Battery V", float, "%.1f"
entry = rpmDOT, "rpm/s", int, "%d"
entry = flex, "Eth %", int, "%d", { flexEnabled }
entry = errorNum, "Error #", int, "%d", { errorNum }
entry = currentError, "Error ID", int, "%d", { errorNum }
entry = map_psi, "Boost PSI", float, "%.1f"
entry = boostTarget, "Boost Target", int, "%d", { boostEnabled }
entry = boostDuty, "Boost Duty", int, "%d", { boostEnabled }
entry = boostCutOut , "Boost cut", int, "%d"
entry = launchHard , "Hard Launch", int, "%d"
entry = hardLimitOn , "Hard Limiter", int, "%d"
entry = idleControlOn, "Idle Control", int, "%d"
entry = idleLoad, "IAC value", int, "%d"
entry = CLIdleTarget, "Idle Target RPM", int, "%%d", { iacAlgorithm == 3 || iacAlgorithm == 5 || idleAdvEnabled >= 1 } ;Only show for closed loop idle modes and if idle advance is enabled
entry = CLIdleDelta, "Idle RPM Delta", int, "%d", { iacAlgorithm == 3 || iacAlgorithm == 5 || idleAdvEnabled >= 1 } ;Only show for closed loop idle modes and if idle advance is enabled
entry = baro, "Baro Pressure",int, "%d"
entry = nitrousOn, "Nitrous", int, "%d", { n2o_enable > 0 }
entry = syncLossCounter, "Sync Loss #", int, "%d"
entry = vvt1Angle, "VVT Angle", int, "%d", { vvtMode == 2 } ;;Only show when using close loop vvt
entry = vvt1Target, "VVT Target Angle", int, "%d", { vvtMode == 2 } ;;Only show when using close loop vvt
entry = vvt1Duty, "VVT Duty", int, "%d", { vvtEnabled > 0 }
entry = vss, "VSS (Speed)", int, "%d", { vssMode > 1 }
entry = gear, "Gear", int, "%d", { vssMode > 1 }
entry = fuelPressure, "Fuel Pressure",int, "%d", { fuelPressureEnable > 0 }
entry = oilPressure, "Oil Pressure", int, "%d", { oilPressureEnable > 0 }
entry = vvt2Angle, "VVT Angle", int, "%d", { vvtMode == 2 } ;;Only show when using close loop vvt
entry = vvt2Target, "VVT Target Angle", int, "%d", { vvtMode == 2 } ;;Only show when using close loop vvt
entry = vvt2Duty, "VVT Duty", int, "%d", { vvtEnabled > 0 }
; Channel Label Type Format
; -------------- ---------- ----- ------
entry = time, "Time", float, "%.3f"
entry = secl, "SecL", int, "%d"
entry = rpm, "RPM", int, "%d"
entry = map, "MAP", int, "%d"
entry = MAPxRPM, "MAPxRPM", int, "%d"
entry = tps, "TPS", int, "%d"
entry = afr, "AFR", float, "%.3f"
entry = lambda, "Lambda", float, "%.3f"
entry = iat, "IAT", int, "%d"
entry = coolant, "CLT", int, "%d"
entry = engine, "Engine", int, "%d"
entry = DFCOOn, "DFCO", int, "%d"
entry = egoCorrection, "Gego", int, "%d"
entry = airCorrection, "Gair", int, "%d"
entry = bat_correction, "Gbattery", int, "%d"
entry = warmupEnrich, "Gwarm", int, "%d"
entry = baroCorrection, "Gbaro", int, "%d"
entry = gammaEnrich, "Gammae", int, "%d"
entry = accelEnrich, "Accel Enrich", int, "%d"
entry = veCurr, "Current VE", int, "%d"
entry = VE1, "VE1", int, "%d"
entry = VE2, "VE2", int, "%d"
entry = pulseWidth, "PW", float, "%.3f"
entry = afrTarget, "AFR Target", float, "%.3f"
entry = lambdaTarget, "Lambda Target", float, "%.3f"
entry = pulseWidth, "PW2", float, "%.3f"
entry = dutyCycle, "DutyCycle1", float, "%.1f"
entry = dutyCycle, "DutyCycle2", float, "%.1f"
entry = TPSdot, "TPS DOT", int, "%d"
entry = advance, "Advance", int, "%d"
entry = dwell, "Dwell", float, "%.1f"
entry = batteryVoltage, "Battery V", float, "%.1f"
entry = rpmDOT, "rpm/s", int, "%d"
entry = flex, "Eth %", int, "%d", { flexEnabled }
entry = flexFuelCor, "GflexFuel", int, "%d", { flexEnabled }
entry = fuelTemp, "Fuel Temp", int, "%d", { flexEnabled }
entry = fuelTempCor, "GfuelTemp", int, "%d", { flexEnabled }
entry = errorNum, "Error #", int, "%d", { errorNum }
entry = currentError, "Error ID", int, "%d", { errorNum }
entry = map_psi, "Boost PSI", float, "%.1f"
entry = boostTarget, "Boost Target", int, "%d", { boostEnabled }
entry = boostDuty, "Boost Duty", int, "%d", { boostEnabled }
entry = boostCutOut , "Boost cut", int, "%d"
entry = launchHard , "Hard Launch", int, "%d"
entry = hardLimitOn , "Hard Limiter", int, "%d"
entry = idleControlOn, "Idle Control", int, "%d"
entry = idleLoad, "IAC value", int, "%d"
entry = CLIdleTarget, "Idle Target RPM", int, "%%d", { iacAlgorithm == 3 || iacAlgorithm == 5 || idleAdvEnabled >= 1 } ;Only show for closed loop idle modes and if idle advance is enabled
entry = CLIdleDelta, "Idle RPM Delta", int, "%d", { iacAlgorithm == 3 || iacAlgorithm == 5 || idleAdvEnabled >= 1 } ;Only show for closed loop idle modes and if idle advance is enabled
entry = baro, "Baro Pressure", int, "%d"
entry = nitrousOn, "Nitrous", int, "%d", { n2o_enable > 0 }
entry = syncLossCounter, "Sync Loss #", int, "%d"
entry = vvt1Angle, "VVT Angle", int, "%d", { vvtMode == 2 } ;;Only show when using close loop vvt
entry = vvt1Target, "VVT Target Angle",int, "%d", { vvtMode == 2 } ;;Only show when using close loop vvt
entry = vvt1Duty, "VVT Duty", int, "%d", { vvtEnabled > 0 }
entry = vss, "Wheel Speed (kph)",int, "%d", { vssMode > 1 }
entry = vssMPH, "Wheel Speed (mph)",int, "%d", { vssMode > 1 }
entry = gear, "Gear", int, "%d", { vssMode > 1 }
entry = fuelPressure, "Fuel Pressure", int, "%d", { fuelPressureEnable > 0 }
entry = oilPressure, "Oil Pressure", int, "%d", { oilPressureEnable > 0 }
entry = vvt2Angle, "VVT Angle", int, "%d", { vvtMode == 2 } ;;Only show when using close loop vvt
entry = vvt2Target, "VVT Target Angle",int, "%d", { vvtMode == 2 } ;;Only show when using close loop vvt
entry = vvt2Duty, "VVT Duty", int, "%d", { vvtEnabled > 0 }
entry = auxin_gauge0, { stringValue(AUXin00Alias)}, int, "%d", {(caninput_sel0b != 0)}
entry = auxin_gauge1, { stringValue(AUXin01Alias)}, int, "%d", { (caninput_sel1b != 0)}

View File

@ -6,7 +6,7 @@
#include "TS_CommandButtonHandler.h"
#include "globals.h"
#include "utils.h"
#include "utilities.h"
#include "scheduledIO.h"
#include "sensors.h"
#include "storage.h"

View File

@ -19,7 +19,7 @@ sendcancommand is called when a command is to be sent either to serial3
#include "cancomms.h"
#include "maths.h"
#include "errors.h"
#include "utils.h"
#include "utilities.h"
void secondserial_Command()
{

View File

@ -37,7 +37,10 @@ int valueOffset; /**< THe memory offset within a given page for a value to be re
byte tsCanId = 0; // current tscanid requested
byte inProgressOffset;
byte inProgressLength;
uint32_t inProgressCompositeTime;
bool serialInProgress = false;
bool toothLogSendInProgress = false;
bool compositeLogSendInProgress = false;
const char pageTitles[] PROGMEM //This is being stored in the avr flash instead of SRAM which there is not very much of
{
@ -65,10 +68,10 @@ void saveConfig();
void sendPage();
void sendPageASCII();
void receiveCalibration(byte);
void sendToothLog();
void sendToothLog(uint8_t);
void testComm();
void commandButtons(int16_t);
void sendCompositeLog();
void sendCompositeLog(uint8_t);
byte getPageValue(byte, uint16_t);
void updateFullStatus();

View File

@ -8,7 +8,7 @@ A full copy of the license may be found in the projects root directory
#include "cancomms.h"
#include "storage.h"
#include "maths.h"
#include "utils.h"
#include "utilities.h"
#include "decoders.h"
#include "TS_CommandButtonHandler.h"
#include "errors.h"
@ -248,7 +248,7 @@ void command()
break;
case 'Q': // send code version
Serial.print(F("speeduino 202006-dev"));
Serial.print(F("speeduino 202009-dev"));
break;
case 'r': //New format for the optimised OutputChannels
@ -278,7 +278,7 @@ void command()
break;
case 'S': // send code version
Serial.print(F("Speeduino 2020.06-dev"));
Serial.print(F("Speeduino 2020.09-dev"));
currentStatus.secl = 0; //This is required in TS3 due to its stricter timings
break;
@ -297,8 +297,8 @@ void command()
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
if(currentStatus.toothLogEnabled == true) { sendToothLog(); } //Sends tooth log values as ints
else if (currentStatus.compositeLogEnabled == true) { sendCompositeLog(); }
if(currentStatus.toothLogEnabled == true) { sendToothLog(0); } //Sends tooth log values as ints
else if (currentStatus.compositeLogEnabled == true) { sendCompositeLog(0); }
cmdPending = false;
}
@ -445,7 +445,7 @@ void command()
break;
case 'z': //Send 256 tooth log entries to a terminal emulator
sendToothLog(); //Sends tooth log values as chars
sendToothLog(0); //Sends tooth log values as chars
break;
case '`': //Custom 16u2 firmware is making its presence known
@ -626,8 +626,10 @@ void updateFullStatus()
fullStatus[109] = currentStatus.vvt2TargetAngle;
fullStatus[110] = currentStatus.vvt2Duty;
fullStatus[111] = currentStatus.outputsStatus;
fullStatus[112] = currentStatus.advance1; //advance 1 (%)
fullStatus[113] = currentStatus.advance2; //advance 2 (%)
fullStatus[112] = (byte)(currentStatus.fuelTemp + CALIBRATION_TEMPERATURE_OFFSET); //Fuel temperature from flex sensor
fullStatus[113] = currentStatus.fuelTempCorrection; //Fuel temperature Correction (%)
fullStatus[114] = currentStatus.advance1; //advance 1 (%)
fullStatus[115] = currentStatus.advance2; //advance 2 (%)
}
/*
This function returns the current values of a fixed group of variables
@ -1860,13 +1862,21 @@ Send 256 tooth log entries
* if useChar is true, the values are sent as chars to be printed out by a terminal emulator
* if useChar is false, the values are sent as a 2 byte integer which is readable by TunerStudios tooth logger
*/
void sendToothLog()
void sendToothLog(byte startOffset)
{
//We need TOOTH_LOG_SIZE number of records to send to TunerStudio. If there aren't that many in the buffer then we just return and wait for the next call
if (BIT_CHECK(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY)) //Sanity check. Flagging system means this should always be true
{
for (int x = 0; x < TOOTH_LOG_SIZE; x++)
for (int x = startOffset; x < TOOTH_LOG_SIZE; x++)
{
//Check whether the tx buffer still has space
if(Serial.availableForWrite() < 4)
{
//tx buffer is full. Store the current state so it can be resumed later
inProgressOffset = x;
toothLogSendInProgress = true;
return;
}
//Serial.write(highByte(toothHistory[toothHistorySerialIndex]));
//Serial.write(lowByte(toothHistory[toothHistorySerialIndex]));
Serial.write(toothHistory[toothHistorySerialIndex] >> 24);
@ -1879,6 +1889,7 @@ void sendToothLog()
}
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY);
cmdPending = false;
toothLogSendInProgress = false;
}
else
{
@ -1891,24 +1902,28 @@ void sendToothLog()
}
}
void sendCompositeLog()
void sendCompositeLog(byte startOffset)
{
if (BIT_CHECK(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY)) //Sanity check. Flagging system means this should always be true
{
uint32_t runTime = 0;
for (int x = 0; x < TOOTH_LOG_SIZE; x++)
if(startOffset == 0) { inProgressCompositeTime = 0; }
for (int x = startOffset; x < TOOTH_LOG_SIZE; x++)
{
runTime += toothHistory[toothHistorySerialIndex]; //This combined runtime (in us) that the log was going for by this record)
//Serial.write(highByte(runTime));
//Serial.write(lowByte(runTime));
Serial.write(runTime >> 24);
Serial.write(runTime >> 16);
Serial.write(runTime >> 8);
Serial.write(runTime);
//Check whether the tx buffer still has space
if(Serial.availableForWrite() < 4)
{
//tx buffer is full. Store the current state so it can be resumed later
inProgressOffset = x;
compositeLogSendInProgress = true;
return;
}
//Serial.write(highByte(toothHistory[toothHistorySerialIndex]));
//Serial.write(lowByte(toothHistory[toothHistorySerialIndex]));
inProgressCompositeTime += toothHistory[toothHistorySerialIndex]; //This combined runtime (in us) that the log was going for by this record)
Serial.write(inProgressCompositeTime >> 24);
Serial.write(inProgressCompositeTime >> 16);
Serial.write(inProgressCompositeTime >> 8);
Serial.write(inProgressCompositeTime);
Serial.write(compositeLogHistory[toothHistorySerialIndex]); //The status byte (Indicates the trigger edge, whether it was a pri/sec pulse, the sync status)
@ -1920,6 +1935,8 @@ void sendCompositeLog()
toothHistorySerialIndex = 0;
compositeLastToothTime = 0;
cmdPending = false;
compositeLogSendInProgress = false;
inProgressCompositeTime = 0;
}
else
{
@ -1937,4 +1954,3 @@ void testComm()
Serial.write(1);
return;
}

View File

@ -15,6 +15,7 @@ uint16_t correctionAccel(); //Acceleration Enrichment
byte correctionFloodClear(); //Check for flood clear on cranking
byte correctionAFRClosedLoop(); //Closed loop AFR adjustment
byte correctionFlex(); //Flex fuel adjustment
byte correctionFuelTemp(); //Fuel temp correction
byte correctionBatVoltage(); //Battery voltage correction
byte correctionIATDensity(); //Inlet temp density correction
byte correctionBaro(); //Barometric pressure correction

View File

@ -102,6 +102,10 @@ uint16_t correctionsFuel()
if (currentStatus.flexCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.flexCorrection); activeCorrections++; }
if (activeCorrections == MAX_CORRECTIONS) { sumCorrections = sumCorrections / powint(100,activeCorrections); activeCorrections = 0; }
currentStatus.fuelTempCorrection = correctionFuelTemp();
if (currentStatus.fuelTempCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.fuelTempCorrection); activeCorrections++; }
if (activeCorrections == MAX_CORRECTIONS) { sumCorrections = sumCorrections / powint(100,activeCorrections); activeCorrections = 0; }
currentStatus.launchCorrection = correctionLaunch();
if (currentStatus.launchCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.launchCorrection); activeCorrections++; }
@ -521,6 +525,20 @@ byte correctionFlex()
return flexValue;
}
/*
* Fuel temperature adjustment to vary fuel based on fuel temperature reading
*/
byte correctionFuelTemp()
{
byte fuelTempValue = 100;
if (configPage2.flexEnabled == 1)
{
fuelTempValue = table2D_getValue(&fuelTempTable, currentStatus.fuelTemp + CALIBRATION_TEMPERATURE_OFFSET);
}
return fuelTempValue;
}
/*
Lookup the AFR target table and perform either a simple or PID adjustment based on this

View File

@ -241,6 +241,7 @@
#define PROTECT_CUT_IGN 1
#define PROTECT_CUT_FUEL 2
#define PROTECT_CUT_BOTH 3
#define PROTECT_IO_ERROR 7
#define AE_MODE_TPS 0
#define AE_MODE_MAP 1
@ -372,6 +373,7 @@ extern struct table2D rotarySplitTable; //8 bin ignition split curve for rotary
extern struct table2D flexFuelTable; //6 bin flex fuel correction table for fuel adjustments (2D)
extern struct table2D flexAdvTable; //6 bin flex fuel correction table for timing advance (2D)
extern struct table2D flexBoostTable; //6 bin flex fuel correction table for boost adjustments (2D)
extern struct table2D fuelTempTable; //6 bin fuel temperature correction table for fuel adjustments (2D)
extern struct table2D knockWindowStartTable;
extern struct table2D knockWindowDurationTable;
extern struct table2D oilPressureProtectTable;
@ -417,6 +419,9 @@ extern volatile PINMASK_TYPE tach_pin_mask;
extern volatile PORT_TYPE *pump_pin_port;
extern volatile PINMASK_TYPE pump_pin_mask;
extern volatile PORT_TYPE *flex_pin_port;
extern volatile PINMASK_TYPE flex_pin_mask;
extern volatile PORT_TYPE *triggerPri_pin_port;
extern volatile PINMASK_TYPE triggerPri_pin_mask;
extern volatile PORT_TYPE *triggerSec_pin_port;
@ -492,8 +497,8 @@ extern volatile byte LOOP_TIMER;
#define pinIsInjector(pin) ( ((pin) == pinInjector1) || ((pin) == pinInjector2) || ((pin) == pinInjector3) || ((pin) == pinInjector4) || ((pin) == pinInjector5) || ((pin) == pinInjector6) || ((pin) == pinInjector7) || ((pin) == pinInjector8) )
#define pinIsIgnition(pin) ( ((pin) == pinCoil1) || ((pin) == pinCoil2) || ((pin) == pinCoil3) || ((pin) == pinCoil4) || ((pin) == pinCoil5) || ((pin) == pinCoil6) || ((pin) == pinCoil7) || ((pin) == pinCoil8) )
#define pinIsSensor(pin) ( ((pin) == pinCLT) || ((pin) == pinIAT) || ((pin) == pinMAP) || ((pin) == pinTPS) || ((pin) == pinO2) || ((pin) == pinBat) )
#define pinIsUsed(pin) ( pinIsInjector((pin)) || pinIsIgnition((pin)) || pinIsSensor((pin)) )
#define pinIsOutput(pin) ( ((pin) == pinFuelPump) || ((pin) == pinFan) || ((pin) == pinVVT_1) || ((pin) == pinVVT_2) || ((pin) == pinBoost) || ((pin) == pinIdle1) || ((pin) == pinIdle2) || ((pin) == pinTachOut) )
#define pinIsUsed(pin) ( pinIsInjector((pin)) || pinIsIgnition((pin)) || pinIsSensor((pin)) || pinIsOutput((pin)) )
//The status struct contains the current values for all 'live' variables
//In current version this is 64 bytes
@ -540,6 +545,7 @@ struct statuses {
byte baroCorrection; /**< The amount of correction being applied for the current baro reading */
byte launchCorrection; /**< The amount of correction being applied if launch control is active */
byte flexCorrection; /**< Amount of correction being applied to compensate for ethanol content */
byte fuelTempCorrection; /**< Amount of correction being applied to compensate for fuel temperature */
int8_t flexIgnCorrection; /**< Amount of additional advance being applied based on flex. Note the type as this allows for negative values */
byte afrTarget;
byte idleDuty; /**< The current idle duty cycle amount if PWM idle is selected and active */
@ -548,6 +554,7 @@ struct statuses {
bool CTPSActive; /**< Whether the externally controlled closed throttle position sensor is currently active */
bool fanOn; /**< Whether or not the fan is turned on */
volatile byte ethanolPct; /**< Ethanol reading (if enabled). 0 = No ethanol, 100 = pure ethanol. Eg E85 = 85. */
volatile int8_t fuelTemp;
unsigned long AEEndTime; /**< The target end time used whenever AE is turned on */
volatile byte status1;
volatile byte spark;
@ -626,7 +633,7 @@ struct config2 {
byte battVCorMode : 1;
byte SoftLimitMode : 1;
byte unused1_3c : 1;
byte aeApplyMode : 1;
byte aeApplyMode : 1; //0 = Multiply | 1 = Add
byte multiplyMAP : 2; //0 = off | 1 = baro | 2 = 100
byte wueValues[10]; //Warm up enrichment array (10 bytes)
byte crankingPct; //Cranking enrichment
@ -1189,7 +1196,10 @@ struct config10 {
byte unused11_174_1 : 1;
byte unused11_174_2 : 1;
byte unused11_175_191[18]; //Bytes 175-191
byte fuelTempBins[6];
byte fuelTempValues[6];
byte unused11_187_191[6]; //Bytes 187-191
#if defined(CORE_AVR)
};
@ -1212,8 +1222,9 @@ struct config13 {
uint8_t unused12_1;
uint8_t outputPin[8];
uint8_t outputDelay[8]; //0.1S
uint16_t firstDataIn[8];
uint16_t secondDataIn[8];
uint8_t firstDataIn[8];
uint8_t secondDataIn[8];
uint8_t unused_13[16];
int16_t firstTarget[8];
int16_t secondTarget[8];
//89bytes

View File

@ -38,6 +38,7 @@ struct table2D rotarySplitTable; //8 bin ignition split curve for rotary leading
struct table2D flexFuelTable; //6 bin flex fuel correction table for fuel adjustments (2D)
struct table2D flexAdvTable; //6 bin flex fuel correction table for timing advance (2D)
struct table2D flexBoostTable; //6 bin flex fuel correction table for boost adjustments (2D)
struct table2D fuelTempTable; //6 bin flex fuel correction table for fuel adjustments (2D)
struct table2D knockWindowStartTable;
struct table2D knockWindowDurationTable;
struct table2D oilPressureProtectTable;
@ -83,6 +84,9 @@ volatile PINMASK_TYPE tach_pin_mask;
volatile PORT_TYPE *pump_pin_port;
volatile PINMASK_TYPE pump_pin_mask;
volatile PORT_TYPE *flex_pin_port;
volatile PINMASK_TYPE flex_pin_mask;
volatile PORT_TYPE *triggerPri_pin_port;
volatile PINMASK_TYPE triggerPri_pin_mask;
volatile PORT_TYPE *triggerSec_pin_port;

View File

@ -5,7 +5,7 @@
#include "speeduino.h"
#include "timers.h"
#include "cancomms.h"
#include "utils.h"
#include "utilities.h"
#include "scheduledIO.h"
#include "scheduler.h"
#include "auxiliaries.h"
@ -164,6 +164,11 @@ void initialiseAll()
flexBoostTable.xSize = 6;
flexBoostTable.values = configPage10.flexBoostAdj;
flexBoostTable.axisX = configPage10.flexBoostBins;
fuelTempTable.valueSize = SIZE_BYTE;
fuelTempTable.axisSize = SIZE_BYTE; //Set this table to use byte axis bins
fuelTempTable.xSize = 6;
fuelTempTable.values = configPage10.fuelTempValues;
fuelTempTable.axisX = configPage10.fuelTempBins;
knockWindowStartTable.valueSize = SIZE_BYTE;
knockWindowStartTable.axisSize = SIZE_BYTE; //Set this table to use byte axis bins
@ -261,6 +266,7 @@ void initialiseAll()
initialiseFan();
initialiseAuxPWM();
initialiseCorrections();
BIT_CLEAR(currentStatus.engineProtectStatus, PROTECT_IO_ERROR); //Clear the I/O error bit. The bit will be set in initialiseADC() if there is problem in there.
initialiseADC();
initialiseProgrammableIO();
@ -295,10 +301,10 @@ void initialiseAll()
}
}
//Check whether the flex sensor is enabled and if so, attach an interupt for it
//Check whether the flex sensor is enabled and if so, attach an interrupt for it
if(configPage2.flexEnabled > 0)
{
attachInterrupt(digitalPinToInterrupt(pinFlex), flexPulse, RISING);
attachInterrupt(digitalPinToInterrupt(pinFlex), flexPulse, CHANGE);
currentStatus.ethanolPct = 0;
}
//Same as above, but for the VSS input
@ -2581,6 +2587,8 @@ void setPinMapping(byte boardID)
triggerPri_pin_mask = digitalPinToBitMask(pinTrigger);
triggerSec_pin_port = portInputRegister(digitalPinToPort(pinTrigger2));
triggerSec_pin_mask = digitalPinToBitMask(pinTrigger2);
flex_pin_port = portInputRegister(digitalPinToPort(pinFlex));
flex_pin_mask = digitalPinToBitMask(pinFlex);
}

View File

@ -15,4 +15,4 @@
void createLog(uint8_t *array);
void createSDLog(uint8_t *array);
#endif
#endif

View File

@ -31,6 +31,15 @@
*/
volatile byte flexCounter = 0;
volatile unsigned long flexStartTime;
volatile unsigned long flexPulseWidth;
#if defined(CORE_AVR)
#define READ_FLEX() ((*flex_pin_port & flex_pin_mask) ? true : false)
#else
#define READ_FLEX() digitalRead(pinFlex)
#endif
volatile byte knockCounter = 0;
volatile uint16_t knockAngle;

View File

@ -76,7 +76,7 @@ void initialiseADC()
if( pinIsUsed(pinNumber) )
{
//Do nothing here as the pin is already in use.
//Need some method of reporting this back to the user
BIT_SET(currentStatus.engineProtectStatus, PROTECT_IO_ERROR); //Tell user that there is problem by lighting up the I/O error indicator
}
else
{
@ -94,7 +94,7 @@ void initialiseADC()
if( pinIsUsed(pinNumber) )
{
//Do nothing here as the pin is already in use.
//Need some method of reporting this back to the user
BIT_SET(currentStatus.engineProtectStatus, PROTECT_IO_ERROR); //Tell user that there is problem by lighting up the I/O error indicator
}
else
{
@ -592,7 +592,7 @@ byte getGear()
byte getFuelPressure()
{
uint16_t tempFuelPressure = 0;
int16_t tempFuelPressure = 0;
uint16_t tempReading;
if(configPage10.fuelPressureEnable > 0)
@ -605,6 +605,7 @@ byte getFuelPressure()
tempFuelPressure = ADC_FILTER(tempFuelPressure, 150, currentStatus.fuelPressure); //Apply speed smoothing factor
//Sanity checks
if(tempFuelPressure > configPage10.fuelPressureMax) { tempFuelPressure = configPage10.fuelPressureMax; }
if(tempFuelPressure < 0 ) { tempFuelPressure = 0; } //prevent negative values, which will cause problems later when the values aren't signed.
}
return (byte)tempFuelPressure;
@ -612,7 +613,7 @@ byte getFuelPressure()
byte getOilPressure()
{
uint16_t tempOilPressure = 0;
int16_t tempOilPressure = 0;
uint16_t tempReading;
if(configPage10.oilPressureEnable > 0)
@ -626,6 +627,7 @@ byte getOilPressure()
tempOilPressure = ADC_FILTER(tempOilPressure, 150, currentStatus.oilPressure); //Apply speed smoothing factor
//Sanity check
if(tempOilPressure > configPage10.oilPressureMax) { tempOilPressure = configPage10.oilPressureMax; }
if(tempOilPressure < 0 ) { tempOilPressure = 0; } //prevent negative values, which will cause problems later when the values aren't signed.
}
@ -633,12 +635,20 @@ byte getOilPressure()
}
/*
* The interrupt function for reading the flex sensor frequency
* This value is incremented with every pulse and reset back to 0 once per second
* The interrupt function for reading the flex sensor frequency and pulse width
* flexCounter value is incremented with every pulse and reset back to 0 once per second
*/
void flexPulse()
{
++flexCounter;
if(READ_FLEX() == true)
{
flexPulseWidth = (micros() - flexStartTime); //Calculate the pulse width
++flexCounter;
}
else
{
flexStartTime = micros(); //Start pulse width measurement.
}
}
/*

View File

@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "storage.h"
#include "crankMaths.h"
#include "init.h"
#include "utilities.h"
#include "engineProtection.h"
#include BOARD_H //Note that this is not a real file, it is defined in globals.h.
@ -104,6 +105,16 @@ void loop()
{
if(Serial.availableForWrite() > 32) { sendValues(inProgressOffset, inProgressLength, 0x30, 0); }
}
//Perform the same check for the tooth and composite logs
if( toothLogSendInProgress == true)
{
if(Serial.availableForWrite() > 32) { sendToothLog(inProgressOffset); }
}
if( compositeLogSendInProgress == true)
{
if(Serial.availableForWrite() > 32) { sendCompositeLog(inProgressOffset); }
}
//Check for any requets from serial. Serial operations are checked under 2 scenarios:
// 1) Check every 15Hz for data
// 2) If the amount of data in the serial buffer is greater than a set threhold (See globals.h). This is to avoid serial buffer overflow when large amounts of data is being sent

View File

@ -7,6 +7,10 @@ This file is used for everything related to maps/tables including their definiti
#define TABLE_RPM_MULTIPLIER 100
#define TABLE_LOAD_MULTIPLIER 2
//The shift amount used for the 3D table calculations
#define TABLE_SHIFT_FACTOR 8
#define TABLE_SHIFT_POWER (1UL<<TABLE_SHIFT_FACTOR)
/*
The 2D table can contain either 8-bit (byte) or 16-bit (int) values
The valueSize variable should be set to either 8 or 16 to indicate this BEFORE the table is used

View File

@ -378,33 +378,27 @@ int get3DTableValue(struct table3D *fromTable, int Y_in, int X_in)
//Initial check incase the values were hit straight on
unsigned long p = (long)X - xMinValue;
if (xMaxValue == xMinValue) { p = (p << 8); } //This only occurs if the requested X value was equal to one of the X axis bins
else { p = ( (p << 8) / (xMaxValue - xMinValue) ); } //This is the standard case
if (xMaxValue == xMinValue) { p = (p << TABLE_SHIFT_FACTOR); } //This only occurs if the requested X value was equal to one of the X axis bins
else { p = ( (p << TABLE_SHIFT_FACTOR) / (xMaxValue - xMinValue) ); } //This is the standard case
unsigned long q;
if (yMaxValue == yMinValue)
{
q = (long)Y - yMinValue;
q = (q << 8);
q = (q << TABLE_SHIFT_FACTOR);
}
//Standard case
else
{
q = long(Y) - yMaxValue;
q = 256 - ( (q << 8) / (yMinValue - yMaxValue) );
q = TABLE_SHIFT_POWER - ( (q << TABLE_SHIFT_FACTOR) / (yMinValue - yMaxValue) );
}
/*
long q;
if (yMaxValue == yMinValue) { q = ((long)(Y - yMinValue) << 8); }
else { q = 256 - (((long)(Y - yMaxValue) << 8) / (yMinValue - yMaxValue)); }
*/
int m = ((256-p) * (256-q)) >> 8;
int n = (p * (256-q)) >> 8;
int o = ((256-p) * q) >> 8;
int r = (p * q) >> 8;
tableResult = ( (A * m) + (B * n) + (C * o) + (D * r) ) >> 8;
uint32_t m = ((TABLE_SHIFT_POWER-p) * (TABLE_SHIFT_POWER-q)) >> TABLE_SHIFT_FACTOR;
uint32_t n = (p * (TABLE_SHIFT_POWER-q)) >> TABLE_SHIFT_FACTOR;
uint32_t o = ((TABLE_SHIFT_POWER-p) * q) >> TABLE_SHIFT_FACTOR;
uint32_t r = (p * q) >> TABLE_SHIFT_FACTOR;
tableResult = ( (A * m) + (B * n) + (C * o) + (D * r) ) >> TABLE_SHIFT_FACTOR;
}
//Update the tables cache data

View File

@ -227,6 +227,10 @@ void oneMSInterval() //Most ARM chips can simply call a function
//Off by 1 error check
if (currentStatus.ethanolPct == 1) { currentStatus.ethanolPct = 0; }
//Continental flex sensor fuel temperature can be read with following formula: (Temperature = (41.25 * pulse width(ms)) - 81.25). 1000μs = -40C and 5000μs = 125C
if(flexPulseWidth > 5000) { flexPulseWidth = 5000; }
else if(flexPulseWidth < 1000) { flexPulseWidth = 1000; }
currentStatus.fuelTemp = (((4224 * (long)flexPulseWidth) >> 10) - 8125) / 100;
}
//**************************************************************************************************************************************************

View File

@ -10,7 +10,7 @@
void doUpdates()
{
#define CURRENT_DATA_VERSION 15
#define CURRENT_DATA_VERSION 16
//May 2017 firmware introduced a -40 offset on the ignition table. Update that table to +40
if(EEPROM.read(EEPROM_DATA_VERSION) == 2)
@ -408,6 +408,16 @@ void doUpdates()
configPage10.wmiAdvAdj[i] = OFFSET_IGNITION;
}
//Programmable outputs added. Set all to disabled
configPage13.outputPin[0] = 0;
configPage13.outputPin[1] = 0;
configPage13.outputPin[2] = 0;
configPage13.outputPin[3] = 0;
configPage13.outputPin[4] = 0;
configPage13.outputPin[5] = 0;
configPage13.outputPin[6] = 0;
configPage13.outputPin[7] = 0;
//New multiply MAP option added. Set new option to be the same as old
configPage2.multiplyMAP = configPage2.multiplyMAP_old;
//New AE option added to allow for PW added in addition to existing PW multiply
@ -415,7 +425,13 @@ void doUpdates()
writeAllConfig();
EEPROM.write(EEPROM_DATA_VERSION, 15);
}
if(EEPROM.read(EEPROM_DATA_VERSION) == 15)
{
writeAllConfig();
//EEPROM.write(EEPROM_DATA_VERSION, 16);
}
//Final check is always for 255 and 0 (Brand new arduino)

View File

@ -22,7 +22,7 @@ These are some utility functions and variables used through the main code
#define BITWISE_XOR 3
uint16_t ioDelay[sizeof(configPage13.outputPin)];
uint8_t outputPin[sizeof(configPage13.outputPin)];
//uint8_t outputPin[sizeof(configPage13.outputPin)];
void setResetControlPinState();
byte pinTranslate(byte);

View File

@ -6,7 +6,7 @@
#include <avr/pgmspace.h>
#include "globals.h"
#include "utils.h"
#include "utilities.h"
#include "decoders.h"
#include "comms.h"
#include "src/FastCRC/FastCRC.h"
@ -218,11 +218,10 @@ void initialiseProgrammableIO()
{
for (uint8_t y = 0; y < sizeof(configPage13.outputPin); y++)
{
if (outputPin[y] < BOARD_NR_GPIO_PINS) { outputPin[y] = configPage13.outputPin[y]; }
if ( (outputPin[y] > 0) && (outputPin[y] < BOARD_NR_GPIO_PINS) )
if ( (configPage13.outputPin[y] > 0) && (configPage13.outputPin[y] < BOARD_NR_GPIO_PINS) )
{
pinMode(outputPin[y], OUTPUT);
digitalWrite(outputPin[y], (configPage13.outputInverted & (1U << y)));
pinMode(configPage13.outputPin[y], OUTPUT);
digitalWrite(configPage13.outputPin[y], (configPage13.outputInverted & (1U << y)));
}
}
}
@ -236,8 +235,9 @@ void checkProgrammableIO()
{
firstCheck = false;
secondCheck = false;
if ( outputPin[y] > 0 ) //if outputPin == 0 it is disabled
{
if ( configPage13.outputPin[y] > 0 ) //if outputPin == 0 it is disabled
{
//byte theIndex = configPage13.firstDataIn[y];
data = ProgrammableIOGetData(configPage13.firstDataIn[y]);
data2 = configPage13.firstTarget[y];
@ -267,18 +267,19 @@ void checkProgrammableIO()
if (configPage13.operation[y].bitwise == BITWISE_XOR) { firstCheck ^= secondCheck; }
}
}
if ( (firstCheck == true) && (configPage13.outputDelay[y] != 0) && (configPage13.outputDelay[y] < 255) )
{
if ( (ioDelay[y] >= configPage13.outputDelay[y]) )
{
if (outputPin[y] <= 128) { digitalWrite(outputPin[y], (configPage13.outputInverted & (1U << y)) ^ firstCheck); }
if (configPage13.outputPin[y] <= 128) { digitalWrite(configPage13.outputPin[y], (configPage13.outputInverted & (1U << y)) ^ firstCheck); }
}
else { ioDelay[y]++; }
}
else
{
if ( outputPin[y] <= 128 ) { digitalWrite(outputPin[y], (configPage13.outputInverted & (1U << y)) ^ firstCheck); }
if ( configPage13.outputPin[y] <= 128 ) { digitalWrite(configPage13.outputPin[y], (configPage13.outputInverted & (1U << y)) ^ firstCheck); }
if ( firstCheck == false ) { ioDelay[y] = 0; }
}
if ( firstCheck == true ) { BIT_SET(currentStatus.outputsStatus, y); }
@ -300,6 +301,9 @@ int16_t ProgrammableIOGetData(uint16_t index)
}
if (x >= sizeof(fsIntIndex)) { result = fullStatus[index]; }
else { result = word(fullStatus[index+1], fullStatus[index]); }
//Special cases for temperatures
if( (index == 6) || (index == 7) ) { result -= CALIBRATION_TEMPERATURE_OFFSET; }
}
else { result = -1; } //Index is bigger than fullStatus array
return result;

View File

@ -9,6 +9,7 @@ void testPW(void)
{
RUN_TEST(test_PW_No_Multiply);
RUN_TEST(test_PW_MAP_Multiply);
RUN_TEST(test_PW_MAP_Multiply_Compatibility);
RUN_TEST(test_PW_AFR_Multiply);
RUN_TEST(test_PW_Large_Correction);
RUN_TEST(test_PW_Very_Large_Correction);
@ -36,6 +37,7 @@ void test_PW_No_Multiply()
configPage2.multiplyMAP = 0;
configPage2.includeAFR = 0;
configPage2.incorporateAFR = 0;
configPage2.aeApplyMode = 0;
uint16_t result = PW(REQ_FUEL, VE, MAP, corrections, injOpen);
TEST_ASSERT_UINT16_WITHIN(PW_ALLOWED_ERROR, 2557, result);
@ -46,9 +48,24 @@ void test_PW_MAP_Multiply()
test_PW_setCommon();
configPage2.multiplyMAP = 1;
currentStatus.baro = 100;
currentStatus.baro = 103;
configPage2.includeAFR = 0;
configPage2.incorporateAFR = 0;
configPage2.aeApplyMode = 0;
uint16_t result = PW(REQ_FUEL, VE, MAP, corrections, injOpen);
TEST_ASSERT_UINT16_WITHIN(PW_ALLOWED_ERROR, 2400, result);
}
void test_PW_MAP_Multiply_Compatibility()
{
test_PW_setCommon();
configPage2.multiplyMAP = 2; //Divide MAP reading by 100 rather than by Baro reading
currentStatus.baro = 103;
configPage2.includeAFR = 0;
configPage2.incorporateAFR = 0;
configPage2.aeApplyMode = 0;
uint16_t result = PW(REQ_FUEL, VE, MAP, corrections, injOpen);
TEST_ASSERT_UINT16_WITHIN(PW_ALLOWED_ERROR, 2449, result);
@ -62,6 +79,7 @@ void test_PW_AFR_Multiply()
currentStatus.baro = 100;
configPage2.includeAFR = 1;
configPage2.incorporateAFR = 0;
configPage2.aeApplyMode = 0;
configPage6.egoType = 2; //Set O2 sensor type to wideband
currentStatus.runSecs = 20; configPage6.ego_sdelay = 10; //Ensure that the run time is longer than the O2 warmup time
currentStatus.O2 = 150;
@ -88,6 +106,7 @@ void test_PW_Large_Correction()
configPage2.multiplyMAP = 0;
configPage2.includeAFR = 0;
configPage2.incorporateAFR = 0;
configPage2.aeApplyMode = 0;
uint16_t result = PW(REQ_FUEL, VE, MAP, corrections, injOpen);
TEST_ASSERT_UINT16_WITHIN(PW_ALLOWED_ERROR, 9268, result);
@ -102,6 +121,7 @@ void test_PW_Very_Large_Correction()
configPage2.multiplyMAP = 0;
configPage2.includeAFR = 0;
configPage2.incorporateAFR = 0;
configPage2.aeApplyMode = 0;
uint16_t result = PW(REQ_FUEL, VE, MAP, corrections, injOpen);
TEST_ASSERT_UINT16_WITHIN(PW_ALLOWED_ERROR+30, 21670, result); //Additional allowed error here

View File

@ -2,6 +2,7 @@ void testPW();
void test_PW_No_Multiply();
void test_PW_MAP_Multiply(void);
void test_PW_AFR_Multiply(void);
void test_PW_MAP_Multiply_Compatibility(void);
void test_PW_ALL_Multiply(void);
void test_PW_Large_Correction();
void test_PW_Very_Large_Correction();