As outline in the ECU Definition document, TunerStudio supports resizable 2D tables with firmware support.
Here is a sample project, with an ini file defining Tables that are dynamically sized.
Conceptually, the firmware would have integers defined for the number of rows and number of columns. Those variables are used as the array sizes on both TunerStudio and with the firmware. Once configured in this way, TunerStudio will automatically display options for a user to insert or delete rows and columns as well as to resize the table. In any of these cases TunerStudio will interpolate the values for the new rows or columns.
All changes will trigger TunerStudio to push the entire new table to the firmware.
From the Ecu Definition Document:
Dynamically sized tables are no different in the TableEditor section, but the underlying Constants are sized based on expressions as described in the Ecu Definition "INI" file
When a Table is configured to be resizable, the UI will manage the table values for any applied new size.
On any resize event, the values are captured, the table resized, the new values are applied and sent to the box.
In the table widget, the following resize actions are available:
- Insert Column Before Selected
- Insert Column After Selected
- Insert Row Above Selected
- Insert Row Below Selected
- Delete Selected Row
- Delete selected Column
- Resize Table - Set the table to a specific number of rows and columns. The current table will then be interpolated to this new shape.
Each of these options are available if currently valid.
This feature requires ini spec 3.53 is supported by the application.
Here is what needs to be changed in the ini:
; Create to new scalar Constants that will represent the array dimensions.
; These must be defined anywhere above the arrays in the ini file.
; The min and max for these constants will drive the minimum and maximum allowed rows and columns.
FUEL_TABLE_ROWS = scalar, U08, 0, "", 1.0, 0, 8.0, 32.0, 0
FUEL_TABLE_COLS = scalar, U08, 1, "", 1.0, 0, 8.0, 32.0, 0
; use the Dimension Constants to set the array size.
FUEL_RPM_AXIS = array, U16, 2, [{FUEL_TABLE_COLS}], "", 1, 0, 0, 15000, 0
FUEL_LOAD_AXIS = array, U16, 66, [{FUEL_TABLE_ROWS}], "", 0.1, 0, 20.0, 1000.0, 1
veTable1 = array, U16, 130, [{FUEL_TABLE_COLS}x{FUEL_TABLE_ROWS}], "%", 0.1, 0,0.0, 200.0, 1
The application will detect that these tables are sized based on the constants and enabled the resize actions in the widget. The dimensions of the arrays should be a single constant for the resizing tools to be enabled.
Default values for FUEL_TABLE_ROWS and FUEL_TABLE_COLS should be defined in the [ConstantsExtensions] section as demonstrated below. This is required for the table to have a valid size prior to loading a saved calibration or connecting to an ECU.
The min and max number of rows will be driven by the min and max of FUEL_TABLE_ROWS as well as maximumElements for the Z Axis.
The min and max number of columns will be driven by the min and max of FUEL_TABLE_COLS as well as maximumElements for the Z Axis.
The start address / offset for each of the Constants will remain constant, but the size will vary based on the values of FUEL_TABLE_COLS and FUEL_TABLE_ROWS.
This can be configured to alter the start upon request.
By default, as maximumElements for the Z Axis will be determined based on the available memory before the next defined Constant. For example, veTable 1 has a starting address of 130 on the page, if the next Constant on that page has an offset of 706, 576 will be used as the maximumElements.
The maximumElements can be over-ridden by creating an entry in the [ConstantsExtension] section:
[ConstantsExtensions]
maximumElements = veTable1, 576
defaultValue = FUEL_TABLE_ROWS, 16 ; the default number of rows used for VE Table 1.
defaultValue = FUEL_TABLE_COLS, 16 ; the default number of columns used for VE Table 1.
In this example the maximumElements is defined as 576, this is enough for a 24x24 table in a typical configuration. However as the min and max for FUEL_TABLE_ROWS and FUEL_TABLE_COLS are set to 8 and 32, the application user will be able to resize a table to any dimension between 8x32 to 32x8 where:
FUEL_TABLE_ROWS * FUEL_TABLE_COLS < 576