From 2eb8e8e91f5bb3896333fb5467e40b7cb7f89c14 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Fri, 7 Apr 2017 00:23:47 +1000 Subject: [PATCH] Initial work on high res internal timing --- reference/speeduino.ini | 398 ++++++++++++++++++++-------------------- speeduino/decoders.ino | 14 +- speeduino/speeduino.ino | 117 ++++++------ 3 files changed, 266 insertions(+), 263 deletions(-) diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 8f3063d5..7e9fe790 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -7,33 +7,33 @@ queryCommand = "Q" ;signature = 20 - signature = "speeduino 201703" + signature = "speeduino 201704-dev" versionInfo = "S" ; Put this in the title bar. - + ;[TunerStudio] ; iniSpecVersion = 3.24 ;------------------------------------------------------------------------------- [SettingGroups] - ; the referenceName will over-ride previous, so if you are creating a - ; settingGroup with a reference name of lambdaSensor, it will replace the + ; the referenceName will over-ride previous, so if you are creating a + ; settingGroup with a reference name of lambdaSensor, it will replace the ; setting group defined in the settingGroups.xml of the TunerStudio config ; folder. If is is an undefined referenceName, it will be added. ; keyword = referenceName, DisplayName - ;settingGroup = boostUnits, "Boost table units" + ;settingGroup = boostUnits, "Boost table units" ;settingOption = DEFAULT, "kPa" ;settingOption = BOOSTPSI, "PSI" settingGroup = enablehardware_test, "Enable Hardware Test Page" - + [PcVariables] ; valid types: boolean, double, int, list - ; - ; no offset as they are local variables. + ; + ; no offset as they are local variables. ; entry format the same as Constants, except there is no offset. - ; arrays are not yet supported. + ; arrays are not yet supported. ; name = class, type, shape, units, scale, translate, lo, hi, digits ; name = type, min, max; ; @@ -41,7 +41,7 @@ rpmhigh = scalar, U16, "rpm", 1, 0, 0, 30000, 0 rpmwarn = scalar, U16, "rpm", 1, 0, 0, 30000, 0 rpmdang = scalar, U16, "rpm", 1, 0, 0, 30000, 0 - + idleUnits = bits, U08, [0:2], "None", "On/Off", "Duty Cycle", "Duty Cycle", "Steps", "Steps" [Constants] @@ -108,7 +108,7 @@ blockingFactor = 2048 tableBlockingFactor = 2048 delayAfterPortOpen=1000 - ;validateArrayBounds = true + ;validateArrayBounds = true blockReadTimeout = 2000 ;tsWriteBlocks = off ;writeBlocks = off @@ -130,7 +130,7 @@ page = 1 #error "Speeduino does not support MAF" ;#exit #endif - + ;-------------------------------------------------- ;Start Page 2 @@ -143,26 +143,26 @@ page = 2 aseCount = scalar, U08, 3, "s", 1.0, 0.0, 0.0, 255, 0 wueRates = array, U08, 4, [10], "%", 1.0, 0.0, 0.0, 255, 0 crankingPct= scalar, U08, 14, "%", 1.0, 0.0, 0.0, 255, 0 - pinLayout = bits, U08, 15, [0:7], "Speeduino v0.1", "Speeduino v0.2", "Speeduino v0.3", "Speeduino v0.4", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NA6 MX5 PNP", "Turtana PCB", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Plazomat I/O 0.1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Daz V6 Shield 0.1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" + pinLayout = bits, U08, 15, [0:7], "Speeduino v0.1", "Speeduino v0.2", "Speeduino v0.3", "Speeduino v0.4", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NA6 MX5 PNP", "Turtana PCB", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Plazomat I/O 0.1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "Daz V6 Shield 0.1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" tachoPin = bits, U08, 16, [0:5], "Board Default", "1", "2", "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" tachoDiv = bits, U08, 16, [6:7], "Normal", "Half", "INVALID", "INVALID" tdePct = scalar, U08, 17, "ms", 0.1, 0.0, 0.0, 25.5, 1 taeColdA = scalar, U08, 18, "ms", 0.1, 0.0, 0.0, 25.5, 1 tpsThresh = scalar, U08, 19, "%/s", 1.0, 0.0, 0.0, 255, 0 taeTime = scalar, U08, 20, "ms", 10, 0.0, 0.0, 2550, 0 - + ; Display (Options for what the display is showing) display = bits, U08, 21, [0:2], "Unused", "Adafruit 128x32", "Generic 128x32", "Adafruit 128x64", "Generic 128x64", "INVALID", "INVALID", "INVALID" display1 = bits U08, 21, [3:5], "RPM", "PW", "Advance", "VE", "GammaE", "TPS", "IAT", "CLT" display2 = bits U08, 21, [6:7], "O2", "Voltage", "CPU", "Mem" - + display3 = bits U08, 22, [0:2], "RPM", "PW", "Advance", "VE", "GammaE", "TPS", "IAT", "CLT" display4 = bits U08, 22, [3:4], "O2", "Voltage", "CPU", "Mem" display5 = bits U08, 22, [5:7], "RPM", "PW", "Advance", "VE", "GammaE", "TPS", "IAT", "CLT" - + displayB1 = bits U08, 23, [0:3], "RPM", "PW", "Advance", "VE", "GammaE", "TPS", "IAT", "CLT" displayB2 = bits U08, 23, [4:7], "RPM", "PW", "Advance", "VE", "GammaE", "TPS", "IAT", "CLT" - + reqFuel = scalar, U08, 24, "ms", 0.1, 0.0, 0.0, 25.5, 1 divider = scalar, U08, 25, "", 1.0, 0.0 alternate = bits, U08, 26, [0:0], "Simultaneous", "Alternating" @@ -184,12 +184,12 @@ page = 2 twoStroke = bits, U08, 36, [2:2], "Four-stroke", "Two-stroke" injType = bits, U08, 36, [3:3], "Port", "Throttle Body" nCylinders = bits, U08, 36, [4:7], "INVALID","1","2","3","4","5","6","INVALID","8","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID" - + ; Config2 cltType = bits, U08, 37, [0:1], "GM", "Unknown1", "Unknown2", "Unknown3" matType = bits, U08, 37, [2:3], "GM", "Unknown1", "Unknown2", "Unknown3" nInjectors = bits, U08, 37, [4:7], "INVALID","1","2","3","4","5","6","INVALID","8","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID" - + ; Config3 engineType = bits, U08, 38, [0:0], "Even fire", "Odd fire" flexEnabled= bits, U08, 38, [1:1], "Off", "On" @@ -198,12 +198,12 @@ page = 2 injLayout = bits, U08, 38, [4:5], "Paired", "Semi-Sequential", "INVALID", "Sequential" canEnable = bits, U08, 38, [6:6], "Disable", "Enable" unused2-38h= bits, U08, 38, [7:7], "No", "Yes" - + primePulse = scalar, U08, 39, "ms", 0.1, 0.0, 0.0, 25.5, 1 dutyLim = scalar, U08, 40, "%", 1.0, 0.0, 0.0, 100.0, 0 flexFreqLow = scalar, U08, 41, "Hz", 1.0, 0.0, 0.0, 250.0, 0 flexFreqHigh = scalar, U08, 42, "Hz", 1.0, 0.0, 0.0, 250.0, 0 - + boostMaxDuty = scalar, U08, 43, "%", 1.0, 0.0, 0.0, 100.0, 0 tpsMin = scalar, U08, 44, "ADC", 1.0, 0.0, 0.0, 255.0, 0 tpsMax = scalar, U08, 45, "ADC", 1.0, 0.0, 0.0, 255.0, 0 @@ -214,21 +214,21 @@ page = 2 oddfire2 = scalar, U16, 51, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte) oddfire3 = scalar, U16, 53, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte) oddfire4 = scalar, U16, 55, "deg", 1.0, 0.0, 0.0, 720, 0 ; * ( 2 byte) - - flexFuelLow = scalar, U08, 57, "%", 1.0, 0.0, 0.0, 250.0, 0 - flexFuelHigh = scalar, U08, 58, "%", 1.0, 0.0, 0.0, 250.0, 0 + + flexFuelLow = scalar, U08, 57, "%", 1.0, 0.0, 0.0, 250.0, 0 + flexFuelHigh = scalar, U08, 58, "%", 1.0, 0.0, 0.0, 250.0, 0 flexAdvLow = scalar, U08, 59, "Deg", 1.0, 0.0, 0.0, 250.0, 0 flexAdvHigh = scalar, U08, 60, "Deg", 1.0, 0.0, 0.0, 250.0, 0 - + iacCLminDuty = scalar, U08, 61, "%", 1.0, 0.0, 0.0, 100.0, 0 ; Minimum and maximum duty cycles when using closed loop idle iacCLmaxDuty = scalar, U08, 62, "%", 1.0, 0.0, 0.0, 100.0, 0 - boostMinDuty = scalar, U08, 63, "%", 1.0, 0.0, 0.0, 100.0, 0 ; Minimum and maximum duty cycles for boost control - + boostMinDuty = scalar, U08, 63, "%", 1.0, 0.0, 0.0, 100.0, 0 ; Minimum and maximum duty cycles for boost control + + - ;-------------------------------------------------- ;Start Ignition table (Page 3) -;-------------------------------------------------- +;-------------------------------------------------- page = 3 advTable1 = array, U08, 0,[16x16], "deg", 1.0, 0.0, 0.0, 255.0, 0 rpmBins2 = array, U08, 256,[ 16], "RPM", 100.0, 0.0, 100, 25500, 0 @@ -245,7 +245,7 @@ page = 3 ;-------------------------------------------------- ;Start Page 4 ;These are primarily ignition related settings (Previously part of page 2) -;-------------------------------------------------- +;-------------------------------------------------- page = 4 TrigAng = scalar, S16, 0, "Deg", 1, 0, -360, 360, 0 FixAng = scalar, U08, 2, "Deg", 1, 0, 0, 80, 0 @@ -268,7 +268,7 @@ page = 4 #endif IdleDelayTime = scalar, U08, 10, "sec", 1, 0, 0, 5, 0 StgCycles = scalar, U08, 11, "cycles", 1, 0, 0, 255, 0 - + ; name = array, type, offset, shape, units, scale, translate, lo, hi, digits ; name = scalar, type, offset, units, scale, translate, lo, hi, digits ;Dwell control @@ -277,22 +277,22 @@ page = 4 useDwellLim= bits, U08, 12, [1:1], "Off", "On" sparkMode = bits, U08, 12, [2:3], "Wasted Spark", "Single Channel", "Wasted COP", "Sequential" dfcoEnabled= bits, U08, 12, [4:4], "Off", "On" - TrigFilter = bits, U08, 12, [5:6], "Off", "Weak", "Medium", "Aggressive" + TrigFilter = bits, U08, 12, [5:6], "Off", "Weak", "Medium", "Aggressive" ignCranklock=bits, U08, 12, [7:7], "Off", "On" dwellcrank = scalar, U08, 13, "ms", 0.1, 0, 0, 25, 1 dwellrun = scalar, U08, 14, "ms", 0.1, 0, 0, 8, 1 numteeth = scalar, U08, 15, "teeth", 1.0, 0.0, 0.0, 255, 0 onetwo = scalar, U08, 16, "teeth", 1.0, 0.0, 0.0, 255, 0 - + crankRPM = scalar, U08, 17, "rpm", 100, 0.0, 100, 1000, 0 tpsflood = scalar, U08, 18, "%", 1.0, 0.0, 0.0, 255.0, 0 - + ;Rev Limits SoftRevLim = scalar, U08, 19, "rpm", 100, 0.0, 100, 25500, 0 SoftLimRetard = scalar, U08, 20, "deg", 1.0, 0.0, 0.0, 80, 0 SoftLimMax = scalar, U08, 21, "s", 0.1, 0.0, 0.0, 25.5, 1 HardRevLim = scalar, U08, 22, "rpm", 100, 0.0, 100, 25500, 0 - + ;TPS based acceleration enrichment taeBins = array, U08, 23, [ 4], "%/s", 10.0, 0.0, 0.00, 2550.0, 0 taeRates = array, U08, 27, [ 4], "%", 1.0, 0.0, 0.00, 255.0, 0 ; 4 bytes @@ -305,7 +305,7 @@ page = 4 ;Dwell config options dwellLim = scalar, U08, 41, "ms", 1, 0, 0, 32, 0 dwellRates = array, U08, 42, [6], "%", 1.0, 0.0, 0.00, 255.0, 0 - + ;IAT (Inlet air temp) timing retard #if CELSIUS iatRetBins = array, U08, 48, [ 6], "C", 1.0, 0.0, 0.00, 255.0, 0 @@ -321,8 +321,8 @@ page = 4 ignBypassEnable = bits, U08, 63, [0:0], "Off", "On" ignBypassPin = bits , U08, 63, [1:6], "INVALID", "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" ignBypassHiLo = bits, U08, 63, [7:7], "LOW", "HIGH" - - + + ;-------------------------------------------------- ;Start AFR page ;-------------------------------------------------- @@ -337,7 +337,7 @@ page = 5 #error "Speeduino does not support MAF" #exit #endif - + ;-------------------------------------------------- ;Start page 6 ; Page 6 is all settings associated with O2/AFR @@ -348,7 +348,7 @@ page = 6 boostEnabled= bits, U08, 0, [4:4], "Off", "On" vvtEnabled = bits, U08, 0, [5:5], "Off", "On" boostCutType= bits, U08, 0, [6:7], "Off", "Spark Only", "Fuel Only","Both" - + egoKP = scalar, U08, 1, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) egoKI = scalar, U08, 2, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) egoKD = scalar, U08, 3, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) @@ -360,8 +360,8 @@ page = 6 egoCount = scalar, U08, 5, "", 4.0, 0.0, 4.0, 255.0, 0 ; * ( 1 byte) egoDelta = scalar, U08, 6, "%", 1.0, 0.0, 0.0, 255.0, 0 ; * ( 1 byte) egoLimit = scalar, U08, 7, "", 1, 0, 0, 16, 0 - ego_min = scalar, U08, 8, "AFR", 0.1, 0.0, 7, 25, 1 - ego_max = scalar, U08, 9, "AFR", 0.1, 0.0, 7, 25, 1 + ego_min = scalar, U08, 8, "AFR", 0.1, 0.0, 7, 25, 1 + ego_max = scalar, U08, 9, "AFR", 0.1, 0.0, 7, 25, 1 ego_sdelay = scalar, U08, 10, "sec", 1, 0, 0, 120, 0 egoRPM = scalar, U08, 11, "rpm", 100, 0.0, 100, 25500, 0 egoTPSMax = scalar, U08, 12, "%", 1, 0, 0, 120, 0 @@ -379,22 +379,22 @@ page = 6 airDenBins = array, U08, 27, [9], "F", 1.8, -22.23, -40, 215, 0 ; Bins for the air density correction curve #endif airDenRates = array, U08, 36, [9], "%", 1.0, 0.0, 0, 255, 0 ; Values for the air density correction curve - + ; PWM Frequencies boostFreq = scalar, U08, 45, "Hz", 2.0, 0.0, 10, 511, 0 vvtFreq = scalar, U08, 46, "Hz", 2.0, 0.0, 10, 511, 0 idleFreq = scalar, U08, 47, "Hz", 2.0, 0.0, 10, 511, 0 - + ; Launch Control launchPin = bits , U08, 48, [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" launchEnable= bits, U08, 48, [6:6], "No", "Yes" launchHiLo = bits, U08, 48, [7:7], "LOW", "HIGH" - + lnchSoftLim = scalar, U08, 49, "rpm", 100, 0.0, 100, 25500, 0 lnchRetard = scalar, S08, 50, "deg", 1.0, 0.0, -30, 40, 0 lnchHardLim = scalar, U08, 51, "rpm", 100, 0.0, 100, 25500, 0 lnchFuelAdd = scalar, U08, 52, "%", 1.0, 0.0, 0.0, 80, 0 - + idleKP = scalar, U08, 53, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) idleKI = scalar, U08, 54, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) idleKD = scalar, U08, 55, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) @@ -402,7 +402,7 @@ page = 6 boostKP = scalar, U08, 57, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) boostKI = scalar, U08, 58, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) boostKD = scalar, U08, 59, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) - + lnchPullRes = bits, U08, 60, [0:1], "Float" , "Pullup", "INVALID", "INVALID" fuelTrimEnabled= bits, U08, 60, [2:2], "No", "Yes" flatSEnable = bits, U08, 60, [3:3], "No", "Yes" @@ -410,25 +410,25 @@ page = 6 unused6-60f = bits, U08, 60, [5:5], "ONE", "INVALID" unused6-60g = bits, U08, 60, [6:6], "ONE", "INVALID" unused6-60h = bits, U08, 60, [7:7], "ONE", "INVALID" - + ; Flat shift flatSSoftWin = scalar, U08, 61, "rpm", 100, 0.0, 100, 25500, 0 flatSRetard = scalar, U08, 62, "deg", 1.0, 0.0, 0.0, 80, 0 flatSArm = scalar, U08, 63, "rpm", 100, 0.0, 100, 25500, 0 - + ;-------------------------------------------------- ;Start idle and fan controls (Page 7) ;-------------------------------------------------- page = 7 iacCLValues = array, U08, 0, [10], "RPM", 10.0, 0.0, 0, 2550, 0 - iacOLStepVal = array, U08, 10, [10], "Steps", 3, 0, 0, 765, 0 + iacOLStepVal = array, U08, 10, [10], "Steps", 3, 0, 0, 765, 0 iacOLPWMVal = array, U08, 20, [10], "Duty %", 1.0, 0, 0, 100, 0 #if CELSIUS iacBins = array, U08, 30, [10], "C", 1.0, -40, -40, 215, 0 #else iacBins = array, U08, 30, [10], "F", 1.8, -22.23, -40, 215, 0 #endif - iacCrankSteps= array, U08, 40, [4], "Steps", 3, 0, 0, 765, 0 + iacCrankSteps= array, U08, 40, [4], "Steps", 3, 0, 0, 765, 0 iacCrankDuty = array, U08, 44, [4], "Duty %", 1.0, 0, 0, 100, 0 #if CELSIUS iacCrankBins = array, U08, 48, [4], "C", 1.0, -40, -40, 215, 0 @@ -440,26 +440,26 @@ page = 7 iacStepTime = bits , U08, 52, [3:5], "INVALID","1", "2", "3", "4", "5", "6","INVALID" iacChannels = bits, U08, 52, [6:6], "1", "2" iacPWMdir = bits , U08, 52, [7:7], "Normal", "Reverse" - - #if CELSIUS + + #if CELSIUS iacFastTemp = scalar, U08, 53, "C", 1.0, -40, -40, 215, 0 #else iacFastTemp = scalar, U08, 53, "F", 1.8, -22.23, -40, 215, 0 #endif - + iacStepHome = scalar, U08, 54, "Steps", 3, 0, 0, 765, 0 iacStepHyster= scalar, U08, 55, "Steps", 1, 0.0, 0.0, 10, 0 - + ; Begin fan control vairables fanInv = bits, U08, 56, [0:0], "No", "Yes" fanEnable = bits, U08, 56, [1:1], "Off", "On/Off" fanPin = bits , U08, 56, [2:7], "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" #if CELSIUS fanSP = scalar, U08, 57, "C", 1.0, -40, -40, 215.0, 0 - fanHyster = scalar, U08, 58, "C", 1.0, 0.0, 0.0, 40, 0 + fanHyster = scalar, U08, 58, "C", 1.0, 0.0, 0.0, 40, 0 #else fanSP = scalar, U08, 57, "F", 1.8, -22.23, -40, 215.0, 0 - fanHyster = scalar, U08, 58, "F", 1.0, 0.0, 0.0, 40, 0 + fanHyster = scalar, U08, 58, "F", 1.0, 0.0, 0.0, 40, 0 #endif fanFreq = scalar, U08 , 59, "Hz", 2.0, 0.0, 10, 511, 0 #if CELSIUS @@ -467,16 +467,16 @@ page = 7 #else fanPWMBins = array, U08, 60, [4], "F", 1.8, -22.23, -40, 215, 0 #endif - + ;-------------------------------------------------- ;Boost and vvt maps (Page 8) ;-------------------------------------------------- page = 8 ;notes for boostTable in PSI~~~There are 6.895 psis to a kPa then x 2 like the kPa ver~~~div atmos. pressure in kPa by 2 and make neg so to subtract instead of add ; #if BOOSTPSI -; boostTable = array, U08, 0,[8x8], "PSI", 0.29007547546041846, -50.6625, 0, 74, 0 +; boostTable = array, U08, 0,[8x8], "PSI", 0.29007547546041846, -50.6625, 0, 74, 0 ; #else - boostTable = array, U08, 0,[8x8], "kPa", 2.0, 0.0, 0, 511, 0 + boostTable = array, U08, 0,[8x8], "kPa", 2.0, 0.0, 0, 511, 0 ; #endif rpmBinsBoost = array, U08, 64,[ 8], "RPM", 100.0, 0.0, 100, 25500, 0 tpsBinsBoost = array, U08, 72,[ 8], "TPS", 1.0, 0.0, 0.0, 255.0, 0 @@ -488,7 +488,7 @@ page = 8 ;Sequential fuel trim tables (Page 9) ;-------------------------------------------------- page = 9 - fuelTrim1Table = array, U08, 0,[6x6], "%", 1.0, -128, -50, 50, 0 + fuelTrim1Table = array, U08, 0,[6x6], "%", 1.0, -128, -50, 50, 0 fuelTrim1rpmBins = array, U08, 36,[ 6], "RPM", 100.0, 0.0, 100, 25500, 0 #if SPEED_DENSITY fuelTrim1loadBins = array, U08, 42,[ 6], "kPa", 2.0, 0.0, 0.0, 511.0, 0 @@ -519,7 +519,7 @@ page = 9 #elif ALPHA_N fuelTrim4loadBins = array, U08, 186,[ 6], "TPS", 2.0, 0.0, 0.0, 100.0, 0 #endif - + ;-------------------------------------------------- ;CANBUS control (Page 10) ;-------------------------------------------------- @@ -534,7 +534,7 @@ page = 10 unused10_7 = scalar, U08, 7, "", 1, 0, 0, 255, 0 unused10_8 = scalar, U08, 8, "", 1, 0, 0, 255, 0 unused10_9 = scalar, U08, 9, "", 1, 0, 0, 255, 0 - unused10_10 = scalar, U08, 10, "", 1, 0, 0, 255, 0 + unused10_10 = scalar, U08, 10, "", 1, 0, 0, 255, 0 unused10_11 = scalar, U08, 11, "", 1, 0, 0, 255, 0 unused10_12 = scalar, U08, 12, "", 1, 0, 0, 255, 0 unused10_13 = scalar, U08, 13, "", 1, 0, 0, 255, 0 @@ -644,7 +644,7 @@ page = 10 unused10_117 = scalar, U08, 117, "", 1, 0, 0, 255, 0 unused10_118 = scalar, U08, 118, "", 1, 0, 0, 255, 0 unused10_119 = scalar, U08, 119, "", 1, 0, 0, 255, 0 - unused10_120 = scalar, U08, 120, "", 1, 0, 0, 255, 0 + unused10_120 = scalar, U08, 120, "", 1, 0, 0, 255, 0 unused10_121 = scalar, U08, 121, "", 1, 0, 0, 255, 0 unused10_122 = scalar, U08, 122, "", 1, 0, 0, 255, 0 unused10_123 = scalar, U08, 123, "", 1, 0, 0, 255, 0 @@ -652,7 +652,7 @@ page = 10 unused10_125 = scalar, U08, 125, "", 1, 0, 0, 255, 0 unused10_126 = scalar, U08, 126, "", 1, 0, 0, 255, 0 unused10_127 = scalar, U08, 127, "", 1, 0, 0, 255, 0 - + ;------------------------------------------------------------------------------- [ConstantsExtensions] @@ -683,7 +683,7 @@ page = 10 requiresPowerCycle = iacCLmaxDuty requiresPowerCycle = boostMinDuty requiresPowerCycle = boostMaxDuty - + defaultValue = pinLayout, 1 defaultValue = TrigPattern, 0 defaultValue = useResync, 1 @@ -719,7 +719,7 @@ page = 10 defaultValue = iacCLmaxDuty,100 defaultValue = boostMinDuty,0 defaultValue = boostMaxDuty,100 - + ;Default pins defaultValue = fanPin, 0 defaultValue = vvtPin, 0 @@ -746,11 +746,11 @@ page = 10 ; useful for multi-page code variants), which causes them to edit the ; specified page. If you leave off the page specifier, they edit logical ; page one as specified in the Constants section. - ; + ; ; There are four special menu names, which when used append to the standard ; menus of the same name instead of creating a new one. The menu names ; are "File", "Communications", "Tools" and "Help". - ; + ; ;---------------------------------------------------------------------------- menuDialog = main @@ -762,7 +762,7 @@ menuDialog = main subMenu = triggerSettings, "&Trigger Setup" ;subMenu = OLED, "OLED Setup" subMenu = airdensity_curve, "IAT Density" - + menu = "&Tuning" subMenu = std_realtime, "&Realtime Display" @@ -786,18 +786,18 @@ menuDialog = main subMenu = iat_retard_curve, "&IAT Retard" ;subMenu = wheelsim, "Stim for wheel" ;subMenu = oddwheel, "Oddfire Wheel settings", 7, { wheelon && oddfire } - + menu = "&Starting/Idle" subMenu = crankPW, "Cranking Settings" subMenu = warmup, "Warmup Enrichment" - subMenu = std_separator + subMenu = std_separator subMenu = idleSettings, "Idle Control" subMenu = iacClosedLoop_curve, "Idle - Closed loop targets", 7, { iacAlgorithm == 3 || iacAlgorithm == 5 } subMenu = iacPwm_curve, "Idle - PWM Duty Cycle", 7, { iacAlgorithm == 2 } subMenu = iacPwmCrank_curve, "Idle - PWM Cranking Duty Cycle", 7, { iacAlgorithm == 2 } subMenu = iacStep_curve, "Idle - Stepper Motor", 7, { iacAlgorithm == 4 } subMenu = iacStepCrank_curve, "Idle - Stepper Motor Cranking", 7, { iacAlgorithm == 4 } - + menu = "&Accessories" subMenu = fanSettings, "Thermo Fan" subMenu = LaunchControl, "Launch Control / Flat Shift" @@ -812,9 +812,9 @@ menuDialog = main subMenu = tacho, "Tacho Output" subMenu = std_separator subMenu = canIO, "Canbus Interface" - - - + + + menuDialog = main menu = "T&ools" subMenu = mapCal, "Calibrate MAP" @@ -823,19 +823,19 @@ menuDialog = main ;subMenu = flash_unlock, "Un/Lock calibrations" subMenu = std_ms2gentherm, "Calibrate Thermistor Tables", 0 ;, {flashlock} subMenu = std_ms2geno2, "Calibrate &AFR Table", 0;, {flashlock} - + menuDialog = main menu = "3D &Tuning Maps" subMenu = veTable1Map, "Fuel Table" subMenu = sparkMap, "Spark Table", 3 subMenu = afrTable1Map, "AFR Target Table" -#if enablehardware_test +#if enablehardware_test menuDialog = main menu = "Hardware Testing" subMenu = outputtest1, "Test Output Hardware" #endif - + menu = "Help" subMenu = helpGeneral, "Speeduino Help" ;------------------------------------------------------------------------------- @@ -846,13 +846,13 @@ menuDialog = main ;Ensure all settings are defined as some MS2/BG words shipped with TS are not applicable. nCylinders = "The number of cylinders in your engine." alternate = "" - engineType = "Most engines are Even Fire. Typical odd-fire engines are V-twin, some V4, Vmax, some V6, V10." + engineType = "Most engines are Even Fire. Typical odd-fire engines are V-twin, some V4, Vmax, some V6, V10." twoStroke = "Four-Stroke (most engines), Two-stroke." nInjectors = "Number of primary injectors." mapSample = "The method used for calculating the MAP reading\nFor 1-2 Cylinder engines, Cycle Minimum is recommended.\nFor more than 2 cylinders Cycle Average is recommended" stoich = "The stoichiometric ration of the fuel being used. For flex fuel, choose the primary fuel" injLayout = "The injector layout and timing to be used. Options are: \n 1. Paired - 2 injectors per output. Outputs active is equal to half the number of cylinders. Outputs are timed over 1 crank revolution. \n 2. Semi-sequential: Same as paired except that injector channels are mirrored (1&4, 2&3) meaning the number of outputs used are equal to the number of cylinders. Only valid for 4 cylinders or less. \n 3. Banked: 2 outputs only used. \n 4. Sequential: 1 injector per output and outputs used equals the number of cylinders. Injection is timed over full cycle. " - + TrigPattern = "The type of input trigger decoder to be used." useResync = "If enabled, sync will be rechecked once every full cycle from the cam input. This is good for accuracy, however if your cam input is noisy then this can cause issues." numteeth = "Number of teeth on Primary Wheel." @@ -864,41 +864,41 @@ menuDialog = main TrigEdge = "The Trigger edge of the primary sensor.\nLeading.\nTrailing." TrigEdgeSec = "The Trigger edge of the secondary (Cam) sensor.\nLeading.\nTrailing." TrigFilter = "Tuning of the trigger filter algorithm. The more aggressive the setting, the more noise will be removed, however this increases the chance of some true readings being filtered out (False positive). Medium is safe for most setups. Only select 'Aggressive' if no other options are working" - + sparkMode = "Wasted Spark: Ignition outputs are on the channels <= half the number of cylinders. Eg 4 cylinder outputs on IGN1 and IGN2.\nSingle Channel: All ignition pulses are output on IGN1.\nWasted COP: Ignition pulses are output on all ignition channels up to the number of cylinders. Eg 4 cylinder outputs on all ignition channels. No valid for >4 cylinders" IgInv = "Whether the spark fires when the ignition sign goes high or goes low. Most ignition systems 'Going Low' but please verify this as damage to coils can result from the incorrect selection" - + fanInv = "" fanHyster = "The number of degrees of hysteresis to be used in controlling the fan. Recommended values are between 2 and 5" - + taeTime = "The duration of the acceleration enrichment" - + iacChannels = "The number of output channels used for PWM valves. Select 1 for 2-wire valves or 2 for 3-wire valves." iacStepTime = "Time between each stepper motor step.\nIncrease this if the motor appears to behave intermittently." iacStepHome = "On startup the stepper motor moves this many steps to return to its home position. Set this value to a few more than the actual number to ensure the motor has returned to its full position." - iacStepHyster = "The minimum number of steps to move in any one go." + iacStepHyster = "The minimum number of steps to move in any one go." iacAlgorithm = "Selects method of idle control.\nNone = no idle control valve.\nOn/Off valve.\nPWM valve (2,3 wire).\nStepper Valve (4,6,8 wire)." iacPWMdir = "Normal PWM valves increase RPM with higher duty. If RPM decreases with higher duty then select Reverse" iacCLminDuty= "When using closed loop idle control, this is the minimum duty cycle that the PID loop will allow. Combined with the maximum value, this specifies the working range of your idle valve" iacCLmaxDuty= "When using closed loop idle control, this is the maximum duty cycle that the PID loop will allow. Combined with the minimum value, this specifies the working range of your idle valve" iacFastTemp = "Below this temperature, the idle output will be high (On). Above this temperature, it will turn off." - + oddfire2 = "The ATDC angle of channel 2 for oddfire engines. This is relative to the TDC angle of channel 1" oddfire3 = "The ATDC angle of channel 3 for oddfire engines. This is relative to the TDC angle of channel 1 (NOT channel 2)" oddfire4 = "The ATDC angle of channel 4 for oddfire engines. This is relative to the TDC angle of channel 1 (NOT channel 3)" - + dfcoRPM = "The RPM above which DFCO will be active. Typically set a few hundred RPM above maximum idle speed" dfcoHyster = "Hysteresis for DFCO RPM. 200-300 RPM is typical for this, however a higher value may be needed if the RPM is fluctuating around the cutout speed" dfcoTPSThresh= "The TPS value below which DFCO will be active. Typical value is 5%-10%, but higher may be needed if TPS signal is noisy" - + launchPin = "The ARDUINO pin that the clutch switch is connected to. This is NOT the pin on the connector, but the pin it relates to on the arduino" ignBypassPin = "The ARDUINO pin that the ignition bypass is connected to. This is NOT the pin on the connector, but the pin it relates to on the arduino" ignBypassEnable = "If turned on, a ground signal will be output during cranking on the specified pin. This is used to bypass the Speeduino ignition control during cranking." - ignCranklock = "On certain low resolution ignition patterns, the cranking timing can be locked to occur when a pulse is recieved." - + ignCranklock = "On certain low resolution ignition patterns, the cranking timing can be locked to occur when a pulse is received." + multiplyMAP = "If enabled, the MAP reading is included directly into the pulsewidth calculation. This results in a flatter VE table that can be easier to tune in some instances. VE table must be retuned when this value is changed." includeAFR = "When enabled, the current AFR reading is incorporated directly in the pulsewidth calculation as a percentage of the current target ratio. VE table must be retuned when this value is changed. " - + flexEnabled = "Turns on readings from the Flex sensor and enables the below adjustments" flexFreqLow = "The frequency of the sensor at 0% ethanol (50Hz for standard GM/Continental sensor)" flexFreqHigh = "The frequency of the sensor at 100% ethanol (150Hz for standard GM/Continental sensor)" @@ -906,9 +906,9 @@ menuDialog = main flexFuelHigh = "Fuel % to be used for the highest ethanol reading (Typically 163% for 100% ethanol)" flexAdvLow = "Additional advance (in degrees) at lowest ethanol reading (Typically 0)" flexAdvHigh = "Additional advance (in degrees) at highest ethanol reading (Typically 10-20 degrees)" - + flatSArm = "The RPM switch point that determines whether an eganged clutch is for launch control or flat shift. Below this figure, an engaged clutch is considered to be for launch, above this figure an active clutch input will be considered a flat shift. This should be set at least several hundred RPM above idle" - flatSSoftWin= "The number of RPM below the flat shift point where the softlimit will be applied (aka Soft limit window). Recommended values are 200-1000" + flatSSoftWin= "The number of RPM below the flat shift point where the softlimit will be applied (aka Soft limit window). Recommended values are 200-1000" flatSRetard = "The absolute timing (BTDC) that will be used when within the soft limit window" cmdEnableTestMode = "Click this to enable test mode. This will not be available if the engine is running" @@ -921,7 +921,7 @@ menuDialog = main cmdtestspk250dc = "this will cycle the output at 50% Duty cycle" cmdtestspk350dc = "this will cycle the output at 50% Duty cycle" cmdtestspk450dc = "this will cycle the output at 50% Duty cycle" - + [UserDefined] ; Enhanced TunerStudio dialogs can be defined here @@ -939,7 +939,7 @@ menuDialog = main ; valid border constraints are north, South, East, West, Center ; all 5 do not need to be filled. -; The field name can be either a constant reference, or a reference to another +; The field name can be either a constant reference, or a reference to another ; dialog which will be added. ; dialogs can be nested and can be mixed with fields @@ -952,24 +952,24 @@ menuDialog = main dialog = engine_constants_west, "" panel = std_injection, North panel = engine_constants_southwest - + dialog = engine_constants_northeast, "Oddfire Angles" field = "Channel 2 angle", oddfire2, { engineType == 1 } field = "Channel 3 angle", oddfire3, { engineType == 1 && nCylinders >= 3 } field = "Channel 4 angle", oddfire4, { engineType == 1 && nCylinders >= 4 } - + dialog = engine_constants_east, "" panel = engine_constants_northeast, North field = "" - + dialog = engine_constants, "", border panel = engine_constants_west, West panel = engine_constants_east, East - + # Flex fuel stuff dialog = flexFueling, "Flex Fuel" field = "Flex sensor", flexEnabled - + dialog = flexn, "" field = "#Spark/Fuel" field = "Sensor Frequency" @@ -987,7 +987,7 @@ menuDialog = main #field = "Low" #field = "", ff_tpw0, { flexEnabled && (fueltemp1 == 1)} #field = "", ff_temp0, { flexEnabled && (fueltemp1 == 1)} - + dialog = flexh, "" field = "High" field = "", flexFreqHigh, { flexEnabled } @@ -1017,53 +1017,53 @@ menuDialog = main panel = flexFuelTop panel = ff_table panel = ff_fallback - + dialog = tacho, "Tacho" - field = "Output pin", tachoPin - field = "Output speed", tachoDiv + field = "Output pin", tachoPin + field = "Output speed", tachoDiv dialog = canIO, "CanBus interface" field = "Enable/Disable", canEnable - + dialog = accelEnrichments_center, "" field = "TPSdot Threshold", tpsThresh field = "Accel Time", taeTime ; field = "Cold Accel Enrichment", taeColdA ; field = "Cold Accel Mult", taeColdM - ;field = "Decel Fuel Amount", tdePct - + ;field = "Decel Fuel Amount", tdePct + dialog = accelEnrichments_south, "Decelleration Fuel Cutoff (DFCO)" field = "Enabled", dfcoEnabled field = "TPS Threshold", dfcoTPSThresh, { dfcoEnabled } field = "Cutoff RPM", dfcoRPM, { dfcoEnabled } field = "RPM Hysteresis", dfcoHyster, { dfcoEnabled } - + dialog = accelEnrichments_north_south, "" liveGraph = pump_ae_Graph, "AE Graph" graphLine = afr - graphLine = TPSdot, "%", -2000, 2000, auto, auto - + graphLine = TPSdot, "%", -2000, 2000, auto, auto + dialog = accelEnrichments_north, "", xAxis panel = time_accel_tpsdot_curve ;panel = time_accel_tpsdot_tbl - + dialog = accelEnrichments, "Acceleration Enrichment" panel = accelEnrichments_north, North panel = accelEnrichments_north_south, Center panel = accelEnrichments_center, Center panel = accelEnrichments_south, South - + dialog = veTableDialog_north, "" panel = veTable1Tbl - + dialog = veTableDialog_south, "" field = "Multiply VE value by MAP", multiplyMAP field = "Include AFR directly", includeAFR, { egoType == 2 } - + dialog = veTableDialog, "VE Table" panel = veTableDialog_north, North panel = veTableDialog_south, South - + dialog = injChars, "Injector Characteristics" field = "Injector Open Time", injOpen field = "Injector close angle" @@ -1075,7 +1075,7 @@ menuDialog = main field = "Channel 4", inj4Ang, { indInjAng && (nCylinders > 6 || ((nCylinders == 4) && (injLayout == 3))) } field = "Injector Duty Limit", dutyLim panel = injector_voltage_curve - + dialog = egoControl, "" field = "Sensor Type", egoType field = "Algorithm", egoAlgorithm, { egoType } @@ -1092,31 +1092,31 @@ menuDialog = main field = "PID Proportional Gain", egoKP, { egoType && (egoAlgorithm == 2) } field = "PID Integral", egoKI, { egoType && (egoAlgorithm == 2) } field = "PID Derivative", egoKD, { egoType && (egoAlgorithm == 2) } - + dialog = fanSettings,"Fan Settings",7 field = "Fan Mode", fanEnable - field = "Fan output pin", fanPin, { fanEnable } - field = "Fan Output Inverted", fanInv , { fanEnable } + field = "Fan output pin", fanPin, { fanEnable } + field = "Fan Output Inverted", fanInv , { fanEnable } field = "Fan temperature SP", fanSP, { fanEnable } field = "Fan hysteresis", fanHyster, { fanEnable } - + dialog = stepper_idle, "Stepper Idle" field = "Step time (ms)", iacStepTime, { iacAlgorithm == 4 || iacAlgorithm == 5 } field = "Home steps", iacStepHome, { iacAlgorithm == 4 || iacAlgorithm == 5 } field = "Minimum Steps", iacStepHyster, { iacAlgorithm == 4 || iacAlgorithm == 5 } - + dialog = pwm_idle, "PWM Idle" field = "Number of outputs", iacChannels, { iacAlgorithm == 2 || iacAlgorithm == 3 } field = "Idle valve frequency", idleFreq, { iacAlgorithm == 2 || iacAlgorithm == 3 } field = "Idle valve direction", iacPWMdir, { iacAlgorithm == 2 || iacAlgorithm == 3 } - + dialog = closedloop_idle, "Closed loop Idle" field = "P", idleKP, { iacAlgorithm == 3 || iacAlgorithm == 5 } field = "I", idleKI, { iacAlgorithm == 3 || iacAlgorithm == 5 } field = "D", idleKD, { iacAlgorithm == 3 || iacAlgorithm == 5 } field = "Minimum valve duty", iacCLminDuty, { iacAlgorithm == 3 } field = "Maximum valve duty", iacCLmaxDuty, { iacAlgorithm == 3 } - + dialog = idleSettings, "Idle Settings" topicHelp = "http://speeduino.com/wiki/index.php/Idle" field = "Idle control type", iacAlgorithm @@ -1125,10 +1125,10 @@ menuDialog = main panel = pwm_idle panel = stepper_idle panel = closedloop_idle - + dialog = fuelpump, "Fuel pump" field = "Fuel pump pin", fuelPumpPin - + dialog = crankPW, "Cranking Pulsewidths (ms)" field = "Cranking RPM (Max)", crankRPM field = "Flood Clear level", tpsflood @@ -1141,12 +1141,12 @@ menuDialog = main field = "Cranking bypass", ignBypassEnable field = "Bypass output pin", ignBypassPin { ignBypassEnable } field = "Fix cranking timing with trigger", ignCranklock, { TrigPattern == 1 || TrigPattern == 4 || TrigPattern == 10} - + dialog = aseSettings, "Afterstart Enrichment" field = "Enrichment %", asePct field = "Number of Sec to run", aseCount - - + + dialog = triggerSettings,"Trigger Settings",4 topicHelp = "http://speeduino.com/wiki/index.php/Decoders" field = "Trigger Pattern", TrigPattern @@ -1166,7 +1166,7 @@ menuDialog = main field = "Secondary trigger edge", TrigEdgeSec, { TrigPattern == 0 || TrigPattern == 2 } ;Missing tooth and dual wheel field = "Trigger Filter", TrigFilter field = "Re-sync every cycle", useResync, { TrigPattern == 2 || TrigPattern == 4 || TrigPattern == 7 } ;Dual wheel, 4G63 and Audi 135 - + dialog = sparkSettings,"Spark Settings",4 field = "Spark output mode", sparkMode field = "Cranking advance Angle", CrankAng @@ -1175,7 +1175,7 @@ menuDialog = main field = "" field = "Fixed Angle (0 = use map)", FixAng ;field = "Trim Angle", Trim - + dialog = dwellSettings, "Dwell Settings", 4 topicHelp = DwellHelp ;field = "Dwell control", dwellcont @@ -1194,7 +1194,7 @@ menuDialog = main field = "Max dwell time", dwellLim, { useDwellLim } field = "Note: Set the maximum dwell time at least 3ms above" field = "your desired dwell time (Including cranking)" - + dialog = RevLimiterS, "Rev Limiter", 4 topicHelp = Fhelp7 field = "Rev Limiter" @@ -1202,13 +1202,13 @@ menuDialog = main field = "Soft limit absolute timing", SoftLimRetard field = "Soft limit max time", SoftLimMax field = "Hard Rev limit", HardRevLim - + dialog = clutchInput, "Clutch input" field = "Clutch Input Pin", launchPin, { launchEnable || flatSEnable } field = "Clutch enabled when signal is",launchHiLo, { launchEnable || flatSEnable } field = "Clutch Pullup Resistor", lnchPullRes, { launchEnable || flatSEnable } field = "Launch / Flat Shift switch RPM",flatSArm, { launchEnable || flatSEnable } - + dialog = LaunchControl, "Launch Control / Flat shift", 6 topicHelp = Fhelp7 panel = clutchInput @@ -1219,25 +1219,25 @@ menuDialog = main field = "Soft limit absolute timing", lnchRetard, { launchEnable } field = "Hard rev limit", lnchHardLim, { launchEnable } field = "Fuel adder during launch", lnchFuelAdd, { launchEnable } - + ; Flat shift field = "Flat Shift" field = "Enable flat shift", flatSEnable field = "Soft rev window", flatSSoftWin, { flatSEnable } field = "Soft limit absolute timing", flatSRetard, { flatSEnable } - + dialog = OLED, "OLED Display", 2 field = "Display Type", display field = "#Note" field = "ECU must be rebooted after changing above value" field = "Field 1", display1, { display } - field = "Field 2", display2, { display } - field = "Field 3", display3, { display } - field = "Field 4", display4, { display } + field = "Field 2", display2, { display } + field = "Field 3", display3, { display } + field = "Field 4", display4, { display } ;field = "Bar 1", displayB1, { display } ;field = "Bar 2", displayB2, { display > 2 } - + dialog = mapCal, "Calibrate MAP" field = "#MAP Sensor" settingSelector = "Common MAP Sensors" @@ -1251,7 +1251,7 @@ menuDialog = main settingOption = "MPX4400", mapMin=0, mapMax=400 settingOption = "Denso 079800", mapMin=0, mapMax=173 ; http://speeduino.com/forum/viewtopic.php?f=18&t=510&p=7023#p7021 settingOption = "VW/Audi/Porsche 250kPa", mapMin=26, mapMax=250 ; http://speeduino.com/forum/viewtopic.php?p=17502#p17502 - + dialog = boostSettings, "Boost Control" field = "Boost Control Enabled", boostEnabled field = "Boost output pin", boostPin, { boostEnabled } @@ -1264,12 +1264,12 @@ menuDialog = main field = "D", boostKD, { boostEnabled } field = "Valve minimum duty cycle", boostMinDuty, { boostEnabled } field = "Valve maximum duty cycle", boostMaxDuty, { boostEnabled } - + dialog = vvtSettings, "VVT Control" field = "VVT Control Enabled", vvtEnabled field = "VVT output pin", vvtPin, { vvtEnabled } field = "VVT solenoid freq.", vvtFreq, { vvtEnabled } - + dialog = wc_note field = "For 99% of engines, warmup must have 100% in the final row. Typical maximum is 255% (cold)." @@ -1278,9 +1278,9 @@ menuDialog = main panel = wc_note field = "" panel = aseSettings - + ;Fuel trim composite dialog - dialog = inj_trim1TblTitle, "Channel #1" + dialog = inj_trim1TblTitle, "Channel #1" panel = fuelTrimTable1Tbl, Center, { fuelTrimEnabled } dialog = inj_trim2TblTitle, "Channel #2" panel = fuelTrimTable2Tbl, { fuelTrimEnabled } @@ -1304,7 +1304,7 @@ menuDialog = main dialog = outputtest_warningmessage, "" field = "WARNING! USE AT YOUR OWN RISK. INCORRECT USE WILL DAMAGE YOUR HARDWARE!" field = "Do not attempt to use this page whilst your engine is running!" - field = "Forcing the Injector or Spark outputs could cause flooding of your engine or permanent damage to ignition coils!" + field = "Forcing the Injector or Spark outputs could cause flooding of your engine or permanent damage to ignition coils!" dialog = enableoutputtestbuttons, "Enable Test Controls", xAxis @@ -1320,8 +1320,8 @@ menuDialog = main ; clickOnCloseIfEnabled - the command will be sent on dialog close if active condition is true ; clickOnCloseIfDisabled - the command will be sent on dialog close if active condition is false ; clickOnClose - the command will be sent on dialog close always - commandButton = "Stop Test Mode", cmdStopTestMode,{testactive}, clickOnCloseIfEnabled - + commandButton = "Stop Test Mode", cmdStopTestMode,{testactive}, clickOnCloseIfEnabled + dialog = outputtestinj1, "Injector CH1", yAxis commandButton = "Off", cmdtestinj1off,{testactive} commandButton = "50% DC", cmdtestinj150dc,{!testenabled & testactive} @@ -1338,13 +1338,13 @@ menuDialog = main commandButton = "Off", cmdtestinj4off,{testactive} commandButton = "50% DC", cmdtestinj450dc,{!testenabled & testactive} commandButton = "On", cmdtestinj4on ,{!testenabled & testactive} - + dialog = outputtest_injectors, "Injector Driver Output Test", xAxis panel = outputtestinj1 panel = outputtestinj2 panel = outputtestinj3 panel = outputtestinj4 - + dialog = outputtestspk1, "Spark CH1 ", yAxis commandButton = "Off", cmdtestspk1off,{testactive} commandButton = "50% DC", cmdtestspk150dc,{!testenabled & testactive} @@ -1361,13 +1361,13 @@ menuDialog = main commandButton = "Off", cmdtestspk4off,{testactive} commandButton = "50% DC", cmdtestspk450dc,{!testenabled & testactive} commandButton = "On", cmdtestspk4on,{!testenabled & testactive} - + dialog = outputtest_spark, "Spark Driver Output Test", xAxis panel = outputtestspk1 panel = outputtestspk2 panel = outputtestspk3 - panel = outputtestspk4 - + panel = outputtestspk4 + dialog = outputtest1,"Test Output Hardware" ;topicHelp = "" panel = enableoutputtestbuttons @@ -1391,7 +1391,7 @@ menuDialog = main ; This does not include any resultant protocol envelope data, only the response data itself. ; WARNING!! These commands bypass TunerStudio's normal memory synchronization. If these commands -; alter mapped settings (Constant) memory in the controller, TunerStudio will have an out of sync condition +; alter mapped settings (Constant) memory in the controller, TunerStudio will have an out of sync condition ; and may create error messages. ; It is expected that these commands would not typically alter any ram mapped to a Constant. @@ -1427,7 +1427,7 @@ cmdtestspk450dc = "E\x03\x0C" ; ------------------------------------------------------------- ; Help down here [SettingContextHelp] - + [CurveEditor] @@ -1439,7 +1439,7 @@ cmdtestspk450dc = "E\x03\x0C" xBins = taeBins, TPSdot yBins = taeRates ;gauge = cltGauge - + ; Correction curve for dwell vs battery voltage curve = dwell_correction_curve, "Dwell voltage correction" columnLabel = "Voltage", "Dwell" @@ -1455,9 +1455,9 @@ cmdtestspk450dc = "E\x03\x0C" yAxis = 0, 255, 6 xBins = brvBins, batteryVoltage yBins = injBatRates - - - + + + ; Correction curve for Air Density vs temperature curve = airdensity_curve, "IAT density correction" columnLabel = "Air Temperature", "Fuel Amount" @@ -1465,15 +1465,15 @@ cmdtestspk450dc = "E\x03\x0C" yAxis = 0, 255, 6 xBins = airDenBins, iat yBins = airDenRates - -; IAT based ignition timing retard + +; IAT based ignition timing retard curve = iat_retard_curve, "IAT timing retard" columnLabel = "Inlet Air Temp", "Retard" xAxis = -40, 200, 5 yAxis = 0, 30, 5 xBins = iatRetBins, iat - yBins = iatRetRates - + yBins = iatRetRates + ; Curves for idle control ; Standard duty table for PWM valves curve = iacPwm_curve, "IAC PWM Duty" @@ -1486,7 +1486,7 @@ cmdtestspk450dc = "E\x03\x0C" yAxis = 0, 100, 4 xBins = iacBins, coolant yBins = iacOLPWMVal - + ; Cranking duty table for PWM valves curve = iacPwmCrank_curve, "IAC PWM Cranking Duty" columnLabel = "Coolant Temperature", "Valve" @@ -1494,7 +1494,7 @@ cmdtestspk450dc = "E\x03\x0C" yAxis = 0, 100, 4 xBins = iacCrankBins, coolant yBins = iacCrankDuty - + curve = iacStep_curve, "IAC Stepper Motor" columnLabel = "Coolant Temperature", "Motor" #if CELSIUS @@ -1505,14 +1505,14 @@ cmdtestspk450dc = "E\x03\x0C" yAxis = 0, 850, 4 xBins = iacBins, coolant yBins = iacOLStepVal - + curve = iacStepCrank_curve, "IAC Stepper Motor Cranking" columnLabel = "Coolant Temperature", "Motor" xAxis = -40, 120, 6 yAxis = 0, 850, 4 xBins = iacCrankBins, coolant yBins = iacCrankSteps - + curve = iacClosedLoop_curve, "IAC Closed Loop Targets" columnLabel = "Coolant Temperature", "Motor" xAxis = -40, 120, 6 @@ -1529,8 +1529,8 @@ cmdtestspk450dc = "E\x03\x0C" xBins = wueBins, coolant yBins = wueRates gauge = cltGauge - - + + [TableEditor] ; table_id, map3d_id, "title", page table = veTable1Tbl, veTable1Map, "VE Table", 1 @@ -1547,7 +1547,7 @@ cmdtestspk450dc = "E\x03\x0C" gridHeight = 2.0 gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees. upDownLabel = "(RICHER)", "(LEANER)" - + table = sparkTbl, sparkMap, "Ignition Advance Table", 3 xBins = rpmBins2, rpm #if SPEED_DENSITY @@ -1558,7 +1558,7 @@ cmdtestspk450dc = "E\x03\x0C" zBins = advTable1 gridHeight = 3.0 upDownLabel = "ADVANCED", "RETARDED" - + ;table = afrTbl, afrTableMap, "AFR Table", 5 table = afrTable1Tbl, afrTable1Map, "AFR Table", 5 xBins = rpmBinsAFR, rpm @@ -1582,14 +1582,14 @@ cmdtestspk450dc = "E\x03\x0C" zBins = boostTable gridHeight = 3.0 upDownLabel = "HIGHER", "LOWER" - + table = vvtTbl, vvtMap, "VVT control Table", 8 xBins = rpmBinsVVT, rpm yBins = tpsBinsVVT, throttle zBins = vvtTable gridHeight = 3.0 upDownLabel = "HIGHER", "LOWER" - + ;--------- Sequential fuel trim maps ----------- table = fuelTrimTable1Tbl, fuelTrimTable1Map, "Fuel trim Table 1", 9 topicHelp = "http://speeduino.com/wiki/index.php/Tuning" @@ -1604,7 +1604,7 @@ cmdtestspk450dc = "E\x03\x0C" gridHeight = 2.0 gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees. upDownLabel = "(RICHER)", "(LEANER)" - + table = fuelTrimTable2Tbl, fuelTrimTable2Map, "Fuel trim Table 2", 9 topicHelp = "http://speeduino.com/wiki/index.php/Tuning" xBins = fuelTrim2rpmBins, rpm @@ -1618,7 +1618,7 @@ cmdtestspk450dc = "E\x03\x0C" gridHeight = 2.0 gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees. upDownLabel = "(RICHER)", "(LEANER)" - + table = fuelTrimTable3Tbl, fuelTrimTable3Map, "Fuel trim Table 3", 9 topicHelp = "http://speeduino.com/wiki/index.php/Tuning" xBins = fuelTrim3rpmBins, rpm @@ -1632,7 +1632,7 @@ cmdtestspk450dc = "E\x03\x0C" gridHeight = 2.0 gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees. upDownLabel = "(RICHER)", "(LEANER)" - + table = fuelTrimTable4Tbl, fuelTrimTable4Map, "Fuel trim Table 4", 9 topicHelp = "http://speeduino.com/wiki/index.php/Tuning" xBins = fuelTrim4rpmBins, rpm @@ -1646,8 +1646,8 @@ cmdtestspk450dc = "E\x03\x0C" gridHeight = 2.0 gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees. upDownLabel = "(RICHER)", "(LEANER)" - - + + ;------------------------------------------------------------------------------- [GaugeConfigurations] @@ -1704,11 +1704,11 @@ cmdtestspk450dc = "E\x03\x0C" warmupEnrichGauge = warmupEnrich, "Warmup Enrichment", "%", 100, 200, 130, 140, 140, 150, 0, 0 gaugeCategory = "Sensor inputs" - mapGauge = map, "Engine MAP", "kPa", 0, 255, 0, 20, 200, 245, 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 = map, "Engine MAP", "kPa", 0, 255, 0, 20, 200, 245, 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 - + #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 @@ -1721,9 +1721,9 @@ cmdtestspk450dc = "E\x03\x0C" gaugeCategory = "Other" clockGauge = secl, "Clock", "Seconds", 0, 255, 10, 10, 245, 245, 0, 0 - deadGauge = deadValue, "---", "", 0, 1, -1, -1, 2, 2, 0, 0 - loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 70000, -1, 500,1800, 4000, 0, 0 - memoryGauge = freeRAM, "Free memory", "bytes" , 0, 8000, -1, 1000,8000, 1000, 0, 0 + deadGauge = deadValue, "---", "", 0, 1, -1, -1, 2, 2, 0, 0 + loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 70000, -1, 500,1800, 4000, 0, 0 + memoryGauge = freeRAM, "Free memory", "bytes" , 0, 8000, -1, 1000,8000, 1000, 0, 0 ;------------------------------------------------------------------------------- [FrontPage] @@ -1746,7 +1746,7 @@ cmdtestspk450dc = "E\x03\x0C" gauge6 = iatGauge gauge7 = cltGauge gauge8 = gammaEnrichGauge - + ;---------------------------------------------------------------------------- ; Indicators ; expr off-label on-label, off-bg, off-fg, on-bg, on-fg @@ -1769,7 +1769,7 @@ cmdtestspk450dc = "E\x03\x0C" indicator = { hardLimitOn }, "Hard Limit OFF","Hard Limiter", white, black, red, black indicator = { boostCutOut }, "Boost Cut OFF", "Boost Cut", white, black, red, black indicator = { sync }, "No Sync", "Sync", white, black, green, black - + ;------------------------------------------------------------------------------- @@ -1912,7 +1912,7 @@ cmdtestspk450dc = "E\x03\x0C" boostTarget = scalar, U08, 37, "kPa", 2.000, 0.000 boostDuty = scalar, U08, 38, "%", 1.000, 0.000 idleLoad = scalar, U08, 39, { bitStringValue( idleUnits , iacAlgorithm ) }, 2.000, 0.000 ; This is a combined variable covering both PWM and stepper IACs. The units used depend on which idle algorithm is chosen - testoutputs = scalar, U08, 40, "bits", 1.000, 0.000 + testoutputs = scalar, U08, 40, "bits", 1.000, 0.000 testenabled = bits, U08, 40, [0:0] testactive = bits, U08, 40, [1:1] @@ -1936,17 +1936,17 @@ cmdtestspk450dc = "E\x03\x0C" cycleTime = { 60000.0 / rpm } ;nSquirts = { nCylinders/divider } dutyCycle = { 100.0*pulseWidth/cycleTime } - + boostCutOut = { boostCutFuel || boostCutSpark } - lambda = { afr / stoich } + lambda = { afr / stoich } MAPxRPM = { rpm * map } - + ;Manifold pressure in weirdo units map_bar = { (map - baro) / 101.33 } map_psi = { (map - baro) * 0.145038 } map_inhg = { (baro - map) * 0.2953007 } ;in-Hg map_vacboost = { map < baro ? -map_inhg : map_psi } - + #if EXPANDED_CLT_TEMP clt_exp = { 1 } #else @@ -2029,12 +2029,12 @@ cmdtestspk450dc = "E\x03\x0C" entry = boostDuty, "Boost Duty", int, "%d", { boostEnabled } entry = boostCutOut , "Boost cut", int, "%d" entry = idleLoad, "IAC value", int, "%d" - + ; Indicators - + [LoggerDefinition] ; valid logger types: composite, tooth, trigger, csv - + ;loggerDef = uniqueName, Display Name, type loggerDef = tooth, "Tooth Logger", tooth ;dataReadCommand = "r\\x00\\xf4\\x00\\x00\\x04\\x00" ; standard TS command format @@ -2042,13 +2042,13 @@ cmdtestspk450dc = "E\x03\x0C" dataReadTimeout = 15000 ; time in ms dataReadyCondition = { toothLog1Ready } dataLength = 256 ; in bytes, including headers, footers and data (not used) - + ;recordDef = headerLen. footerLen, recordLen recordDef = 0, 0, 2; in bytes, the recordLen is for each record, currently limited to 4 bytes - + ;recordField = Name, HeaderName, startBit, bitCount, scale, units, updateCondition recordField = toothGap, "ToothTime", 0, 16, 1.0, "uS" - + [Tools] ;addTool = toolName, PanelName @@ -2067,7 +2067,7 @@ cmdtestspk450dc = "E\x03\x0C" filter = std_yAxisMax ; Auto build with appropriate axis channels filter = std_DeadLambda ; Auto build -#if CELSIUS +#if CELSIUS filter = minCltFilter, "Minimum CLT", coolant, < , 71, , true #else filter = minCltFilter, "Minimum CLT", coolant, < , 160, , true diff --git a/speeduino/decoders.ino b/speeduino/decoders.ino index 0d8ba87b..3681d753 100644 --- a/speeduino/decoders.ino +++ b/speeduino/decoders.ino @@ -88,14 +88,14 @@ Note: This does not currently support dual wheel (ie missing tooth + single toot */ void triggerSetup_missingTooth() { - triggerToothAngle = 360 / configPage2.triggerTeeth; //The number of degrees that passes from tooth to tooth - if(configPage2.TrigSpeed) { triggerToothAngle = 720 / configPage2.triggerTeeth; } //Account for cam speed missing tooth + triggerToothAngle = 3600 / configPage2.triggerTeeth; //The number of degrees that passes from tooth to tooth + if(configPage2.TrigSpeed) { triggerToothAngle = 7200 / configPage2.triggerTeeth; } //Account for cam speed missing tooth triggerActualTeeth = configPage2.triggerTeeth - configPage2.triggerMissingTeeth; //The number of physical teeth on the wheel. Doing this here saves us a calculation each time in the interrupt triggerFilterTime = (int)(1000000 / (MAX_RPM / 60 * configPage2.triggerTeeth)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be disgarded as noise secondDerivEnabled = false; decoderIsSequential = false; checkSyncToothCount = (configPage2.triggerTeeth) >> 1; //50% of the total teeth. - MAX_STALL_TIME = (3333UL * triggerToothAngle * (configPage2.triggerMissingTeeth + 1)); //Minimum 50rpm. (3333uS is the time per degree at 50rpm) + MAX_STALL_TIME = (3333UL * (triggerToothAngle / 10) * (configPage2.triggerMissingTeeth + 1)); //Minimum 50rpm. (3333uS is the time per degree at 50rpm) } void triggerPri_missingTooth() @@ -164,7 +164,7 @@ int getCrankAngle_missingTooth(int timePerDegree) tempRevolutionOne = revolutionOne; interrupts(); - int crankAngle = (tempToothCurrentCount - 1) * triggerToothAngle + configPage2.triggerAngle; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth. + int crankAngle = (tempToothCurrentCount - 1) * triggerToothAngle + (configPage2.triggerAngle * 10); //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth. //Estimate the number of degrees travelled since the last tooth} long elapsedTime = (micros() - tempToothLastToothTime); //crankAngle += DIV_ROUND_CLOSEST(elapsedTime, timePerDegree); @@ -172,9 +172,9 @@ int getCrankAngle_missingTooth(int timePerDegree) else { crankAngle += ldiv(elapsedTime, timePerDegree).quot; } //Sequential check (simply sets whether we're on the first or 2nd revoltuion of the cycle) - if (tempRevolutionOne) { crankAngle += 360; } + if (tempRevolutionOne) { crankAngle += 3600; } - if (crankAngle >= 720) { crankAngle -= 720; } + if (crankAngle >= 7200) { crankAngle -= 7200; } else if (crankAngle > CRANK_ANGLE_MAX) { crankAngle -= CRANK_ANGLE_MAX; } if (crankAngle < 0) { crankAngle += CRANK_ANGLE_MAX; } @@ -1545,7 +1545,7 @@ void triggerSetup_Subaru67() secondDerivEnabled = false; decoderIsSequential = true; toothCurrentCount = 1; - triggerToothAngle = 2; + //triggerToothAngle = 2; MAX_STALL_TIME = (3333UL * 93); //Minimum 50rpm. (3333uS is the time per degree at 50rpm) toothAngles[0] = 710; //tooth #1 diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index 33a50801..884183b0 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -78,8 +78,8 @@ unsigned long counter; unsigned long currentLoopTime; //The time the current loop started (uS) unsigned long previousLoopTime; //The time the previous loop started (uS) -int CRANK_ANGLE_MAX = 720; -int CRANK_ANGLE_MAX_IGN = 360, CRANK_ANGLE_MAX_INJ = 360; // The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential +int CRANK_ANGLE_MAX = 7200; +int CRANK_ANGLE_MAX_IGN = 3600, CRANK_ANGLE_MAX_INJ = 3600; // The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential //bool useSequentialFuel; // Whether sequential fueling is to be used (1 squirt per cycle) //bool useSequentialIgnition; // Whether sequential ignition is used (1 spark per cycle) @@ -126,7 +126,8 @@ void (*ign4EndFunction)(); void (*ign5StartFunction)(); void (*ign5EndFunction)(); -int timePerDegree; +unsigned int timePerDegree; +unsigned int timePer10Degree; byte degreesPerLoop; //The number of crank degrees that pass for each mainloop of the program volatile bool fpPrimed = false; //Tracks whether or not the fuel pump priming has been completed yet @@ -514,9 +515,9 @@ void setup() if (configPage1.engineType == EVEN_FIRE ) { - channel2IgnDegrees = 180; + channel2IgnDegrees = 1800; } - else { channel2IgnDegrees = configPage1.oddfire2; } + else { channel2IgnDegrees = configPage1.oddfire2 * 10; } //For alternating injection, the squirt occurs at different times for each channel if(configPage1.injLayout == INJ_SEMISEQUENTIAL) @@ -534,13 +535,13 @@ void setup() if (configPage1.engineType == EVEN_FIRE ) { - channel2IgnDegrees = 120; - channel3IgnDegrees = 240; + channel2IgnDegrees = 1200; + channel3IgnDegrees = 2400; } else { - channel2IgnDegrees = configPage1.oddfire2; - channel3IgnDegrees = configPage1.oddfire3; + channel2IgnDegrees = configPage1.oddfire2 * 10; + channel3IgnDegrees = configPage1.oddfire3 * 10; } //For alternatiing injection, the squirt occurs at different times for each channel @@ -553,9 +554,9 @@ void setup() else if (configPage1.injLayout == INJ_SEQUENTIAL) { channel1InjDegrees = 0; - channel2InjDegrees = 240; - channel3InjDegrees = 480; - CRANK_ANGLE_MAX_INJ = 720; + channel2InjDegrees = 2400; + channel3InjDegrees = 4800; + CRANK_ANGLE_MAX_INJ = 7200; req_fuel_uS = req_fuel_uS * 2; } if (!configPage1.injTiming) { channel1InjDegrees = channel2InjDegrees = channel3InjDegrees = 0; } //For simultaneous, all squirts happen at the same time @@ -569,40 +570,40 @@ void setup() if (configPage1.engineType == EVEN_FIRE ) { - channel2IgnDegrees = 180; + channel2IgnDegrees = 1800; if(configPage2.sparkMode == IGN_MODE_SEQUENTIAL) { - channel3IgnDegrees = 360; - channel4IgnDegrees = 540; + channel3IgnDegrees = 3600; + channel4IgnDegrees = 5400; - CRANK_ANGLE_MAX_IGN = 720; + CRANK_ANGLE_MAX_IGN = 7200; } } else { - channel2IgnDegrees = configPage1.oddfire2; - channel3IgnDegrees = configPage1.oddfire3; - channel4IgnDegrees = configPage1.oddfire4; + channel2IgnDegrees = configPage1.oddfire2 * 10; + channel3IgnDegrees = configPage1.oddfire3 * 10; + channel4IgnDegrees = configPage1.oddfire4 * 10; } //For alternatiing injection, the squirt occurs at different times for each channel if(configPage1.injLayout == INJ_SEMISEQUENTIAL || configPage1.injLayout == INJ_PAIRED) { channel1InjDegrees = 0; - channel2InjDegrees = 180; + channel2InjDegrees = 1800; } else if (configPage1.injLayout == INJ_SEQUENTIAL) { channel1InjDegrees = 0; - channel2InjDegrees = 180; - channel3InjDegrees = 360; - channel4InjDegrees = 540; + channel2InjDegrees = 1800; + channel3InjDegrees = 3600; + channel4InjDegrees = 5400; channel3InjEnabled = true; channel4InjEnabled = true; - CRANK_ANGLE_MAX_INJ = 720; + CRANK_ANGLE_MAX_INJ = 7200; req_fuel_uS = req_fuel_uS * 2; } if (!configPage1.injTiming) { channel1InjDegrees = channel2InjDegrees = 0; } //For simultaneous, all squirts happen at the same time @@ -612,39 +613,39 @@ void setup() break; case 5: channel1IgnDegrees = 0; - channel2IgnDegrees = 72; - channel3IgnDegrees = 144; - channel4IgnDegrees = 216; - channel5IgnDegrees = 288; + channel2IgnDegrees = 720; + channel3IgnDegrees = 1440; + channel4IgnDegrees = 2160; + channel5IgnDegrees = 2880; if(configPage2.sparkMode == IGN_MODE_SEQUENTIAL) { - channel2IgnDegrees = 144; - channel3IgnDegrees = 288; - channel4IgnDegrees = 432; - channel5IgnDegrees = 576; + channel2IgnDegrees = 1440; + channel3IgnDegrees = 2880; + channel4IgnDegrees = 4320; + channel5IgnDegrees = 5760; - CRANK_ANGLE_MAX_IGN = 720; + CRANK_ANGLE_MAX_IGN = 7200; } //For alternatiing injection, the squirt occurs at different times for each channel if(configPage1.injLayout == INJ_SEMISEQUENTIAL || configPage1.injLayout == INJ_PAIRED) { channel1InjDegrees = 0; - channel2InjDegrees = 72; - channel3InjDegrees = 144; - channel4InjDegrees = 216; - channel5InjDegrees = 288; + channel2InjDegrees = 720; + channel3InjDegrees = 1440; + channel4InjDegrees = 2160; + channel5InjDegrees = 2880; } else if (configPage1.injLayout == INJ_SEQUENTIAL) { channel1InjDegrees = 0; - channel2InjDegrees = 144; - channel3InjDegrees = 288; - channel4InjDegrees = 432; - channel5InjDegrees = 576; + channel2InjDegrees = 1440; + channel3InjDegrees = 2880; + channel4InjDegrees = 4320; + channel5InjDegrees = 5760; - CRANK_ANGLE_MAX_INJ = 720; + CRANK_ANGLE_MAX_INJ = 7200; } if (!configPage1.injTiming) { channel1InjDegrees = channel2InjDegrees = channel3InjDegrees = channel4InjDegrees = channel5InjDegrees = 0; } //For simultaneous, all squirts happen at the same time @@ -656,8 +657,8 @@ void setup() break; case 6: channel1IgnDegrees = 0; - channel2IgnDegrees = 120; - channel3IgnDegrees = 240; + channel2IgnDegrees = 1200; + channel3IgnDegrees = 2400; //For alternatiing injection, the squirt occurs at different times for each channel /* @@ -678,9 +679,9 @@ void setup() break; case 8: channel1IgnDegrees = 0; - channel2IgnDegrees = 90; - channel3IgnDegrees = 180; - channel4IgnDegrees = 270; + channel2IgnDegrees = 900; + channel3IgnDegrees = 1800; + channel4IgnDegrees = 2700; //For alternatiing injection, the squirt occurs at different times for each channel /* @@ -703,7 +704,7 @@ void setup() break; default: //Handle this better!!! channel1InjDegrees = 0; - channel2InjDegrees = 180; + channel2InjDegrees = 1800; break; } @@ -979,7 +980,7 @@ void loop() currentStatus.advance = get3DTableValue(&ignitionTable, currentStatus.TPS, currentStatus.RPM); //As above, but for ignition advance } - currentStatus.advance = correctionsIgn(currentStatus.advance); + currentStatus.advance = correctionsIgn(currentStatus.advance) * 10; /* //Check for fixed ignition angles if (configPage2.FixAng != 0) { currentStatus.advance = configPage2.FixAng; } //Check whether the user has set a fixed timing angle @@ -1041,21 +1042,23 @@ void loop() } - timePerDegree = ldiv( 166666L, (currentStatus.RPM + rpmDelta)).quot; //There is a small amount of rounding in this calculation, however it is less than 0.001 of a uS (Faster as ldiv than / ) + timePer10Degree = ldiv( 1666666L, (currentStatus.RPM + rpmDelta)).quot; //There is a small amount of rounding in this calculation, however it is less than 0.001 of a uS (Faster as ldiv than / ) + timePerDegree = timePer10Degree / 10; } else { long rpm_adjust = ((long)(micros() - toothOneTime) * (long)currentStatus.rpmDOT) / 1000000; //Take into account any likely accleration that has occurred since the last full revolution completed //timePerDegree = DIV_ROUND_CLOSEST(166666L, (currentStatus.RPM + rpm_adjust)); - timePerDegree = ldiv( 166666L, currentStatus.RPM + rpm_adjust).quot; //There is a small amount of rounding in this calculation, however it is less than 0.001 of a uS (Faster as ldiv than / ) + timePer10Degree = ldiv( 1666666L, currentStatus.RPM + rpm_adjust).quot; //There is a small amount of rounding in this calculation, however it is less than 0.001 of a uS (Faster as ldiv than / ) + timePerDegree = timePer10Degree / 10; } //Check that the duty cycle of the chosen pulsewidth isn't too high. This is disabled at cranking if( !BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) ) { unsigned long pwLimit = percentage(configPage1.dutyLim, revolutionTime); //The pulsewidth limit is determined to be the duty cycle limit (Eg 85%) by the total time it takes to perform 1 revolution - if (CRANK_ANGLE_MAX_INJ == 720) { pwLimit = pwLimit * 2; } //For sequential, the maximum pulse time is double (2 revolutions). Wouldn't work for 2 stroke... + if (CRANK_ANGLE_MAX_INJ == 7200) { pwLimit = pwLimit * 2; } //For sequential, the maximum pulse time is double (2 revolutions). Wouldn't work for 2 stroke... if (currentStatus.PW1 > pwLimit) { currentStatus.PW1 = pwLimit; } } @@ -1155,7 +1158,7 @@ void loop() //Pull battery voltage based dwell correction and apply if needed currentStatus.dwellCorrection = table2D_getValue(&dwellVCorrectionTable, currentStatus.battery10); if (currentStatus.dwellCorrection != 100) { currentStatus.dwell = divs100(currentStatus.dwell) * currentStatus.dwellCorrection; } - int dwellAngle = (div(currentStatus.dwell, timePerDegree).quot ); //Convert the dwell time to dwell angle based on the current engine speed + unsigned int dwellAngle = (div((currentStatus.dwell*10), timePer10Degree).quot ); //Convert the dwell time to dwell angle based on the current engine speed //Calculate start angle for each channel //1 cylinder (Everyone gets this) @@ -1174,7 +1177,7 @@ void loop() case 3: ignition2StartAngle = channel2IgnDegrees + CRANK_ANGLE_MAX_IGN - currentStatus.advance - dwellAngle; if(ignition2StartAngle > CRANK_ANGLE_MAX_IGN) {ignition2StartAngle -= CRANK_ANGLE_MAX_IGN;} - ignition3StartAngle = channel3IgnDegrees + 360 - currentStatus.advance - dwellAngle; + ignition3StartAngle = channel3IgnDegrees + 3600 - currentStatus.advance - dwellAngle; if(ignition3StartAngle > CRANK_ANGLE_MAX_IGN) {ignition3StartAngle -= CRANK_ANGLE_MAX_IGN;} break; //4 cylinders @@ -1237,7 +1240,7 @@ void loop() //Determine the current crank angle int crankAngle = getCrankAngle(timePerDegree); - if (crankAngle > CRANK_ANGLE_MAX_INJ ) { crankAngle -= 360; } + if (crankAngle > CRANK_ANGLE_MAX_INJ ) { crankAngle -= 3600; } if (fuelOn && currentStatus.PW1 > 0 && !BIT_CHECK(currentStatus.squirt, BIT_SQUIRT_BOOSTCUT)) { @@ -1369,7 +1372,7 @@ void loop() //Refresh the current crank angle info //ignition1StartAngle = 335; crankAngle = getCrankAngle(timePerDegree); //Refresh with the latest crank angle - if (crankAngle > CRANK_ANGLE_MAX_IGN ) { crankAngle -= 360; } + if (crankAngle > CRANK_ANGLE_MAX_IGN ) { crankAngle -= 3600; } //if (ignition1StartAngle <= crankAngle && ignition1.schedulesSet == 0) { ignition1StartAngle += CRANK_ANGLE_MAX_IGN; } if (ignition1StartAngle > crankAngle) @@ -1382,7 +1385,7 @@ void loop() unsigned long timeout = (unsigned long)(ignition1StartAngle - crankAngle) * 282UL; */ setIgnitionSchedule1(ign1StartFunction, - ((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePerDegree), //(timeout/10), + ((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePer10Degree)/100, //(timeout/10), currentStatus.dwell + fixedCrankingOverride, //((unsigned long)((unsigned long)currentStatus.dwell* currentStatus.RPM) / newRPM) + fixedCrankingOverride, ign1EndFunction );