;------------------------------------------------------------------------------- [MegaTune] MTversion = 2.25 ; MegaTune itself; needs to match exec version. queryCommand = "Q" ; B&G embedded code version 2.0/2.98x/3.00 signature = 20 ; Versions above return a single byte, 20T. ;------------------------------------------------------------------------------- [Constants] ;---------------------------------------------------------------------------- ; Constants Definition ; -------------------- ; ; Scalar Values ; ------------- ; The scaling and translation values are used as follows: ; msValue = userValue / scale - translate ; userValue = (msValue + translate) * scale ; ; I've got no good way to handle a few of these things yet. ; ; Temperatures are fine, check out the Fielding IAC example (fastIdleT). ; ; The TPS stuff is a problem, because we have to modify the ini file for ; each TPS installation and again whenever we move the TPS... I figured ; out a moderately palatable solution to presenting the frequency ; divider in the boost control values, turn it into a bit field and then ; enumerate the resulting frequencies. ; ; 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 = 1 burnCommand = "B" pageSize = 125 pageActivationDelay = 10 ; pageActivate = "" pageReadCommand = "V" pageValueWrite = "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 crankCold = scalar, U08, 64, "ms", 0.1, 0.0, 0.0, 25.5, 1 crankHot = scalar, U08, 65, "ms", 0.1, 0.0, 0.0, 25.5, 1 asePct = scalar, U08, 66, "%", 1.0, 0.0, 0.0, 95.0, 0 aseCount = scalar, U08, 67, "", 1.0, 0.0, 0.0, 254.0, 0 wueBins = array, U08, 68, [ 10], "%", 1.0, 0.0, 100.0, 255.0, 0 taeBins = array, U08, 78, [ 4], "ms", 0.1, 0.0, 0.0, 25.5, 1 taeColdA = scalar, U08, 82, "ms", 0.1, 0.0, 0.0, 25.5, 1 tpsThresh = scalar, U08, 83, "v/s",0.1953125, 0.0, 0.2, 49.8, 3 taeTime = scalar, U08, 84, "ms", 0.1, 0.0, 0.0, 25.5, 1 tdePct = scalar, U08, 85, "%", 1.0, 0.0, 0.0, 255.0, 0 #if CELSIUS egoTemp = scalar, U08, 86, "°C", 0.555, -72, -40, 102.0, 0 #else egoTemp = scalar, U08, 86, "°F", 1.0, -40, -40, 215.0, 0 #endif egoCount = scalar, U08, 87, "", 1.0, 0.0, 0.0, 255.0, 0 egoDelta = scalar, U08, 88, "%", 1.0, 0.0, 0.0, 255.0, 0 egoLimit = scalar, U08, 89, "%", 1.0, 0.0, 0.0, 255.0, 0 reqFuel = scalar, U08, 90, "ms", 0.1, 0.0, 0.0, 25.5, 1 divider = scalar, U08, 91, "", 1.0, 0.0 alternate = bits, U08, 92, [0:0], "Simultaneous", "Alternating" injOpen = scalar, U08, 93, "ms", 0.1, 0.0, 0.1, 25.5, 1 injOCfuel = scalar, U08, 94, "ms", 0.1, 0.0, 0.0, 0.0, 0 injPwmP = scalar, U08, 95, "%", 1.0, 0.0, 0.0, 100.0, 0 injPwmT = scalar, U08, 96, "ms", 0.1, 0.0, 0.0, 25.5, 1 battFac = scalar, U08, 97, "ms/v",0.0166667, 0.0, 0.0, 1.0, 2 rpmk = scalar, U16, 98, "", 1.0, 0.0 rpmBins = array, U08, 100, [ 8], "RPM", 100.0, 0.0, 100.0, 25500.0, 0 #if SPEED_DENSITY mapBins = array, U08, 108, [ 8], "kPa", 1.0, 0.0, 0.0, 255.0, 0 #elif ALPHA_N tpsBins = array, U08, 108, [ 8], "TPS", 1.0, 0.0, 0.0, 255.0, 0 #elif AIR_FLOW_METER #error "MSnS does not support MAF" #exit #endif ; 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] ; Config3 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 ;------------------------------------------------------------------------------- [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" subMenu = veTableTbl, "&VE Table" menu = "&Tuning" subMenu = std_realtime, "&Realtime Display" subMenu = std_warmup, "&Warmup Wizard" subMenu = veTableMap, "&VE Table" ;------------------------------------------------------------------------------- [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, tpsADC #endif zBins = veTable gridHeight = 2.0 gridOrient = 250, 0, 340 ; Space 123 rotation of grid in degrees. upDownLabel = "(RICHER)", "(LEANER)" ;------------------------------------------------------------------------------- [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 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 ;------------------------------------------------------------------------------- [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 = tpsADCGauge #endif gauge3 = pulseWidthGauge gauge4 = dutyCycleGauge gauge5 = mapGauge gauge6 = matGauge #unset OLD_STYLE_FRONT_PAGE #if OLD_STYLE_FRONT_PAGE #log "Old style gauges enabled" gauge7 = BGpw2Gauge ; Use these two for backward compatibility with older releases of MT, gauge8 = BGdc2Gauge ; or do something useful with them now. #else gauge7 = cltGauge gauge8 = gammaEnrichGauge #endif ;------------------------------------------------------------------------------- [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. ochBlockSize = 22 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 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 blank3 = scalar, U08, 21 ; 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") } 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 } ;------------------------------------------------------------------------------- [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 = throttle, "TP", 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, "UserData1", int, "%d" entry = blank2, "UserData2", int, "%d" entry = blank3, "UserData3", int, "%d"