Merge pull request #2 from noisymime/master
17/10/2015 from master speed
This commit is contained in:
commit
74681090f8
29
comms.h
29
comms.h
|
@ -1,22 +1,33 @@
|
|||
#ifndef COMMS_H
|
||||
#define COMMS_H
|
||||
|
||||
//These are the page numbers that the Tuner Studio serial protocol uses to transverse the different map and config pages.
|
||||
#define veMapPage 1
|
||||
#define veSetPage 2
|
||||
#define veSetPage 2//Config Page 1
|
||||
#define ignMapPage 3
|
||||
#define ignSetPage 4
|
||||
#define ignSetPage 4//Config Page 2
|
||||
#define afrMapPage 5
|
||||
#define afrSetPage 6
|
||||
#define iacPage 7
|
||||
#define afrSetPage 6//Config Page 3
|
||||
#define iacPage 7//Config Page 4
|
||||
#define boostvvtPage 8
|
||||
|
||||
byte currentPage;
|
||||
|
||||
void command();
|
||||
byte currentPage = 1;//Not the same as the speeduino config page numbers
|
||||
boolean isMap = true;
|
||||
const char pageTitles[] PROGMEM //This is being stored in the avr flash instead of SRAM which there is not very much of
|
||||
{
|
||||
"\nVolumetric Efficiancy Map\0"//This is an alternative to using a 2D array which would waste space because of the different lengths of the strings
|
||||
"\nPage 1 Config\0"//The configuration page titles' indexes are found by counting the chars
|
||||
"\nIgnition Map\0"//The map page titles' indexes are put into a var called currentTitleIndex. That represents the first char of each string.
|
||||
"\nPage 2 Config\0"
|
||||
"\nAir/Fuel Ratio Map\0"
|
||||
"\nPage 3 Config\0"
|
||||
"\nPage 4 Config"//No need to put a trailing null because it's the last string and the compliler does it for you.
|
||||
};
|
||||
|
||||
void command();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable.
|
||||
void sendValues();
|
||||
void receiveValue(int offset, byte newValue);
|
||||
void saveConfig();
|
||||
void sendPage();
|
||||
void sendPage(bool useChar);
|
||||
void receiveCalibration(byte tableID);
|
||||
void sendToothLog(bool useChar);
|
||||
void testComm();
|
||||
|
|
|
@ -352,6 +352,7 @@ void triggerSetup_4G63()
|
|||
toothAngles[1] = 105; //Rising edge of tooth #2
|
||||
toothAngles[2] = 175; //Falling edge of tooth #2
|
||||
toothAngles[3] = 285; //Rising edge of tooth #1
|
||||
|
||||
/*
|
||||
toothAngles[0] = 105; //Falling edge of tooth #1
|
||||
toothAngles[1] = 175; //Rising edge of tooth #2
|
||||
|
@ -431,6 +432,7 @@ int getCrankAngle_4G63(int timePerDegree)
|
|||
int crankAngle = toothAngles[(tempToothCurrentCount - 1)] + configPage2.triggerAngle; //Perform a lookup of the fixed toothAngles array to find what the angle of the last tooth passed was.
|
||||
crankAngle += ldiv( (micros() - tempToothLastToothTime), timePerDegree).quot; //Estimate the number of degrees travelled since the last tooth
|
||||
if (crankAngle > 360) { crankAngle -= 360; }
|
||||
if (crankAngle < 0) { crankAngle += 360; }
|
||||
|
||||
return crankAngle;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ struct config1 {
|
|||
unsigned int inj4Ang;
|
||||
|
||||
//config1 in ini
|
||||
byte mapType : 2;
|
||||
byte mapSample : 2;
|
||||
byte strokes : 1;
|
||||
byte injType : 1;
|
||||
byte nCylinders : 4; //Number of cylinders
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.7 MiB |
Binary file not shown.
|
@ -128,7 +128,7 @@ page = 2
|
|||
inj4Ang = scalar, U16, 34, "deg", 1.0, 0.0, 0.0, 360, 0
|
||||
|
||||
; Config1
|
||||
mapType = bits, U08, 36, [0:1], "115 kPa", "250 kPa", "INVALID", "INVALID"
|
||||
mapSample = bits, U08, 36, [0:1], "Instantaneous", "Cycle Average", "Cycle Minimum", "INVALID"
|
||||
twoStroke = bits, U08, 36, [2:2], "Four-stroke", "Two-stroke"
|
||||
injType = bits, U08, 36, [3:3], "Port", "Throttle Body"
|
||||
nCylinders = bits, U08, 36, [4:8], "INVALID","1","2","3","4","INVALID","6","INVALID","8","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID","INVALID"
|
||||
|
@ -215,46 +215,46 @@ page = 4
|
|||
; name = scalar, type, offset, units, scale, translate, lo, hi, digits
|
||||
;Dwell control
|
||||
;running dwell variable railed to 8 - who needs more than 8ms?
|
||||
dwellcont = bits, U08, 12, [0:0], "INVALID", "Dwell control"
|
||||
dwellcont = bits, U08, 12, [0:0], "INVALID", "Dwell control"
|
||||
useDwellLim= bits, U08, 12, [1:1], "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
|
||||
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
|
||||
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
|
||||
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.00000, 0.00, 2550.0, 0
|
||||
taeRates = array, U08, 27, [ 4], "%", 1.0, 0.00000, 0.00, 255.0, 0 ; 4 bytes
|
||||
wueRates = array, U08, 31, [10], "C", 1.0, 0.0, 100.0, 255.0, 0
|
||||
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
|
||||
wueRates = array, U08, 31, [10], "C", 1.0, 0.0, 100.0, 255.0, 0
|
||||
;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
|
||||
dwellLim = scalar, U08, 41, "ms", 1, 0, 0, 32, 0
|
||||
dwellRates = array, U08, 42, [6], "%", 1.0, 0.0, 0.00, 255.0, 0
|
||||
|
||||
unused48 = scalar, U08, 48, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused49 = scalar, U08, 49, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused50 = scalar, U08, 50, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused51 = scalar, U08, 51, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused52 = scalar, U08, 52, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused53 = scalar, U08, 53, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused54 = scalar, U08, 54, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused55 = scalar, U08, 55, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused56 = scalar, U08, 56, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused57 = scalar, U08, 57, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused58 = scalar, U08, 58, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused59 = scalar, U08, 59, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused60 = scalar, U08, 60, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused61 = scalar, U08, 61, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused62 = scalar, U08, 62, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused63 = scalar, U08, 63, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused48 = scalar, U08, 48, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused49 = scalar, U08, 49, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused50 = scalar, U08, 50, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused51 = scalar, U08, 51, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused52 = scalar, U08, 52, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused53 = scalar, U08, 53, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused54 = scalar, U08, 54, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused55 = scalar, U08, 55, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused56 = scalar, U08, 56, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused57 = scalar, U08, 57, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused58 = scalar, U08, 58, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused59 = scalar, U08, 59, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused60 = scalar, U08, 60, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused61 = scalar, U08, 61, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused62 = scalar, U08, 62, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused63 = scalar, U08, 63, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
|
||||
|
||||
;--------------------------------------------------
|
||||
|
@ -303,14 +303,22 @@ page = 6
|
|||
injBatRates = array, U08, 21, [6], "%", 1, 0, 0, 255, 0 ;Values for injector pulsewidth vs voltage
|
||||
airDenBins = array, U08, 27, [9], "C", 1.0, -40, -40, 215, 0 ; Bins for the air density correction curve
|
||||
airDenRates = array, U08, 36, [9], "%", 1.0, 0.0, 0, 255, 0 ; Values for the air density correction curve
|
||||
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
|
||||
unused48 = scalar, U08, 48, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused49 = scalar, U08, 49, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused50 = scalar, U08, 50, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused51 = scalar, U08, 51, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused52 = scalar, U08, 52, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
|
||||
; 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", "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"
|
||||
launchEnable= bits, U08, 48, [6:6], "No", "Yes"
|
||||
unused48h = bits, U08, 48, [7:7], "No", "Yes"
|
||||
|
||||
lnchSoftLim = scalar, U08, 49, "rpm", 100, 0.0, 100, 25500, 0
|
||||
lnchRetard = scalar, U08, 50, "deg", 1.0, 0.0, 0.0, 80, 0
|
||||
lnchHardLim = scalar, U08, 51, "rpm", 100, 0.0, 100, 25500, 0
|
||||
lnchFuelAdd = scalar, U08, 52, "%", 1.0, 0.0, 0.0, 80, 0
|
||||
|
||||
unused53 = scalar, U08, 53, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused54 = scalar, U08, 54, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused55 = scalar, U08, 55, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
|
@ -364,6 +372,11 @@ page = 7
|
|||
fanSP = scalar, U08, 57, "°F", 1.0, -40, -40, 215.0, 0
|
||||
fanHyster = scalar, U08, 58, "°F", 1.0, -40, -40, 215.0, 0
|
||||
#endif
|
||||
unused59 = scalar, U08, 59, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused60 = scalar, U08, 60, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused61 = scalar, U08, 61, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused62 = scalar, U08, 62, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused63 = scalar, U08, 63, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
|
||||
;--------------------------------------------------
|
||||
;Boost and vvt maps (Page 8)
|
||||
|
@ -471,6 +484,7 @@ page = 8
|
|||
|
||||
menu = "&Accessories"
|
||||
subMenu = fanSettings, "Thermo Fan"
|
||||
subMenu = LaunchControl, "Launch Control"
|
||||
subMenu = std_separator
|
||||
subMenu = boostSettings, "Boost Control"
|
||||
subMenu = boostTbl, "Boost duty cycle", 8, { boostEnabled }
|
||||
|
@ -525,6 +539,7 @@ page = 8
|
|||
dialog = engine_constants_south
|
||||
field = "Injector Timing", injTiming, { nCylinders <= 4 }
|
||||
field = "Board Layout", pinLayout
|
||||
field = "MAP Sample method", mapSample
|
||||
|
||||
dialog = engine_constants, ""
|
||||
panel = std_injection, North
|
||||
|
@ -597,92 +612,93 @@ page = 8
|
|||
panel = stepper_idle
|
||||
|
||||
|
||||
dialog = crankPW, "Cranking Pulsewidths (ms)"
|
||||
#if CELSIUS
|
||||
field = "Cranking RPM (Max)", crankRPM
|
||||
field = "Flood Clear level", tpsflood
|
||||
field = ""
|
||||
field = "Priming Pulsewidth", primePulse
|
||||
field = "Pulsewidth at -40°C", crankCold
|
||||
field = "Pulsewidth at 77°C", crankHot
|
||||
field = ""
|
||||
field = "Cranking Enrichment %", crankingPct
|
||||
#else
|
||||
field = "Cranking RPM (Max)", crankRPM
|
||||
field = "Flood Clear level", tpsflood
|
||||
field = ""
|
||||
field = "Priming Pulsewidth", primePulse
|
||||
field = "Pulsewidth at -40°F", crankCold
|
||||
field = "Pulsewidth at 170°F", crankHot
|
||||
field = ""
|
||||
field = "Cranking Enrichment %", crankingPct
|
||||
#endif
|
||||
dialog = crankPW, "Cranking Pulsewidths (ms)"
|
||||
#if CELSIUS
|
||||
field = "Cranking RPM (Max)", crankRPM
|
||||
field = "Flood Clear level", tpsflood
|
||||
field = ""
|
||||
field = "Priming Pulsewidth", primePulse
|
||||
field = "Pulsewidth at -40°C", crankCold
|
||||
field = "Pulsewidth at 77°C", crankHot
|
||||
field = ""
|
||||
field = "Cranking Enrichment %", crankingPct
|
||||
#else
|
||||
field = "Cranking RPM (Max)", crankRPM
|
||||
field = "Flood Clear level", tpsflood
|
||||
field = ""
|
||||
field = "Priming Pulsewidth", primePulse
|
||||
field = "Pulsewidth at -40°F", crankCold
|
||||
field = "Pulsewidth at 170°F", crankHot
|
||||
field = ""
|
||||
field = "Cranking Enrichment %", crankingPct
|
||||
#endif
|
||||
|
||||
dialog = aseSettings, "Afterstart Enrichment"
|
||||
field = "Enrichment %", asePct
|
||||
field = "Number of Sec to run", aseCount
|
||||
dialog = aseSettings, "Afterstart Enrichment"
|
||||
field = "Enrichment %", asePct
|
||||
field = "Number of Sec to run", aseCount
|
||||
|
||||
|
||||
;dialog = egoSettings, "Exhaust Gas Oxygen"
|
||||
;field = "EGO Sensor Type", egoType
|
||||
;field = "EGO Switch Point (v)", egoSwitch
|
||||
;field = "Coolant Temp Activation", egoTemp
|
||||
;field = "Ignition Events Per Step", egoCount
|
||||
;field = "EGO Step", egoDelta
|
||||
;field = "EGO ± Limit", egoLimit
|
||||
;field = "EGO Active Above", egoRPM
|
||||
|
||||
dialog = triggerSettings,"Trigger Settings",4
|
||||
topicHelp = Shelp3
|
||||
field = "Trigger Pattern", TrigPattern
|
||||
field = "Primary base teeth", numteeth, { TrigPattern == 0 || TrigPattern == 2 }
|
||||
field = "Primary trigger speed", TrigSpeed, { TrigPattern == 0 }
|
||||
field = "Missing teeth", onetwo, { TrigPattern == 0 }
|
||||
field = "Secondary teeth", onetwo, { TrigPattern == 2 }
|
||||
field = "Trigger Angle ", TrigAng
|
||||
field = "This number represents the angle ATDC when "
|
||||
field = "tooth #1 passes the primary sensor."
|
||||
field = ""
|
||||
field = "Skip Revolutions", StgCycles
|
||||
field = "Note: This is the number of revolutions that will be skipped during"
|
||||
field = "cranking before the injectors and coils are fired"
|
||||
field = "Trigger edge", TrigEdge
|
||||
dialog = triggerSettings,"Trigger Settings",4
|
||||
topicHelp = Shelp3
|
||||
field = "Trigger Pattern", TrigPattern
|
||||
field = "Primary base teeth", numteeth, { TrigPattern == 0 || TrigPattern == 2 }
|
||||
field = "Primary trigger speed", TrigSpeed, { TrigPattern == 0 }
|
||||
field = "Missing teeth", onetwo, { TrigPattern == 0 }
|
||||
field = "Secondary teeth", onetwo, { TrigPattern == 2 }
|
||||
field = "Trigger Angle ", TrigAng
|
||||
field = "This number represents the angle ATDC when "
|
||||
field = "tooth #1 passes the primary sensor."
|
||||
field = ""
|
||||
field = "Skip Revolutions", StgCycles
|
||||
field = "Note: This is the number of revolutions that will be skipped during"
|
||||
field = "cranking before the injectors and coils are fired"
|
||||
field = "Trigger edge", TrigEdge
|
||||
|
||||
dialog = sparkSettings,"Spark Settings",4
|
||||
topicHelp = Shelp3
|
||||
field = "Cranking advance Angle", CrankAng
|
||||
;field = "Hold Ignition", IgHold
|
||||
field = "Spark Outputs triggers", IgInv
|
||||
field = ""
|
||||
field = "Fixed Angle (0 = use map)", FixAng
|
||||
;field = "Trim Angle", Trim
|
||||
dialog = sparkSettings,"Spark Settings",4
|
||||
topicHelp = Shelp3
|
||||
field = "Cranking advance Angle", CrankAng
|
||||
;field = "Hold Ignition", IgHold
|
||||
field = "Spark Outputs triggers", IgInv
|
||||
field = ""
|
||||
field = "Fixed Angle (0 = use map)", FixAng
|
||||
;field = "Trim Angle", Trim
|
||||
|
||||
dialog = dwellSettings, "Dwell Settings", 4
|
||||
topicHelp = DwellHelp
|
||||
field = "Dwell control", dwellcont
|
||||
field = "Or:"
|
||||
field = " Cranking dwell", dwellcrank, { dwellcont }
|
||||
field = " Running dwell", dwellrun, { dwellcont }
|
||||
;field = "Minimum discharge period", mindischg, { dwellcont }
|
||||
field = ""
|
||||
field = "#Note"
|
||||
field = "The above times are for 12V. Voltage correction"
|
||||
field = "is applied. At higher voltages the time is reduced"
|
||||
field = "and when low it is increased"
|
||||
field = ""
|
||||
field = "Overdwell protection"
|
||||
field = "Use Overdwell protection", useDwellLim
|
||||
field = "Max dwell time", dwellLim, { useDwellLim }
|
||||
field = "Note: Set the maximum dwell time at least 3ms above"
|
||||
field = "your desired dwell time (Including cranking)"
|
||||
topicHelp = DwellHelp
|
||||
field = "Dwell control", dwellcont
|
||||
field = "Or:"
|
||||
field = " Cranking dwell", dwellcrank, { dwellcont }
|
||||
field = " Running dwell", dwellrun, { dwellcont }
|
||||
;field = "Minimum discharge period", mindischg, { dwellcont }
|
||||
field = ""
|
||||
field = "#Note"
|
||||
field = "The above times are for 12V. Voltage correction"
|
||||
field = "is applied. At higher voltages the time is reduced"
|
||||
field = "and when low it is increased"
|
||||
field = ""
|
||||
field = "Overdwell protection"
|
||||
field = "Use Overdwell protection", useDwellLim
|
||||
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"
|
||||
field = "Soft rev limit", SoftRevLim
|
||||
field = "Soft limit absolute timing", SoftLimRetard
|
||||
field = "Soft limit max time", SoftLimMax
|
||||
field = "Hard Rev limit", HardRevLim
|
||||
topicHelp = Fhelp7
|
||||
field = "Rev Limiter"
|
||||
field = "Soft rev limit", SoftRevLim
|
||||
field = "Soft limit absolute timing", SoftLimRetard
|
||||
field = "Soft limit max time", SoftLimMax
|
||||
field = "Hard Rev limit", HardRevLim
|
||||
|
||||
dialog = LaunchControl, "Launch Control", 6
|
||||
topicHelp = Fhelp7
|
||||
field = "Launch Control"
|
||||
field = "Enable Launch", launchEnable
|
||||
field = "Launch Input Pin", launchPin, { launchEnable }
|
||||
field = "Soft rev limit", lnchSoftLim, { launchEnable }
|
||||
field = "Soft limit absolute timing", lnchRetard, { launchEnable }
|
||||
field = "Hard rev limit", lnchHardLim, { launchEnable }
|
||||
field = "Fuel adder during launch", lnchFuelAdd, { launchEnable }
|
||||
|
||||
dialog = OLED, "OLED Display", 2
|
||||
field = "Display Type", display
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 459 KiB |
|
@ -83,8 +83,11 @@ byte o2CalibrationTable[CALIBRATION_TABLE_SIZE];
|
|||
unsigned long counter;
|
||||
unsigned long currentLoopTime; //The time the current loop started (uS)
|
||||
unsigned long previousLoopTime; //The time the previous loop started (uS)
|
||||
unsigned long scheduleStart;
|
||||
unsigned long scheduleEnd;
|
||||
|
||||
unsigned long MAPrunningValue; //Used for tracking either the total of all MAP readings in this cycle (Event average) or the lowest value detected in this cycle (event minimum)
|
||||
unsigned int MAPcount; //Number of samples taken in the current MAP cycle
|
||||
byte MAPcurRev = 0; //Tracks which revolution we're sampling on
|
||||
|
||||
|
||||
byte coilHIGH = HIGH;
|
||||
byte coilLOW = LOW;
|
||||
|
@ -493,9 +496,51 @@ void loop()
|
|||
//***SET STATUSES***
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
//currentStatus.MAP = map(analogRead(pinMAP), 0, 1023, 10, 255); //Get the current MAP value
|
||||
currentStatus.mapADC = analogRead(pinMAP);
|
||||
currentStatus.MAP = map(currentStatus.mapADC, 0, 1023, configPage1.mapMin, configPage1.mapMax); //Get the current MAP value
|
||||
//MAP Sampling system
|
||||
switch(configPage1.mapSample)
|
||||
{
|
||||
case 0:
|
||||
//Instantaneous MAP readings
|
||||
currentStatus.mapADC = analogRead(pinMAP);
|
||||
currentStatus.MAP = map(currentStatus.mapADC, 0, 1023, configPage1.mapMin, configPage1.mapMax); //Get the current MAP value
|
||||
break;
|
||||
|
||||
case 1:
|
||||
//Average of a cycle
|
||||
if( (MAPcurRev == startRevolutions) || (MAPcurRev == startRevolutions+1) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for.
|
||||
{
|
||||
MAPrunningValue = MAPrunningValue + analogRead(pinMAP); //Add the current reading onto the total
|
||||
MAPcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Reaching here means that the last cylce has completed and the MAP value should be calculated
|
||||
currentStatus.mapADC = ldiv(MAPrunningValue, MAPcount).quot;
|
||||
currentStatus.MAP = map(currentStatus.mapADC, 0, 1023, configPage1.mapMin, configPage1.mapMax); //Get the current MAP value
|
||||
MAPcurRev = startRevolutions; //Reset the current rev count
|
||||
MAPrunningValue = 0;
|
||||
MAPcount = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
//Minimum reading in a cycle
|
||||
if( (MAPcurRev == startRevolutions) || (MAPcurRev == startRevolutions+1) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for.
|
||||
{
|
||||
int tempValue = analogRead(pinMAP);
|
||||
if( tempValue < MAPrunningValue) { MAPrunningValue = tempValue; } //Check whether the current reading is lower than the running minimum
|
||||
MAPcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Reaching here means that the last cylce has completed and the MAP value should be calculated
|
||||
currentStatus.mapADC = MAPrunningValue;
|
||||
currentStatus.MAP = map(currentStatus.mapADC, 0, 1023, configPage1.mapMin, configPage1.mapMax); //Get the current MAP value
|
||||
MAPcurRev = startRevolutions; //Reset the current rev count
|
||||
MAPrunningValue = 1023; //Reset the latest value so the next reading will always be lower
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//TPS setting to be performed every 32 loops (any faster and it can upset the TPSdot sampling time)
|
||||
if ((mainLoopCount & 31) == 1)
|
||||
|
@ -820,7 +865,7 @@ void loop()
|
|||
if( tempCrankAngle < 0) { tempCrankAngle += 360; }
|
||||
tempStartAngle = ignition2StartAngle - channel2IgnDegrees;
|
||||
if ( tempStartAngle < 0) { tempStartAngle += 360; }
|
||||
if (tempStartAngle > tempCrankAngle)
|
||||
if ( (tempStartAngle > tempCrankAngle) && ign2LastRev != startRevolutions)
|
||||
{
|
||||
setIgnitionSchedule2(beginCoil2Charge,
|
||||
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||
|
@ -895,6 +940,5 @@ void openInjector1and4() { digitalWrite(pinInjector1, HIGH); digitalWrite(pinInj
|
|||
void closeInjector1and4() { digitalWrite(pinInjector1, LOW); digitalWrite(pinInjector4, LOW);BIT_CLEAR(currentStatus.squirt, 0); }
|
||||
void openInjector2and3() { digitalWrite(pinInjector2, HIGH); digitalWrite(pinInjector3, HIGH); BIT_SET(currentStatus.squirt, 1); }
|
||||
void closeInjector2and3() { digitalWrite(pinInjector2, LOW); digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, 1); }
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue