mirror of https://github.com/rusefi/speeduino.git
Major cleanup of ini. Working TPS calibration
This commit is contained in:
parent
1b8fe853b6
commit
19186cfc1b
18
comms.ino
18
comms.ino
|
@ -36,7 +36,7 @@ void command()
|
|||
break;
|
||||
|
||||
case 'S': // send code version
|
||||
Serial.write(ms_version);
|
||||
Serial.print(signature);
|
||||
break;
|
||||
|
||||
case 'Q': // send code version
|
||||
|
@ -44,7 +44,8 @@ void command()
|
|||
//digitalWrite(9, LOW);
|
||||
//digitalWrite(10, LOW);
|
||||
//digitalWrite(13, LOW);
|
||||
Serial.write(ms_version);
|
||||
Serial.print(signature);
|
||||
//Serial.write("Speeduino_0_2");
|
||||
break;
|
||||
|
||||
case 'V': // send VE table and constants
|
||||
|
@ -79,7 +80,7 @@ This function returns the current values of a fixed group of variables
|
|||
*/
|
||||
void sendValues(int length)
|
||||
{
|
||||
byte response[23];
|
||||
byte response[24];
|
||||
|
||||
response[0] = currentStatus.runSecs; //rtc.sec;
|
||||
response[1] = currentStatus.squirt; //Squirt Bitfield
|
||||
|
@ -88,7 +89,7 @@ void sendValues(int length)
|
|||
response[4] = currentStatus.MAP; //map
|
||||
response[5] = 0x00; //mat
|
||||
response[6] = 0x00; //Coolant
|
||||
response[7] = currentStatus.TPS; //TPS
|
||||
response[7] = currentStatus.tpsADC; //TPS (Raw 0-255)
|
||||
response[8] = 0x00; //battery voltage
|
||||
response[9] = 0x00; //O2
|
||||
response[10] = 0x00; //Exhaust gas correction (%)
|
||||
|
@ -100,12 +101,13 @@ void sendValues(int length)
|
|||
response[16] = 0x00; //Barometer correction (%)
|
||||
response[17] = 0x00; //Total GammaE (%)
|
||||
response[18] = currentStatus.VE; //Current VE 1 (%)
|
||||
response[19] = 0x00; //Pulsewidth 2 divided by 10 (in ms)
|
||||
response[20] = 0x00; //Current VE 2 (%)
|
||||
response[21] = currentStatus.TPS; //Will be TPS DOT
|
||||
response[19] = configPage1.tpsMin; //Pulsewidth 2 divided by 10 (in ms)
|
||||
response[20] = configPage1.tpsMax; //Current VE 2 (%)
|
||||
response[21] = 0x00; //Will be TPS DOT
|
||||
response[22] = currentStatus.advance;
|
||||
response[23] = currentStatus.TPS; // TPS (0% to 100%)
|
||||
|
||||
Serial.write(response, (size_t)23);
|
||||
Serial.write(response, (size_t)24);
|
||||
Serial.flush();
|
||||
return;
|
||||
}
|
||||
|
|
19
globals.h
19
globals.h
|
@ -1,8 +1,9 @@
|
|||
#include <Arduino.h>
|
||||
|
||||
const byte ms_version = 20;
|
||||
const byte data_structure_version = 1; //This identifies the data structure when reading / writing.
|
||||
const byte page_size = 125;
|
||||
const byte signature = 20;
|
||||
const byte data_structure_version = 2; //This identifies the data structure when reading / writing.
|
||||
const byte page_size = 128;
|
||||
|
||||
//Handy bitsetting macros
|
||||
#define BIT_SET(a,b) ((a) |= (1<<(b)))
|
||||
|
@ -35,6 +36,7 @@ struct statuses {
|
|||
unsigned int RPM;
|
||||
byte MAP;
|
||||
byte TPS;
|
||||
byte tpsADC;
|
||||
byte VE;
|
||||
byte O2;
|
||||
byte advance;
|
||||
|
@ -85,8 +87,8 @@ struct config1 {
|
|||
byte injPwmP;
|
||||
byte injPwmT;
|
||||
byte battFac; //Whether to compensate pulsewidth for battery voltage (ms/v)
|
||||
int rpmk;
|
||||
|
||||
int rpmk; //2 bytes
|
||||
//36
|
||||
//config1 in ini
|
||||
byte mapType : 2;
|
||||
byte strokes : 1;
|
||||
|
@ -110,12 +112,11 @@ struct config1 {
|
|||
byte fastIdleT; //Fast idle temperature
|
||||
byte egoSwitch;
|
||||
byte taeColdM;
|
||||
byte tpsMin;
|
||||
byte tpsMax;
|
||||
byte unused1;
|
||||
byte unused2;
|
||||
byte unused3;
|
||||
byte unused4;
|
||||
byte unused5;
|
||||
byte unused6;
|
||||
|
||||
//48
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,859 @@
|
|||
;-------------------------------------------------------------------------------
|
||||
|
||||
[MegaTune]
|
||||
MTversion = 2.25 ; MegaTune itself; needs to match exec version.
|
||||
|
||||
queryCommand = "Q"
|
||||
signature = 20
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[Constants]
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Constants Definition
|
||||
; --------------------
|
||||
;
|
||||
; Scalar Values
|
||||
; -------------
|
||||
; The scaling and translation values are used as follows:
|
||||
; msValue = userValue / scale - translate
|
||||
; userValue = (msValue + translate) * scale
|
||||
;
|
||||
;
|
||||
; Temperatures are fine, check out the Fielding IAC example (fastIdleT).
|
||||
;
|
||||
; Array Values
|
||||
; ------------
|
||||
; Arrays are specified just like scalars, except that they have a "shape"
|
||||
; entry in the fourth parameter. The shape allows you to define lists or
|
||||
; tables, for example [8] defines a list with eight values and [2x4] defines
|
||||
; a table with eight values (two rows and four columns). Tables may be
|
||||
; stored in either "X-" or "Y-order." X-order means that memory is layed
|
||||
; out like.
|
||||
;
|
||||
; [x1,y1] [x2,y1]...[xn,y1] [x1,y2]...
|
||||
;
|
||||
; Y-order would be
|
||||
;
|
||||
; [x1,y1] [x1,y2]...[x1,yn] [x2,y1]...
|
||||
;
|
||||
; To use the TableEditor, you must define two lists and a table, and
|
||||
; the lengths of the lists must correspond to the shape of the table.
|
||||
;
|
||||
; Bit Fields
|
||||
; ----------
|
||||
; Bits are numbered 0-7, the rightmost being bit zero. The basic
|
||||
; data word that stores bit fields must be unsigned.
|
||||
;
|
||||
; You need NOT supply the correct number of labels matching the
|
||||
; number of bits you've specified (one bit requires 2 values, two
|
||||
; bits requires 4 values and so on). If you neglect to supply enough
|
||||
; labels, they will be synthesized using the sequence "1", "2" and so
|
||||
; on based upon their position in the sequence (the cltType and matType
|
||||
; will end up with identical lists).
|
||||
;
|
||||
; If you specify a label as "INVALID" (all upper case), then it will
|
||||
; not be displayed in the combo box, so you can leave out values that
|
||||
; make no sense.
|
||||
;
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
endianness = big
|
||||
nPages = 2
|
||||
burnCommand = "B"
|
||||
; pageSize = 125
|
||||
pageSize = 128, 128
|
||||
pageActivationDelay = 10
|
||||
; pageActivate = ""
|
||||
pageActivate = "P\001", "P\002"
|
||||
pageReadCommand = "V", "V"
|
||||
pageValueWrite = "W%o%v", "W%o%v"
|
||||
; pageChunkWrite = "" ; No chunk write for standard MS.
|
||||
|
||||
page = 1
|
||||
; name = bits, type, offset, bits
|
||||
; name = array, type, offset, shape, units, scale, translate, lo, hi, digits
|
||||
; name = scalar, type, offset, units, scale, translate, lo, hi, digits
|
||||
veTable = array, U08, 0, [8x8], "%", 1.0, 0.0, 0.0, 255.0, 0
|
||||
rpmBins = array, U08, 64, [ 8], "RPM", 100.0, 0.0, 100.0, 25500.0, 0
|
||||
#if SPEED_DENSITY
|
||||
mapBins = array, U08, 72, [ 8], "kPa", 1.0, 0.0, 0.0, 255.0, 0
|
||||
#elif ALPHA_N
|
||||
tpsBins = array, U08, 72, [ 8], "TPS", 1.0, 0.0, 0.0, 255.0, 0
|
||||
#elif AIR_FLOW_METER
|
||||
#error "MSnS does not support MAF"
|
||||
;#exit
|
||||
#endif
|
||||
crankCold = scalar, U08, 80, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
crankHot = scalar, U08, 81, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
asePct = scalar, U08, 82, "%", 1.0, 0.0, 0.0, 95.0, 0
|
||||
aseCount = scalar, U08, 83, "", 1.0, 0.0, 0.0, 254.0, 0
|
||||
wueBins = array, U08, 84, [ 10], "%", 1.0, 0.0, 100.0, 255.0, 0
|
||||
taeBins = array, U08, 94, [ 4], "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
taeBins1 = scalar, U08, 94, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
taeBins2 = scalar, U08, 95, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
taeBins3 = scalar, U08, 96, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
taeBins4 = scalar, U08, 97, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
taeColdA = scalar, U08, 98, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
tpsThresh = scalar, U08, 99, "v/s",0.1953125, 0.0, 0.2, 49.8, 3
|
||||
taeTime = scalar, U08, 100, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
tdePct = scalar, U08, 101, "%", 1.0, 0.0, 0.0, 255.0, 0
|
||||
#if CELSIUS
|
||||
egoTemp = scalar, U08, 102, "°C", 0.555, -72, -40, 102.0, 0
|
||||
#else
|
||||
egoTemp = scalar, U08, 102, "°F", 1.0, -40, -40, 215.0, 0
|
||||
#endif
|
||||
egoCount = scalar, U08, 103, "", 1.0, 0.0, 0.0, 255.0, 0
|
||||
egoDelta = scalar, U08, 104, "%", 1.0, 0.0, 0.0, 255.0, 0
|
||||
egoLimit = scalar, U08, 105, "%", 1.0, 0.0, 0.0, 255.0, 0
|
||||
reqFuel = scalar, U08, 106, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
divider = scalar, U08, 107, "", 1.0, 0.0
|
||||
alternate = bits, U08, 108, [0:0], "Simultaneous", "Alternating"
|
||||
injOpen = scalar, U08, 109, "ms", 0.1, 0.0, 0.1, 25.5, 1
|
||||
injOCfuel = scalar, U08, 110, "ms", 0.1, 0.0, 0.0, 0.0, 0
|
||||
injPwmP = scalar, U08, 111, "%", 1.0, 0.0, 0.0, 100.0, 0
|
||||
injPwmT = scalar, U08, 112, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
battFac = scalar, U08, 113, "ms/v",0.0166667, 0.0, 0.0, 1.0, 2
|
||||
rpmk = scalar, U16, 114, "", 1.0, 0.0
|
||||
|
||||
; Config1
|
||||
mapType = bits, U08, 116, [0:1], "115 kPa", "250 kPa", "INVALID", "INVALID"
|
||||
twoStroke = bits, U08, 116, [2:2], "Four-stroke", "Two-stroke"
|
||||
injType = bits, U08, 116, [3:3], "Port", "Throttle Body"
|
||||
nCylinders = bits, U08, 116, [4:7+1]
|
||||
|
||||
; Config2
|
||||
cltType = bits, U08, 117, [0:1], "GM", "Unknown1", "Unknown2", "Unknown3"
|
||||
matType = bits, U08, 117, [2:3], "GM", "Unknown1", "Unknown2", "Unknown3"
|
||||
nInjectors = bits, U08, 117, [4:7+1]
|
||||
|
||||
; Config3
|
||||
engineType = bits, U08, 118, [0:0], "Even fire", "Odd fire"
|
||||
egoType = bits, U08, 118, [1:1], "Narrow band", "Wide band"
|
||||
algorithm = bits, U08, 118, [2:2], "Speed Density", "Alpha-N"
|
||||
baroCorr = bits, U08, 118, [3:3], "Off", "On"
|
||||
|
||||
primePulse = scalar, U08, 119, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||
egoRPM = scalar, U08, 120, "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
#if CELSIUS
|
||||
fastIdleT = scalar, U08, 121, "°C", 0.555, -72.0, -40, 102, 1
|
||||
#else
|
||||
fastIdleT = scalar, U08, 121, "°F", 1.0, -40.0, -40, 215, 0
|
||||
#endif
|
||||
egoSwitch = scalar, U08, 122, "v", 0.0196, 0.0, 0.0, 5.0, 3
|
||||
taeColdM = scalar, U08, 123, "%", 1.0, 0.0, 0.0, 250.0, 0
|
||||
tpsMin = scalar, U08, 124, "ADC", 1.0, 0.0, 0.0, 255.0, 0
|
||||
tpsMax = scalar, U08, 125, "ADC", 1.0, 0.0, 0.0, 255.0, 0
|
||||
|
||||
;--------------------------------------------------
|
||||
;Start Ignition table (Table 2)
|
||||
;--------------------------------------------------
|
||||
|
||||
page = 2
|
||||
advTable1 = array, U08, 0,[8x8], "deg", 1.0, 0.0, 0.0, 255.0, 0
|
||||
rpmBins2 = array, U08, 64,[ 8], "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
|
||||
#if SPEED_DENSITY
|
||||
mapBins2 = array, U08, 72, [ 8], "kPa", 1.0, 0.0, 0.0, 255.0, 0
|
||||
#elif ALPHA_N
|
||||
tpsBins2 = array, U08, 72, [ 8], "TPS", 1.0, 0.0, 0.0, 255.0, 0
|
||||
#elif AIR_FLOW_METER
|
||||
#error "MSnS does not support MAF"
|
||||
#exit
|
||||
#endif
|
||||
|
||||
TrigAng = scalar, U08, 80, "Deg", 4, 0, 0, 360, 0
|
||||
FixAng = scalar, U08, 81, "Deg", 0.352, -28.4, -10, 80, 0
|
||||
Trim = scalar, S08, 82, "Deg", 0.352, 0, -45, 45, 0
|
||||
CrankAng = scalar, U08, 83, "Deg", 0.352, -28.4, -10, 80, 0
|
||||
IgHold = scalar, U08, 84, "", 1, 0, 0, 100, 0
|
||||
Trig_plus = bits, U08, 85[0:1], "0", "+22.5", "INVALID", "+45"
|
||||
TrigCrank = bits, U08, 85[2:2], "Trigger Return", "Time Based"
|
||||
IgInv = bits, U08, 85[3:3], "No", "Yes"
|
||||
oddfire = bits, U08, 85[4:4], "No", "Yes"
|
||||
IdleAdv = scalar, U08, 86, "Deg", 0.352,-28.4, -10, 80, 0
|
||||
IdleAdvTPS = scalar, U08, 87, "ADC", 1, 0, 0, 255, 0
|
||||
IdleAdvRPM = scalar, U08, 88, "RPM", 100, 0, 0, 1200, 0
|
||||
#if CELSIUS
|
||||
IdleAdvCLT = scalar, U08, 89, "C", 0.555, -72, -40, 102, 1
|
||||
#else
|
||||
IdleAdvCLT = scalar, U08, 89, "F", 1, -40, -40, 215, 0
|
||||
#endif
|
||||
IdleDelayTime = scalar, U08, 90, "sec", 1, 0, 0, 5, 0
|
||||
StgCycles = scalar, U08, 91, "cycles", 1, 0, 0, 255, 0
|
||||
|
||||
;Dwell control
|
||||
;running dwell variable railed to 8 - who needs more than 8ms?
|
||||
dwellcont = bits, U08, 92, [1:1], "Fixed duty*^", "Dwell control"
|
||||
dwellcrank = scalar, U08, 93, "ms", 0.1, 0, 0, 25, 1
|
||||
dwellrun = scalar, U08, 94, "ms", 0.1, 0, 0, 8, 1
|
||||
numteeth = scalar, U08, 95, "teeth", 1.0, 0.0, 0.0, 255, 0
|
||||
onetwo = scalar, U08, 96, "teeth", 1.0, 0.0, 0.0, 255, 0
|
||||
|
||||
crankRPM = scalar, U08, 97, "rpm", 100.0, 0.0, 100, 1000, 0
|
||||
tpsflood = scalar, U08, 98, "raw", 1.0, 0.0, 0.0, 255.0, 0
|
||||
|
||||
;Rev Limits
|
||||
SoftRevLim = scalar, U08, 99, "rpm", 100.0, 0.0, 100, 25500, 0
|
||||
SoftLimRetard = scalar, U08, 100, "deg", 0.352, -28.4, -10, 80, 0
|
||||
SoftLimMax = scalar, U08, 101, "s", 0.1, 0.0, 0.0, 25.5, 1
|
||||
HardRevLim = scalar, U08, 102, "rpm", 100, 0.0, 100, 25500, 0
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[Menu]
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; There are five pre-defined values that may be used to define your menus.
|
||||
; The first four allow access to the "standard" dialog boxes, the last one
|
||||
; merely draws a separator (horizontal line) in the menu.
|
||||
;
|
||||
; std_constants
|
||||
; std_enrichments
|
||||
; std_realtime
|
||||
; std_warmup
|
||||
;
|
||||
; std_separator
|
||||
;
|
||||
; If you use any of the std_constants, std_enrichments or std_warmup
|
||||
; editors, they may be optionally suffixed with a page number (only
|
||||
; 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".
|
||||
;
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
menu = "&Settings"
|
||||
subMenu = std_constants, "&Constants"
|
||||
subMenu = std_enrichments, "&Enrichments"
|
||||
|
||||
menu = "&Tuning"
|
||||
subMenu = std_realtime, "&Realtime Display"
|
||||
subMenu = std_warmup, "&Warmup Enrichment"
|
||||
subMenu = accelEnrichments, "&Acceleration Wizard"
|
||||
subMenu = veTableTbl, "&VE Table", 0
|
||||
subMenu = sparkTbl, "&Spark Table", 1
|
||||
subMenu = RevLimiterS, "Rev Limits", 2
|
||||
|
||||
menu = "&Spark"
|
||||
subMenu = sparkSettings, "&Spark Settings"
|
||||
subMenu = sparkTbl, "Spark Table", 1
|
||||
;subMenu = IdleAdvance, "Idle Advance settings",
|
||||
;subMenu = Knock, "Kn&ock System"
|
||||
;subMenu = IatCltIg, "&IAT/Clt Related Ignition"
|
||||
subMenu = dwellSettings, "Dwell settings"
|
||||
;subMenu = wheelsim, "Stim for wheel"
|
||||
;subMenu = oddwheel, "Oddfire Wheel settings", 7, { wheelon && oddfire }
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[UserDefined]
|
||||
; define a MegaTune compatible version here
|
||||
; no need to for std_enrichments, it is built in.
|
||||
|
||||
|
||||
[UserDefinedTS]
|
||||
; Enhanced TunerStudio dialogs can be defined here
|
||||
; MegaTune will over look this section
|
||||
; These dialogs will over-ride those in the UserDefined Section
|
||||
; User defined ar loaded first, then if one by the same name is defiend here,
|
||||
; it will replace the MegaTune definition
|
||||
|
||||
; dialog = name, Title, Layout
|
||||
;
|
||||
; valid options for layout are xAxis, yAxis, border
|
||||
; for an xAxis, each field added will be added from right to left
|
||||
; A yAxis layout will add fields from top to bottom
|
||||
; A border layout will expect an additional constraint to determine placement
|
||||
; 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
|
||||
; dialog which will be added.
|
||||
; dialogs can be nested and can be mixed with fields
|
||||
|
||||
dialog = accelEnrichments, "Acceleration Enrichment"
|
||||
field = "TPSdot Threshold", tpsThresh
|
||||
field = "Accel Time", taeTime
|
||||
field = "Cold Accel Enrichment", taeColdA
|
||||
field = "Cold Accel Mult", taeColdM
|
||||
field = "Decel Fuel Amount", tdePct
|
||||
field = "Acceleration Enrichment Bins (ms)"
|
||||
field = "2 v/s", taeBins1
|
||||
field = "4 v/s", taeBins2
|
||||
field = "8 v/s", taeBins3
|
||||
field = "15 v/s", taeBins4
|
||||
|
||||
;time based AE
|
||||
dialog = time_ae_south, ""
|
||||
field = "Accel TPSdot threshold", tpsThresh
|
||||
field = "Decel Fuel Amount", tdePct
|
||||
field = "Cold Accel Adder", taeColdA
|
||||
field = "Cold Accel Multiplier", taeColdM
|
||||
field = "Accel Enrich Down-scaling With RPM"
|
||||
;field = "Full Accel Below:", ae_lorpm, { !feature7_aeevents }
|
||||
;field = "Zero Accel Above:", ae_hirpm, { !feature7_aeevents }
|
||||
|
||||
dialog = time_ae_north, "", xAxis
|
||||
panel = time_accel_tpsdot_curve, East, {tpsProportion > 0}
|
||||
|
||||
dialog = AEtime_settings, "Time-based Accel Enrichment", yAxis
|
||||
panel = time_ae_north
|
||||
panel = time_ae_south
|
||||
|
||||
dialog = crankPW, "Cranking Pulsewidths (ms)"
|
||||
#if CELSIUS
|
||||
field = "Priming Pulsewidth", primePulse
|
||||
field = "Pulsewidth at -40°C", crankCold
|
||||
field = "Pulsewidth at 77°C", crankHot
|
||||
#else
|
||||
field = "Priming Pulsewidth", primePulse
|
||||
field = "Pulsewidth at -40°F", crankCold
|
||||
field = "Pulsewidth at 170°F", crankHot
|
||||
#endif
|
||||
|
||||
dialog = aseSettings, "Afterstart Enrichment"
|
||||
field = "Enrichment %", asePct
|
||||
field = "Number of Ignition Cycles", aseCount
|
||||
|
||||
dialog = nestedwarmup_curve, "Warmup Enrichment percent multiplier"
|
||||
panel = warmup_curve
|
||||
|
||||
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 = westEnrichments, "", yAxis
|
||||
panel = crankPW
|
||||
panel = aseSettings
|
||||
panel = egoSettings
|
||||
|
||||
dialog = std_enrichments, "Enrichments", border ; xAxis would work here too, but wanted to give a border example
|
||||
topicHelp = "helpEnrichments"
|
||||
panel = westEnrichments, West
|
||||
panel = accelEnrichments, East
|
||||
|
||||
dialog = sparkSettings,"Spark Settings",3
|
||||
topicHelp = Shelp3
|
||||
field = "Wheel decoder base teeth", numteeth
|
||||
field = "Missing teeth", onetwo
|
||||
field = "Trigger Angle"
|
||||
field = "Trigger Angle ", TrigAng
|
||||
field = "Note: This number will be rounded to the nearest 4 degrees"
|
||||
field = "This number represents the angle ATDC when the 1st"
|
||||
field = "tooth after the gap passes the sensor."
|
||||
field = ""
|
||||
;field = "Cranking Timing", TrigCrank
|
||||
;field = "Cranking advance Angle (see F1)", CrankAng, { TrigCrank + edis + dwellcont }
|
||||
field = "Hold Ignition", IgHold
|
||||
field = "Spark Output Inverted (see F1)", IgInv
|
||||
field = ""
|
||||
field = "Fixed Angle (-10 = 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 = "these times are for 12V. Battery voltage correction"
|
||||
field = "is applied. At higher voltages the time is reduced"
|
||||
field = "and when low it is increased"
|
||||
|
||||
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
|
||||
|
||||
; [CurveEditor]
|
||||
|
||||
;time-based accel enrichment
|
||||
curve = time_accel_tpsdot_curve, "TPS based AE"
|
||||
columnLabel = "TPSdot", "Added"
|
||||
xAxis = 0, 1200, 6
|
||||
yAxis = 0, 48, 4
|
||||
xBins = taeRates, TPSdot
|
||||
yBins = taeBins
|
||||
|
||||
; curve = warmup_curve, "Warmup Enrichment Curve"
|
||||
; columnLabel = "Coolant", "WUE %"
|
||||
; xAxis = -40, {clthighlim}, 9
|
||||
; yAxis = 0, 500, 6
|
||||
; xBins = tempTable, coolant
|
||||
; yBins = wueBins
|
||||
; gauge = cltGauge
|
||||
|
||||
; -------------------------------------------------------------
|
||||
; Help down here
|
||||
help = helpEnrichments, "Enrichments Help"
|
||||
text = "<strong>Priming Pulse</strong><br><br>"
|
||||
text = "The duration in milliseconds of a priming pulse that is applied when the MS controller is powered up. If you don’t want a priming pulse, set this field to zero. (Only available for version 2.0 and later of MegaSquirt controller code.)<br>"
|
||||
|
||||
text = "<br><strong>Cranking Pulsewidth</strong><br><br>"
|
||||
text = "Cranking pulse width determines how long the injector will be open in milliseconds for each pulse while the engine is cranking (i.e., the RPM is below 300). The actual pulse width is determined by performing linear interpolation on the line described by the end points you enter for the "-40 degrees F" and "170 degrees F" values. For instance, if you enter 10.0 ms as the pulse width at -40 F and 2.0 ms at 170 F, the pulse width will be 6.0 ms when you start your engine at 65 F.<br>"
|
||||
text = "Note: Cranking pulse occur at every ignition event, while running pulses only occur at the interval specified on the constants page; if you have a 4 cylinder engine and are taking the tachometer signal from the coil, then you will get four (4) cranking pulses per cycle and depending on settings one injection per cycle while running.<br>"
|
||||
text = "The MS variables "CWU" and "CWH" hold the low temperature and high temperature pulse widths, respectively.<br>"
|
||||
|
||||
text = "<br><strong>Afterstart Enrichment</strong><br>"
|
||||
text = "The afterstart enrichment is one that decays from its max value (specified in the "Enrichment (percent)" field) to zero in a linear fashion over a period defined in "Number of Ignition Cycles." If you specify 20% enrichment over 250 ignition cycles, then the first pulse is enriched by 20%, the 125th pulse is enriched by 10% and the 250th (and later) by zero percent (this assumes 1 event per cycle, or a 1 cylinder engine; divide by the number of ignition events per cycle to get the specific behavior for your motor).<br>"
|
||||
text = "MS stores these values in the flash constants called "AWC" (Afterstart Warmup Count) and "AWEV" (Afterstart Warmup Enrichment Value).<br>"
|
||||
|
||||
text = "<br><strong>Exhaust Gas Oxygen Sensor Parameters</strong><br>"
|
||||
text = "These parameters define the closed loop behavior of MS. You must have a narrow band O2 sensor hooked up for this mode to work in v.1.0 controller code; either a narrow band or wide band will work with v.2.0 of controller code. To disable closed loop operation altogether, set the EGO Step value to zero.<br>"
|
||||
|
||||
text = "<br><strong>EGO Sensor Type</strong><br>"
|
||||
text = "Specify either a narrow band sensor or wide band sensor. Functionally this merely sets the direction sense of the sensor voltage. For narrow band sensors, the voltage rises as the mixture is richening and drops as the mixture becomes lean. The wide band setting corresponds to the opposite sense, i.e., voltage drops to indicate enrichment (this is how the DIY-WB operates, not necessarily all WB sensors!). (Available in v 2.0 controller code.)<br>"
|
||||
|
||||
text = "<br><strong>EGO Switch Point (v)</strong><br>"
|
||||
text = "This is the switching point voltage that indicates stoichiometric combustion (approximately 14.7:1 with gasoline). For narrow band sensors this is 0.5 v*; for the DIY-WB wideband sensor it is 2.5 v (for other wideband sensors this voltage may be quite different). (This value is only active in v 2.0 controller code.)<br>"
|
||||
text = "*This is true for zirconia NB sensors, which are used almost exclusively in modern vehicles. The titania NB sensor has a different voltage range (1-5 v), but is rarely used.<br>"
|
||||
|
||||
text = "<br><strong>Coolant Temp Activation (°F)</strong><br>"
|
||||
text = "This is the temperature below which closed loop operation is disabled. If this value is too low, then closed loop will try to lean out the warmup enrichments and you may experience rough running. Typical value is 160 F and should somewhat above the point at which warmup enrichment stops (see the Warmup Enrichment Bins settings and find the lowest on which contains 100).<br>"
|
||||
text = "The MS value "EGOTEMP" stores this quantity.<br>"
|
||||
|
||||
text = "<br><strong>Ignition Events Per Step</strong><br>"
|
||||
text = "This value determines the rate at which the closed loop algorithm applies correction. The default value of 32, when used on a four cylinder engine with four ignition events per cycle, tells MS to wait for 8 cycles before changing the current correction factor.<br>"
|
||||
|
||||
text = "<br><strong>EGO Step (percent)</strong><br>"
|
||||
text = "Once the closed loop algorithm has decided to change the correction factor, it adds or subtracts this percentage from the current value. This should move slowly to avoid unstable response, so make sure it is small, 1% being the default.<br>"
|
||||
|
||||
text = "<br><strong>EGO Limit (%)</strong><br>"
|
||||
text = "Closed loop operation should not be substituted for proper tuning! This value limits the correction that can be made by the closed loop algorithm, the default of 10% indicates the correction factor cannot go outside the range 90-110%.<br>"
|
||||
|
||||
text = "<br><strong>EGO Active Above RPM</strong><br>"
|
||||
text = "This value specifies the lower limit above which closed loop operation occurs. Typically, your engine will idle best when it is richer than stoich, so turning off closed loop for low RPMs allows this to happen. The default value for the RPM limit is 1200. (Available only in v 2.0 MS, older versions have a fixed 1200 RPM value in the controller code.)<br>"
|
||||
|
||||
text = "<br><strong>Warmup Enrichment Bins</strong><br>"
|
||||
text = "Warmup enrichment is based on coolant temperature. Since warmup enrichment requirements are usually non-linear, several bins are provided to specify different rates in different temperature domains.<br>"
|
||||
text = "Place values in the "-40" through "160 degrees F" fields, typically running from about 120 at -40 F to 100 at 100 F; make sure the values are all 100 or greater.<br>"
|
||||
text = "The MS array "WWU" contains these enrichment values.<br>"
|
||||
|
||||
text = "<br><strong>Acceleration Enrichment</strong><br>"
|
||||
text = "Acceleration enrichment (AE) occurs when you open the throttle "rapidly" to avoid bogging the engine. In v.1.01 MS, this is done solely based upon the rate of change in the throttle position sensor (also called TPSDOT).<br>"
|
||||
|
||||
text = "<br><strong>TPSDOT Thresh</strong><br>"
|
||||
text = "This is the threshold in v/sec below which no acceleration enrichment will occur (you can move the throttle from idle to full open without acceleration enrichment, if you open it slowly enough). Depends grossly upon the range of your TPS, a typical value might be 1.2 v/sec.<br>"
|
||||
|
||||
text = "<strong>Tuning Note:</strong> While you are tuning the VE table you should set this threshold artificially high (maybe 40.0) to disable acceleration enrichment completely. After the VE table is fairly well-defined, set this back to 1.2 and begin tuning AE.<br>"
|
||||
text = "MS stores this value in the "TPSTHRESH" variable.<br>"
|
||||
|
||||
text = "<br><strong>Accel Time (sec)</strong><br>"
|
||||
text = "This value indicates how long the acceleration enrichment "squirt" will last. Typical values are around 1.0 second. MS stores this value in the variable "TPSACLK."<br>"
|
||||
|
||||
text = "<br><strong>Cold Accel Enrichment (ms)</strong><br>"
|
||||
text = "The acceleration enrichment pulse also varies depending upon coolant temperature. The value specified here is the pulse width added to the value from the bin calculations at -40 F. The Cold Acceleration Enrichment amount is linearly interpolated from full amount at -40 F down to zero at 165 F. A typical value might be 2.0 ms.<br>"
|
||||
text = "This value is stored in the "TPSACOLD" variable in MS.<br>"
|
||||
|
||||
text = "<br><strong>Cold Accel Multiplier (%)</strong><br>"
|
||||
text = "Another means for increasing the amount of fuel delivered by the acceleration enrichment pulse is supplied by this value; it is likewise interpolated from the full specified amount at –40F down to zero at 165 F. Before the Cold Acceleration Enrichment value is added to the base acceleration enrichment pulsewidth, it is multiplied by this value.<br>"
|
||||
text = "Total AE = Base AE * CAM + CAE<br>"
|
||||
text = "The difference between the two types of AE cold modify can be easily seen with a few examples:<br>"
|
||||
text = "1) Assume we have a calculated AE pulse of 5.0 ms. Say our coolant temperature is 40 F, giving a CAE pulse of 2.0 ms and CAM is turned off (100%). The result is 5.0+2.0 = 7.0 ms.<br>"
|
||||
text = "2) Assume same base AE and temperature, but now we turn off CAE (0.0 ms) and set CAM to give 140%. The result is the same, we get 5.0*1.4 = 7.0 ms.<br>"
|
||||
text = "3) Take the first case, but hit the accelerator faster, giving 8.0 ms base AE pulse. We now have a result of 8.0+2.0 = 10.0 ms.<br>"
|
||||
text = "4) Take case 2, but with the higher base AE pulse, giving 8.0*1.4 = 11.2 ms.<br>"
|
||||
text = "The bottom line is that the CAE modifier is constant and independent of the base pulse, where on the other hand, the CAM modifier has a proportional effect on the AE, bigger base pulse means bigger result.<br>"
|
||||
text = "This value is stored in the 'ACMULT' variable in MS.<br>"
|
||||
|
||||
text = "<br><strong>Decel Fuel Amount (%)</strong><br>"
|
||||
text = "When you let off the throttle rapidly (that is the closing rate exceeds TPSDOT Thresh) and the engine is turning faster than 1500 RPM, then deceleration fuel cutoff is performed by MS. Deceleration fuel amount is multiplied by the "normal" pulse width, that is, if the calculated pulse is 12.0 ms and you have 20% decel amount, then the resulting pulse width is 2.4 ms. A value of 100% causes the fuel to remain at its calculated value, and can cure bucking on deceleration in vehicles with manual transmissions; those with automatic transmissions may benefit in fuel economy by using values below 100%.<br>"
|
||||
text = "The MS variable "TPSDQ" holds this value as a percentage. <br>"
|
||||
|
||||
text = "<br><strong>Acceleration Enrichment Bins (ms)</strong><br>"
|
||||
text = "These bins specify the actual enrichment in terms of pulse width. They are linearly interpolated to determine a value that is ultimately added to the computed pulse width.<br>"
|
||||
text = "The array of values is called "TPSAQ" as stored in MS."
|
||||
|
||||
|
||||
|
||||
|
||||
[TableEditor]
|
||||
; table_id, map3d_id, "title", page
|
||||
table = veTableTbl, veTableMap, "VE Table", 1
|
||||
; constant, variable
|
||||
xBins = rpmBins, rpm
|
||||
#if SPEED_DENSITY
|
||||
yBins = mapBins, map
|
||||
#else
|
||||
yBins = tpsBins, throttle
|
||||
#endif
|
||||
zBins = veTable
|
||||
|
||||
gridHeight = 2.0
|
||||
gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees.
|
||||
upDownLabel = "(RICHER)", "(LEANER)"
|
||||
|
||||
table = sparkTbl, sparkMap, "Ignition Advance Table", 2
|
||||
xBins = rpmBins2, rpm
|
||||
#if SPEED_DENSITY
|
||||
yBins = mapBins2, map
|
||||
#else ALPHA_N
|
||||
yBins = tpsBins2, throttle
|
||||
#endif
|
||||
zBins = advTable1
|
||||
gridHeight = 3.0
|
||||
upDownLabel = "ADVANCED", "RETARDED"
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[GaugeConfigurations]
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; Notes on some of the gauges.
|
||||
;
|
||||
; The accelEnrichGauge is now a composite of both acceleration enrichment
|
||||
; and deceleration enleanment numbers. See the definition of the variable
|
||||
; accDecEnrich in the OutputChannels section.
|
||||
;
|
||||
; David Hooke contributed the lambda gauge and associated transfer
|
||||
; function files.
|
||||
;
|
||||
; "The lambda gauge is the best way (my opinion) to report data from a
|
||||
; wide band EGO gauge, it standardizes the output irrespective of fuel
|
||||
; or mix of fuels, so you needn't do any brainwork to know if your 75%
|
||||
; gasoline and 25% methanol is rich at 10:1 or not.
|
||||
;
|
||||
; "Use the file WBlambda100AVR.inc, if using a standard ADC (e.g., AVR cpu).
|
||||
; Use the file WBlambda100MOT.inc, if using a biased ADC (e.g., MOT cpu)."
|
||||
;-------------------------------------------------------------------------------
|
||||
; Define a gauge's characteristics here, then go to a specific layout
|
||||
; block (Tuning or FrontPage) and use the name you've defined here to
|
||||
; display that gauge in a particular position.
|
||||
;
|
||||
; Name = Case-sensitive, user-defined name for this gauge configuration.
|
||||
; Var = Case-sensitive name of variable to be displayed, see the
|
||||
; OutputChannels block in this file for possible values.
|
||||
; Title = Title displayed at the top of the gauge.
|
||||
; Units = Units displayed below value on gauge.
|
||||
; Lo = Lower scale limit of gauge.
|
||||
; Hi = Upper scale limit of gauge.
|
||||
; LoD = Lower limit at which danger color is used for gauge background.
|
||||
; LoW = Lower limit at which warning color is used.
|
||||
; HiW = Upper limit at which warning color is used.
|
||||
; HiD = Upper limit at which danger color is used.
|
||||
; vd = Decimal places in displayed value
|
||||
; ld = Label decimal places for display of Lo and Hi, above.
|
||||
|
||||
;Name Var Title Units Lo Hi LoD LoW HiW HiD vd ld
|
||||
baroADCGauge = baroADC, "Barometer ADC", "", 0, 255, -1, -1, 256, 256, 0, 0
|
||||
mapADCGauge = mapADC, "MAP ADC", "", 0, 255, -1, -1, 256, 256, 0, 0
|
||||
matADCGauge = matADC, "MAT ADC", "", 0, 255, -1, -1, 256, 256, 0, 0
|
||||
cltADCGauge = cltADC, "CLT ADC", "", 0, 255, -1, -1, 256, 256, 0, 0
|
||||
tpsADCGauge = tpsADC, "TPS ADC", "", 0, 255, -1, -1, 256, 256, 0, 0
|
||||
batADCGauge = batADC, "BAT ADC", "", 0, 255, -1, -1, 256, 256, 0, 0
|
||||
|
||||
#if NARROW_BAND_EGO
|
||||
egoGauge = egoVoltage, "Exhaust Gas Oxygen", "volts", 0, 1.0, 0.2, 0.3, 0.6, 0.8, 2, 2
|
||||
#else
|
||||
egoGauge = egoVoltage, "Exhaust Gas Oxygen", "volts", 0.5, 4.5, 0.0, 0.0, 5.0, 5.0, 2, 2
|
||||
#endif
|
||||
lambdaGauge = lambda, "Lambda", "", 0.5, 1.5, 0.5, 0.7, 2, 1.1, 2, 2
|
||||
|
||||
accelEnrichGauge = accDecEnrich, "Accel Enrich", "%", 50, 150, -1, -1, 999, 999, 0, 0
|
||||
afrGauge = afr, "Air:Fuel Ratio", "", 10, 19.4, 12, 13, 15, 16, 2, 2
|
||||
clockGauge = secl, "Clock", "Seconds", 0, 255, 10, 10, 245, 245, 0, 0
|
||||
deadGauge = deadValue, "---", "", 0, 1, -1, -1, 2, 2, 0, 0
|
||||
dutyCycleGauge = dutyCycle, "Duty Cycle", "%", 0, 100, -1, -1, 85, 90, 1, 1
|
||||
egoCorrGauge = egoCorrection, "EGO Correction", "%", 50, 150, 90, 99, 101, 110, 0, 0
|
||||
|
||||
gammaEnrichGauge = gammaEnrich, "Gamma Enrichment", "%", 50, 150, -1, -1, 151, 151, 0, 0
|
||||
mapGauge = map, "Engine MAP", "kPa", 0, 255, 0, 20, 200, 245, 0, 0
|
||||
pulseWidthGauge = pulseWidth, "Pulse Width", "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 1, 1
|
||||
tachometer = rpm, "Engine Speed", "RPM", 0, 8000, 300, 600, 3000, 5000, 0, 0
|
||||
throttleGauge = throttle, "Throttle Position", "%TPS", 0, 100, -1, 1, 90, 100, 0, 0
|
||||
tpsGauge = tps, "Throttle Position2", "%TPS", 0, 100, -1, 1, 90, 100, 0, 0
|
||||
veBucketGauge = veTuneValue, "VE Value", "%", 0, 120, -1, -1, 999, 999, 0, 0
|
||||
veGauge = veCurr, "VE Current", "%", 0, 120, -1, -1, 999, 999, 0, 0
|
||||
voltMeter = batteryVoltage,"Battery Voltage", "volts", 7, 21, 8, 9, 15, 16, 2, 2
|
||||
warmupEnrichGauge = warmupEnrich, "Warmup Enrichment", "%", 100, 150, -1, -1, 101, 105, 0, 0
|
||||
|
||||
#if CELSIUS
|
||||
cltGauge = coolant, "Coolant Temp", "%TEMP", -40, 120, -15, 0, 95, 105, 0, 0
|
||||
matGauge = mat, "Manifold Air Temp", "%TEMP", -40, 110, -15, 0, 95, 100, 0, 0
|
||||
#else
|
||||
cltGauge = coolant, "Coolant Temp", "%TEMP", -40, 250, 0, 30, 200, 220, 0, 0
|
||||
matGauge = mat, "Manifold Air Temp", "%TEMP", -40, 215, 0, 30, 200, 210, 0, 0
|
||||
#endif
|
||||
advanceGauge = advance, "Spark Advance", "deg BTDC", 50, -10, 0, 0, 35, 45, 0,
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[FrontPage]
|
||||
#if NARROW_BAND_EGO
|
||||
egoLEDs = 0.0, 1.0, 0.5 ; NB settings.
|
||||
#else
|
||||
; If you reverse these range values as you see below, then the LED
|
||||
; bar will work as you expect, high on the right, low on the left.
|
||||
egoLEDs = 4.0, 1.0, 2.5 ; WB settings.
|
||||
#endif
|
||||
|
||||
; Gauges are numbered left to right, top to bottom.
|
||||
;
|
||||
; 1 2 3 4
|
||||
; 5 6 7 8
|
||||
|
||||
gauge1 = tachometer
|
||||
#if SPEED_DENSITY
|
||||
gauge2 = throttleGauge
|
||||
#else
|
||||
gauge2 = tpsGauge
|
||||
#endif
|
||||
gauge3 = pulseWidthGauge
|
||||
gauge4 = dutyCycleGauge
|
||||
gauge5 = mapGauge
|
||||
gauge6 = matGauge
|
||||
gauge7 = cltGauge
|
||||
gauge8 = gammaEnrichGauge
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Indicators
|
||||
; expr off-label on-label, off-bg, off-fg, on-bg, on-fg
|
||||
|
||||
|
||||
indicator = { ready }, "Not Ready", "Ready", white, black, green, black
|
||||
indicator = { crank }, "Not Cranking", "Cranking", white, black, green, black
|
||||
indicator = { startw }, "ASE OFF", "ASE", white, black, green, black
|
||||
indicator = { warmup }, "WUE OFF", "WUE", white, black, green, black
|
||||
indicator = { tpsaccaen }, "TPS Accel", "TPS Accel", white, black, green, black
|
||||
indicator = { mapaccaen }, "MAP Accel", "MAP Accel", white, black, green, black
|
||||
indicator = { tpsaccden }, "TPS Decel", "TPS Decel", white, black, green, black
|
||||
indicator = { mapaccden }, "MAP Decel", "MAP Decel", white, black, green, black
|
||||
indicator = { tps > floodClear }, "", "FLOOD CLEAR", white, black, red, black
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
[RunTime]
|
||||
barHysteresis = 2.5 ; Seconds
|
||||
#if CELSIUS
|
||||
coolantBar = -40, 100
|
||||
matBar = -40, 100
|
||||
#else
|
||||
coolantBar = -40, 215
|
||||
matBar = -40, 215
|
||||
#endif
|
||||
|
||||
batteryBar = 6, 15
|
||||
dutyCycleBar = 0, 100
|
||||
#if NARROW_BAND_EGO
|
||||
egoBar = 0, 1.0
|
||||
#else
|
||||
egoBar = 0, 5.0
|
||||
#endif
|
||||
gammaEBar = 0, 200
|
||||
mapBar = 0, 255
|
||||
pulseWidthBar = 0, 25.5
|
||||
rpmBar = 0, 8000
|
||||
throttleBar = 0, 100
|
||||
|
||||
egoCorrBar = 0, 200
|
||||
baroCorrBar = 0, 200
|
||||
warmupCorrBar = 0, 200
|
||||
airdenCorrBar = 0, 200
|
||||
veCorrBar = 0, 200
|
||||
accCorrBar = 0, 100
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[Tuning]
|
||||
#if NARROW_BAND_EGO
|
||||
egoLEDs = 0.0, 1.0, 0.5 ; NB settings.
|
||||
#else
|
||||
; If you reverse these range values as you see below, then the LED
|
||||
; bar will work as you expect, high on the right, low on the left.
|
||||
egoLEDs = 4.0, 1.0, 2.5 ; WB settings.
|
||||
#endif
|
||||
|
||||
font = "Courier", 14
|
||||
spotDepth = 2 ; 0 = no indicators, 1 = Z only, 2 = XYZ indicators.
|
||||
cursorDepth = 2 ; Same as spot depth.
|
||||
|
||||
; The four radio buttons on the tuning screen select a "page" of six
|
||||
; gauges. The gauge numbering is the same as the front page, across
|
||||
; then down.
|
||||
; 1 2
|
||||
; 3 4
|
||||
; 5 6
|
||||
;
|
||||
; gaugeColumns allows you to hide or show gauges in column 2 (i.e.,
|
||||
; gauges 2, 4 and 6).
|
||||
|
||||
gaugeColumns = 2 ; Only 1 or 2 are valid.
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Notes on tuning screen gauges:
|
||||
; pageButtons = Labels for radio buttons at bottom of tuning dialog.
|
||||
;
|
||||
; Gauge 2 previously switched automatically to be tpsGauge when alpha-n
|
||||
; was enabled, but you need to do it manually now.
|
||||
;----------------------------------------------------------------------------
|
||||
; Page 1 Page 2 Page 3 Page 4
|
||||
pageButtons = "&EGO", "&WUE", "PW&1", "PW&2"
|
||||
gauge1 = tachometer, tachometer, tachometer, tachometer
|
||||
gauge2 = mapGauge, mapGauge, mapGauge, mapGauge
|
||||
gauge3 = egoGauge, egoGauge, egoGauge, egoGauge
|
||||
gauge4 = egoCorrGauge, warmupEnrichGauge, pulseWidthGauge, pulseWidthGauge
|
||||
gauge5 = veBucketGauge, veBucketGauge, veBucketGauge, veBucketGauge
|
||||
gauge6 = accelEnrichGauge, accelEnrichGauge, dutyCycleGauge, dutyCycleGauge
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[OutputChannels]
|
||||
; The number of bytes MegaTune should expect as a result
|
||||
; of sending the "A" command to MegaSquirt is determined
|
||||
; by the value of ochBlockSize, so be very careful when
|
||||
; you change it.
|
||||
|
||||
deadValue = { 0 } ; Convenient unchanging value.
|
||||
|
||||
ochGetCommand = "A"
|
||||
|
||||
ochBlockSize = 24
|
||||
|
||||
secl = scalar, U08, 0, "sec", 1.000, 0.000
|
||||
squirt = scalar, U08, 1, "bits", 1.000, 0.000
|
||||
engine = scalar, U08, 2, "bits", 1.000, 0.000
|
||||
ready = bits, U08, 2, [0:0]
|
||||
crank = bits, U08, 2, [1:1]
|
||||
startw = bits, U08, 2, [2:2]
|
||||
warmup = bits, U08, 2, [3:3]
|
||||
tpsaccaen = bits, U08, 2, [4:4]
|
||||
tpsaccden = bits, U08, 2, [5:5]
|
||||
mapaccaen = bits, U08, 2, [6:6]
|
||||
mapaccden = bits, U08, 2, [7:7]
|
||||
baroADC = scalar, U08, 3, "ADC", 1.000, 0.000
|
||||
mapADC = scalar, U08, 4, "ADC", 1.000, 0.000
|
||||
matADC = scalar, U08, 5, "ADC", 1.000, 0.000
|
||||
cltADC = scalar, U08, 6, "ADC", 1.000, 0.000
|
||||
tpsADC = scalar, U08, 7, "ADC", 1.000, 0.000
|
||||
batADC = scalar, U08, 8, "ADC", 1.000, 0.000
|
||||
egoADC = scalar, U08, 9, "ADC", 1.000, 0.000
|
||||
egoCorrection = scalar, U08, 10, "%", 1.000, 0.000
|
||||
airCorrection = scalar, U08, 11, "%", 1.000, 0.000
|
||||
warmupEnrich = scalar, U08, 12, "%", 1.000, 0.000
|
||||
rpm100 = scalar, U08, 13, "r100", 1.000, 0.000
|
||||
pulseWidth = scalar, U08, 14, "ms", 0.100, 0.000
|
||||
accelEnrich = scalar, U08, 15, "%", 1.000, 0.000
|
||||
baroCorrection = scalar, U08, 16, "%", 1.000, 0.000
|
||||
gammaEnrich = scalar, U08, 17, "%", 1.000, 0.000
|
||||
veCurr = scalar, U08, 18, "%", 1.000, 0.000
|
||||
blank1 = scalar, U08, 19 ; Raw inputs, as they come from MS.
|
||||
blank2 = scalar, U08, 20
|
||||
TPSdot = scalar, U08, 21, "%/s", 1.000, 0.000
|
||||
advance = scalar, U08, 22, "deg", 1.000, 0.000
|
||||
tps = scalar, U08, 23, "%", 1.000, 0.000
|
||||
|
||||
; Computed output channels. See "megatuneExamples.ini" for all the
|
||||
; pre-defined variables, search for "???" and you'll see them.
|
||||
|
||||
accDecEnrich = { accelEnrich + ((engine & 0b00100000) ? tdePct : 100) }
|
||||
batteryVoltage = { batADC / 255.0 * 30.0 } ; Current MS power supply voltage.
|
||||
coolant = { tempCvt(table(cltADC, "thermfactor.inc")-40) } ; Coolant sensor temperature in user units.
|
||||
egoVoltage = { egoADC / 255.0 * 5.0 } ; EGO sensor voltage.
|
||||
mat = { tempCvt(table(matADC, "matfactor.inc")-40) } ; Manifold temperature in user units.
|
||||
rpm = { rpm100*100 } ; True RPM.
|
||||
time = { timeNow } ; "timeNow" is a parameterless built-in function.
|
||||
|
||||
afrtarget = { 0 }
|
||||
#include "lambdaSensors.ini"
|
||||
|
||||
#if MPX4250
|
||||
barometer = { table(baroADC, "kpafactor4250.inc") }
|
||||
map = { table(mapADC, "kpafactor4250.inc") } ; Manifold pressure in kPa.
|
||||
#else
|
||||
barometer = { table(baroADC, "kpafactor4115.inc") }
|
||||
map = { table(mapADC, "kpafactor4115.inc") }
|
||||
#endif
|
||||
; throttle = { table(tpsADC, "throttlefactor.inc") }
|
||||
throttle = { tps }, "%"
|
||||
|
||||
idleDC = { (coolant < fastIdleT) * 100 }
|
||||
|
||||
altDiv = { alternate ? 2 : 1 }
|
||||
cycleTime = { 60000.0 / rpm * (2.0-twoStroke) }
|
||||
nSquirts = { nCylinders/divider }
|
||||
dutyCycle = { 100.0*nSquirts/altDiv*pulseWidth/cycleTime }
|
||||
|
||||
#if EXPANDED_CLT_TEMP
|
||||
clt_exp = { 1 }
|
||||
#else
|
||||
clt_exp = { 0 }
|
||||
#endif
|
||||
|
||||
#if CELSIUS
|
||||
cltlowlim = { clt_exp ? -40 : -40 }
|
||||
clthighlim = { clt_exp ? 230 : 120 }
|
||||
cltlowdang = { clt_exp ? 65 : 10 }
|
||||
cltlowwarn = { clt_exp ? 93 : 65 }
|
||||
clthighwarn = { clt_exp ? 162 : 93 }
|
||||
clthighdang = { clt_exp ? 176 : 104 }
|
||||
mathigh = { 110 }
|
||||
#else ; fahrenheit
|
||||
cltlowlim = { clt_exp ? -40 : -40 }
|
||||
clthighlim = { clt_exp ? 450 : 250 }
|
||||
cltlowdang = { clt_exp ? 150 : 50 }
|
||||
cltlowwarn = { clt_exp ? 200 : 150 }
|
||||
clthighwarn = { clt_exp ? 325 : 200 }
|
||||
clthighdang = { clt_exp ? 350 : 220 }
|
||||
mathigh = { 215 }
|
||||
#endif
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[Datalog]
|
||||
; Full datalog.
|
||||
;
|
||||
; Default user-defined log emulates the full datalog.
|
||||
;
|
||||
; The entries are saved in the datalog file in the order in
|
||||
; which they appear in the list below.
|
||||
;
|
||||
; Channel - Case sensitive name of output channel to be logged.
|
||||
; Label - String written to header line of log. Be careful
|
||||
; about changing these, as programs like MSLVV and
|
||||
; MSTweak key off specific column names.
|
||||
; Type - Data type of output, converted before writing.
|
||||
; Format - C-style output format of data.
|
||||
;
|
||||
; Channel Label Type Format
|
||||
; -------------- ---------- ----- ------
|
||||
entry = time, "Time", float, "%.3f"
|
||||
entry = secl, "SecL", int, "%d"
|
||||
entry = rpm100, "RPM", int, "%d"
|
||||
entry = map, "MAP", int, "%d"
|
||||
entry = tpsADC, "TPS", int, "%d"
|
||||
entry = egoVoltage, "O2", float, "%.3f"
|
||||
entry = mat, "MAT", float, "%.1f"
|
||||
entry = coolant, "CLT", float, "%.1f"
|
||||
entry = engine, "Engine", int, "%d"
|
||||
entry = egoCorrection, "Gego", int, "%d"
|
||||
entry = airCorrection, "Gair", int, "%d"
|
||||
entry = warmupEnrich, "Gwarm", int, "%d"
|
||||
entry = baroCorrection, "Gbaro", int, "%d"
|
||||
entry = gammaEnrich, "Gammae", int, "%d"
|
||||
entry = accDecEnrich, "TPSacc", int, "%d"
|
||||
entry = veCurr, "Gve", int, "%d"
|
||||
entry = pulseWidth, "PW", float, "%.1f"
|
||||
entry = blank2, "Gve2", int, "%d"
|
||||
entry = pulseWidth, "PW2", float, "%.1f"
|
||||
entry = dutyCycle, "DutyCycle1", float, "%.1f"
|
||||
entry = dutyCycle, "DutyCycle2", float, "%.1f"
|
||||
entry = blank1, "tpsMin", int, "%d"
|
||||
entry = blank2, "tpsMax", int, "%d"
|
||||
entry = TPSdot, "TPS DOT", int, "%d"
|
|
@ -33,7 +33,7 @@
|
|||
#include "comms.h"
|
||||
#include "math.h"
|
||||
#include "corrections.h"
|
||||
#include "kartTimers.h"
|
||||
#include "timers.h"
|
||||
|
||||
#include "fastAnalog.h"
|
||||
#define DIGITALIO_NO_MIX_ANALOGWRITE
|
||||
|
@ -190,7 +190,7 @@ void loop()
|
|||
if ((micros() - toothLastToothTime) < 500000L) //Check how long ago the last tooth was seen compared to now. If it was more than half a second ago then the engine is probably stopped
|
||||
{
|
||||
noInterrupts();
|
||||
unsigned long revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
|
||||
unsigned long revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
|
||||
interrupts();
|
||||
currentStatus.RPM = fastDivide32(US_IN_MINUTE, revolutionTime); //Calc RPM based on last full revolution time
|
||||
}
|
||||
|
@ -201,9 +201,6 @@ void loop()
|
|||
currentStatus.hasSync = false;
|
||||
currentStatus.runSecs = 0; //Reset the counter for number of seconds running.
|
||||
secCounter = 0; //Reset our seconds counter.
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Uncomment the following for testing
|
||||
|
@ -216,40 +213,29 @@ void loop()
|
|||
//***SET STATUSES***
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
currentStatus.MAP = map(analogRead(pinMAP), 0, 1023, 0, 100); //Get the current MAP value
|
||||
//currentStatus.TPS = map(analogRead(pinTPS), 0, 1023, 255, 0); //Get the current TPS value
|
||||
currentStatus.TPS = map(analogRead(pinTPS), 0, 1023, 100, 0); //Get the current TPS value
|
||||
currentStatus.tpsADC = map(analogRead(pinTPS), 0, 1023, 0, 255); //Get the current raw TPS ADC value and map it into a byte
|
||||
currentStatus.TPS = map(currentStatus.tpsADC, configPage1.tpsMin, configPage1.tpsMax, 0, 100); //Take the raw TPS ADC value and convert it into a TPS% based on the calibrated values
|
||||
currentStatus.O2 = map(analogRead(pinO2), 0, 1023, 117, 358); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4, then multiplied by 16 (<< 4). This is the correct calibration for an Innovate Wideband 0v - 5V unit
|
||||
|
||||
//Always check for sync
|
||||
//Main loop runs within this clause
|
||||
if (currentStatus.hasSync)
|
||||
{
|
||||
if(currentStatus.RPM > 0) //Check if the engine is turning at all
|
||||
{
|
||||
//If it is, check is we're running or cranking
|
||||
if(currentStatus.RPM > configPage2.crankRPM)
|
||||
{ //Sets the engine running bit, clears the engine cranking bit
|
||||
BIT_SET(currentStatus.engine, 0);
|
||||
BIT_CLEAR(currentStatus.engine, 1);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{ //Sets the engine cranking bit, clears the engine running bit
|
||||
BIT_SET(currentStatus.engine, 1);
|
||||
BIT_CLEAR(currentStatus.engine, 0);
|
||||
currentStatus.runSecs = 0; //We're cranking (hopefully), so reset the engine run time to prompt ASE.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(currentStatus.RPM > 0) //Check if the engine is turning at all
|
||||
{
|
||||
//If it is, check is we're running or cranking
|
||||
if(currentStatus.RPM > configPage2.crankRPM)
|
||||
{ //Sets the engine running bit, clears the engine cranking bit
|
||||
BIT_SET(currentStatus.engine, 0);
|
||||
BIT_CLEAR(currentStatus.engine, 1);
|
||||
}
|
||||
else
|
||||
{ //Sets the engine cranking bit, clears the engine running bit
|
||||
BIT_SET(currentStatus.engine, 1);
|
||||
BIT_CLEAR(currentStatus.engine, 0);
|
||||
currentStatus.runSecs = 0; //We're cranking (hopefully), so reset the engine run time to prompt ASE.
|
||||
}
|
||||
}
|
||||
|
||||
//END SETTING STATUSES
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
@ -315,7 +301,6 @@ void loop()
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//************************************************************************************************
|
||||
|
|
29
storage.h
29
storage.h
|
@ -5,7 +5,7 @@ void writeConfig();
|
|||
void loadConfig();
|
||||
|
||||
/*
|
||||
Current layout of EEPROM data (Version 1) is as follows (All sizes are in bytes):
|
||||
Current layout of EEPROM data (Version 2) is as follows (All sizes are in bytes):
|
||||
|---------------------------------------------------|
|
||||
|Byte # |Size | Description |
|
||||
|---------------------------------------------------|
|
||||
|
@ -14,16 +14,16 @@ Current layout of EEPROM data (Version 1) is as follows (All sizes are in bytes)
|
|||
| 3 |64 | VE Map (8x8) |
|
||||
| 67 |8 | VE Table RPM bins |
|
||||
| 75 |8 | VE Table MAP/TPS bins |
|
||||
| 83 |45 | Remaining Page 1 settings |
|
||||
| 128 |2 | X and Y sizes for Ign table |
|
||||
| 130 |64 | Ignition Map (8x8) |
|
||||
| 194 |8 | Ign Table RPM bins |
|
||||
| 202 |8 | Ign Table MAP/TPS bins |
|
||||
| 210 |45 | Remaining Page 2 settings |
|
||||
| 83 |48 | Remaining Page 1 settings |
|
||||
| 131 |2 | X and Y sizes for Ign table |
|
||||
| 133 |64 | Ignition Map (8x8) |
|
||||
| 197 |8 | Ign Table RPM bins |
|
||||
| 205 |8 | Ign Table MAP/TPS bins |
|
||||
| 213 |45 | Remaining Page 2 settings |
|
||||
-----------------------------------------------------
|
||||
*/
|
||||
|
||||
#define EEPROM_SIZE 255
|
||||
#define EEPROM_SIZE 258
|
||||
|
||||
#define EEPROM_CONFIG1_XSIZE 1
|
||||
#define EEPROM_CONFIG1_YSIZE 2
|
||||
|
@ -31,9 +31,10 @@ Current layout of EEPROM data (Version 1) is as follows (All sizes are in bytes)
|
|||
#define EEPROM_CONFIG1_XBINS 67
|
||||
#define EEPROM_CONFIG1_YBINS 75
|
||||
#define EEPROM_CONFIG1_SETTINGS 83
|
||||
#define EEPROM_CONFIG2_XSIZE 128
|
||||
#define EEPROM_CONFIG2_YSIZE 129
|
||||
#define EEPROM_CONFIG2_MAP 130
|
||||
#define EEPROM_CONFIG2_XBINS 194
|
||||
#define EEPROM_CONFIG2_YBINS 202
|
||||
#define EEPROM_CONFIG2_SETTINGS 210
|
||||
#define EEPROM_CONFIG1_END 131
|
||||
#define EEPROM_CONFIG2_XSIZE 131
|
||||
#define EEPROM_CONFIG2_YSIZE 132
|
||||
#define EEPROM_CONFIG2_MAP 133
|
||||
#define EEPROM_CONFIG2_XBINS 197
|
||||
#define EEPROM_CONFIG2_YBINS 205
|
||||
#define EEPROM_CONFIG2_SETTINGS 213
|
||||
|
|
|
@ -40,7 +40,7 @@ void writeConfig()
|
|||
if(EEPROM.read(x) != fuelTable.axisY[offset]) { EEPROM.write(x, fuelTable.axisY[offset]); }
|
||||
}
|
||||
//The next 45 bytes can simply be pulled straight from the configTable
|
||||
for(int x=EEPROM_CONFIG1_SETTINGS; x<EEPROM_CONFIG2_XSIZE; x++)
|
||||
for(int x=EEPROM_CONFIG1_SETTINGS; x<EEPROM_CONFIG1_END; x++)
|
||||
{
|
||||
if(EEPROM.read(x) != *(pnt_configPage + byte(x - EEPROM_CONFIG1_SETTINGS))) { EEPROM.write(x, *(pnt_configPage + byte(x - EEPROM_CONFIG1_SETTINGS))); }
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void loadConfig()
|
|||
fuelTable.axisY[offset] = EEPROM.read(x);
|
||||
}
|
||||
//The next 45 bytes can simply be pulled straight from the configTable
|
||||
for(int x=EEPROM_CONFIG1_SETTINGS; x<EEPROM_CONFIG2_XSIZE; x++)
|
||||
for(int x=EEPROM_CONFIG1_SETTINGS; x<EEPROM_CONFIG1_END; x++)
|
||||
{
|
||||
*(pnt_configPage + byte(x - EEPROM_CONFIG1_SETTINGS)) = EEPROM.read(x);
|
||||
}
|
||||
|
|
40
timers.ino
40
timers.ino
|
@ -1,16 +1,15 @@
|
|||
|
||||
|
||||
|
||||
void initialiseTimers() {
|
||||
|
||||
void initialiseTimers()
|
||||
{
|
||||
//Configure Timer2 for our low-freq interrupt code.
|
||||
TCCR2B = 0x00; //Disbale Timer2 while we set it up
|
||||
TCNT2 = 99; //Preload timer2 with 100 cycles, leaving 156 till overflow.
|
||||
TIFR2 = 0x00; //Timer2 INT Flag Reg: Clear Timer Overflow Flag
|
||||
TIMSK2 = 0x01; //Timer2 Set Overflow Interrupt enabled.
|
||||
TCCR2A = 0x00; //Timer2 Control Reg A: Wave Gen Mode normal
|
||||
TCCR2B = ((1 << CS10) | (1 << CS11) | (1 << CS12)); //Timer2 Set Prescaler to 5 (101), 1024 mode.
|
||||
|
||||
TCCR2B = 0x00; //Disbale Timer2 while we set it up
|
||||
TCNT2 = 99; //Preload timer2 with 100 cycles, leaving 156 till overflow.
|
||||
TIFR2 = 0x00; //Timer2 INT Flag Reg: Clear Timer Overflow Flag
|
||||
TIMSK2 = 0x01; //Timer2 Set Overflow Interrupt enabled.
|
||||
TCCR2A = 0x00; //Timer2 Control Reg A: Wave Gen Mode normal
|
||||
TCCR2B = ((1 << CS10) | (1 << CS11) | (1 << CS12)); //Timer2 Set Prescaler to 5 (101), 1024 mode.
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,31 +27,24 @@ ISR(TIMER2_OVF_vect)
|
|||
if (loopGen == 25)
|
||||
{
|
||||
loopGen = 0; //Reset Counter.
|
||||
//250ms Code here.
|
||||
//INSERT 250ms Code here.
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Loop executed every 1 second (10ms x 100 = 1000ms)
|
||||
if (loopSec == 100)
|
||||
{
|
||||
loopSec = 0; //Reset counter.
|
||||
|
||||
|
||||
//If the engine is running or cranking, we need ot update the run time counter.
|
||||
if (((currentStatus.engine & ENGINE_RUN) || (currentStatus.engine & ENGINE_CRANK)))
|
||||
{ //NOTE - There is a potential for a ~1sec gap between engine crank starting and ths runSec number being incremented. This may delay ASE!
|
||||
if (currentStatus.runSecs <= 254) //Ensure we cap out at 255 and don't overflow. (which would reset ASE)
|
||||
currentStatus.runSecs ++; //Increment our run counter by 1 second.
|
||||
|
||||
}
|
||||
|
||||
|
||||
//If the engine is running or cranking, we need ot update the run time counter.
|
||||
if (((currentStatus.engine & ENGINE_RUN) || (currentStatus.engine & ENGINE_CRANK)))
|
||||
{ //NOTE - There is a potential for a ~1sec gap between engine crank starting and ths runSec number being incremented. This may delay ASE!
|
||||
if (currentStatus.runSecs <= 254) //Ensure we cap out at 255 and don't overflow. (which would reset ASE)
|
||||
{ currentStatus.runSecs++; } //Increment our run counter by 1 second.
|
||||
}
|
||||
|
||||
//Reset Timer2 to trigger in another ~10ms
|
||||
TCNT2 = 99; //Preload timer2 with 100 cycles, leaving 156 till overflow.
|
||||
TIFR2 = 0x00; //Timer2 INT Flag Reg: Clear Timer Overflow Flag
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue