Please enable JavaScript to view this site.

MaxxECU Documentation

ecu.get(channel) - Reads a raw (unscaled) integer RT-value from the ECU.

Parameter: "channel" (integer): RT-value index. Use RTDATA.* constants.

Returns: integer - the raw internal value with no unit conversion.

The MTune editor will autocomplete RTDATA.* constants (e.g., RTDATA.RPM, RTDATA.COOLANT_TEMP, RTDATA.LAMBDA, RTDATA.TPS).

Lua code:

local raw_rpm = ecu.get(RTDATA.RPM)

 

ecu.getf(channel) - Reads a scaled floating-point RT-value from the ECU, converted to real-world units (degrees, kPa, volts, etc.).

Parameter: "channel" (integer): RT-value index. Use RTDATA.* constants.

Returns: float - the value in engineering units.

Lua code:

local coolant = ecu.getf(RTDATA.COOLANT_TEMP)        - e.g., 92.3 (°C)

local lambda  = ecu.getf(RTDATA.LAMBDA)                        - e.g., 0.98

local rpm     = ecu.getf(RTDATA.RPM)                          - e.g., 3200.0

if coolant > 95.5 then

   print("Coolant high!")

end

 

get vs getf

Use ecu.getf() when you need to compare against real-world thresholds or display readable values.

Use ecu.get() when you want the raw integer for CAN transmission or maximum speed.

 

ecu.set(channel, value) - Writes a value to one of the 24 script RT-value slots. These appear in MTune as real-time values and can be used in logging, tables, and other ECU functions.

Parameters:

"channel"(integer): Slot number 1-24, or absolute RT index RTDATA.SCRIPT_1 through RTDATA.SCRIPT_24.

"value"(integer or float): The value to store. Integers are stored directly (clamped to int16 range). Floats are automatically scaled by the parameter's inverse scale factor before storage.

Returns: Nothing.

Lua code:

-- Store a raw integer into script RT slot 1

ecu.set(1, 1234)

 

-- Store a float (auto-scaled) into script RT slot 2

ecu.set(2, 98.6)

 

-- Using the absolute RTDATA constant

ecu.set(RTDATA.SCRIPT_1, 500)

 

Note: Values are clamped to the int16 range (−32768 to 32767) after scaling.

 

 

For more information about the MaxxECU user scripts, see User Scripts (LUA), or directly reference the LUA api reference and LUA examples. For more all available LUA settings and options, see Script Code, Script Input Control, Output Functions and Script RT values.