Required: TunerStudio version 1.42 or higher
Available in Lite! version: Yes
2 new concepts are introduced in TunerStudio to handle custom commands.
Firmware developers can define in the ECU Definition file (ini) custom commands to be sent to the controller. Using standard ini format a set of bytes can be defined to be sent as a command.
In the [ControllerCommands] section of the ini a custom command can be assigned a single or chain of commands that will be sent sequentially.
To initiate the sending of these bytes, a new dialog UI widget has been added.
commandButton = "Label Text", command, { Enabled Condition }, optionalFlags
A commandButton can be added to any UserDefined dialog the same as a field, panel, gauge or live graph. When the dialog is rendered, a commandButton will be displayed as a Button with the defined label and enabled condition. When clicked, the assigned custom command will be initiated.
Note, this ini file snippet is using the existing capabilities of MS3 alpha 21. Upcoming firmwares are expected to use different commands, please reference the current ini if you are looking at this specific Test Mode functionality.
ini file snippet:
[ControllerCommands]
; commandName = command1, command2, commandn...
; command in standard ini format, a command name can be assigned to 1 to n commands that will be executed in order.
; This dos not include any resultant protocol envelope data, only the response data itself.
; WARNING!! These commands bypass TunerStudio's normal memory syncronization. If these commands
; alter mapped settings (Constant) memory in the controller, TunerStudio will have an out of sync condition
; and may create error messages.
; It is expected that these commands would not typically alter any ram mapped to a Constant.
cmdReadLogData = "r\$tsCanId\xf2\x00\x00\x04\x00";
; In this example, this will alter memory mapped in TS, this should not be done.
; It is expected that this command would not alter RAM within TunerStudio's scope.
cmdTestMode = "w\$tsCanId\x05\x00\x00\x00\x02\x30\x39"
cmdBurnPg2 = "b\$tsCanId\x05"
; a command can also be a chain of commands, they can be references to commands or string based
cmdEnterTestMode = cmdTestMode, cmdBurnPg2
; command chain with unreferenced commad
cmdStopTestmode = "w\$tsCanId\x05\x00\x00\x00\x02\x00\x00", cmdBurnPg2
[UserDefined]
; This is the Test Mode dialog from MS3 alpha altered to used 2 commandButton
; objects for starting and stopping test mode.
dialog = outputTestbuttons, "Test Mode Controls", xAxis
;commandButton = "Label Text", command, { Enabled Condition }, optionalFlags
; The rem > 0 expression is just for testing.. It works when the MS is on the Stim with rpm.
; a status bit there would be the expected real expression
commandButton = "Start Test Mode", cmdEnterTestMode, { rpm > 0 }
; if clickOnCloseIfEnabled is set, then the command assigned to this button will be run on the
; dialog close, but only if the enable condition is true
; valid click flags are:
; clickOnCloseIfEnabled - the command will be sent on dialog close if active condition is true
; clickOnCloseIfDisabled - the command will be sent on dialog close if active condition is false
; clickOnClose - the command will be sent on dialog close always
commandButton = "Stop Test Mode", cmdStopTestmode, { rpm == 0 }, clickOnCloseIfEnabled
dialog = outputtest_l, "Output test modes", yAxis
field = "Fuel pump", testop_fp
field = "Test mode", testmode
field = "Output interval", testint
field = "Coil testing mode", testop_coil, { testmode == 1 }
field = "Coil output to test", testsel_coil, {testmode == 1}
field = "Dwell", testdwell, { testmode == 1 }
field = "Injector testing mode", testop_inj, { testmode == 2 }
field = "Injector channel to test", testsel_inj, {testmode == 2}
field = "Pulsewidth", testpw, { testmode == 2 }
field = "Total number of injections", testinjcnt, {testmode == 2}
field = "-"
field = "Note: The following only applies to Inj1 and Inj2"
field = "Injector PWM parameters", testop_pwm, { testmode == 2 }
field = "PWM Current Limit", testinjPwmP, { testmode == 2 && testop_pwm }
field = "PWM Time Threshold", testinjPwmT, { testmode == 2 && testop_pwm }
field = "Injector PWM Period", testinjPwmPd , { testmode == 2 && testop_pwm }
dialog = outputtest_controls, "Output test modes", border
panel = outputTestbuttons, North
panel = outputtest_l, South
dialog = outputtest_r, "Reference gauges", yAxis
gauge = voltMeter, North
gauge = injcountGauge, South
dialog = outputtest, "", xAxis
panel = outputtest_controls
panel = outputtest_r
; ------ END INI Snippet -------
The rendered Dialog will appear as: