Speeduino
Loading...
Searching...
No Matches
Files | Classes | Macros | Typedefs | Enumerations | Functions | Variables
3D Tables

Structures and functions related to 3D tables, such as VE, Spark Advance, AFR etc. More...

Files

file  table3d.h
 3D table data types and functions
 
file  table3d_axes.h
 3D table axis types and iterators
 
file  table3d_axis_io.h
 3D table axis I/O support
 
file  table3d_typedefs.h
 Typedefs for primitive 3D table elements.
 
file  table3d_values.h
 3D table value structs and iterators
 

Classes

class  table_axis_iterator
 Iterate over table axis elements. More...
 
struct  table3d_axis_io_converter
 Convert a 16-bit value to/from a byte. Useful for I/O. More...
 
class  table_row_iterator
 Iterate through a table row. I.e. constant Y, changing X. More...
 
class  table_value_iterator
 Iterate through a tables values, row by row. More...
 

Macros

#define CAT_HELPER(a, b)   a ## b
 
#define CONCAT(A, B)   CAT_HELPER(A, B)
 

Typedefs

typedef uint8_t byte
 Byte type. This is not defined in any C or C++ standard header.
 
typedef byte(* pToByteConverter) (int16_t value)
 Models int16->byte conversion.
 
typedef int16_t(* pFromByteConverter) (byte in)
 Models byte->int16 conversion.
 
using table3d_dim_t = uint8_t
 Encodes the length of the axes.
 
using table3d_value_t = uint8_t
 The type of each table value.
 
using table3d_axis_t = int16_t
 The type of each axis value.
 

Enumerations

enum  table_type_t { table_type_None , TABLE3D_GEN_TYPEKEY =(6, Rpm, Load,) TABLE3D_GEN_TYPEKEY (4, Rpm, Load,) TABLE3D_GEN_TYPEKEY (8, Rpm, Load,) TABLE3D_GEN_TYPEKEY (8, Rpm, Tps,) TABLE3D_GEN_TYPEKEY (16, Rpm, Load,) , TABLE3D_GEN_TYPEKEY =(6, Rpm, Load,) TABLE3D_GEN_TYPEKEY (4, Rpm, Load,) TABLE3D_GEN_TYPEKEY (8, Rpm, Load,) TABLE3D_GEN_TYPEKEY (8, Rpm, Tps,) TABLE3D_GEN_TYPEKEY (16, Rpm, Load,) }
 Table type identifiers. Limited compile time RTTI. More...
 
enum  axis_domain { axis_domain_Rpm , axis_domain_Load , axis_domain_Tps }
 Encodes the real world measurement that a table axis captures. More...
 

Functions

table_axis_iterator x_begin (void *pTable, table_type_t key)
 
table_axis_iterator x_rbegin (void *pTable, table_type_t key)
 
table_axis_iterator y_begin (void *pTable, table_type_t key)
 
table_axis_iterator y_rbegin (void *pTable, table_type_t key)
 
table3d_axis_io_converter get_table3d_axis_converter (axis_domain domain)
 Obtain a converter instance for a given axis domain.
 

Variables

 Rpm
 
 Load
 
 Tps
 
table_type_t key
 

Detailed Description

Structures and functions related to 3D tables, such as VE, Spark Advance, AFR etc.

Logical:

E.g. for a 3x3 table, this is what the TS table editor would show:

     Y-Max    V6      V7      V8
     Y-Int    V3      V4      V5
     Y-Min    V0      V1      V2
             X-Min   X-Int   X-Max

In memory, we store rows in reverse:

I.e.

     Y-Min    V0      V1      V2
     Y-Int    V3      V4      V5
     Y-Max    V6      V7      V8
             X-Min   X-Int   X-Max

Macro Definition Documentation

◆ CAT_HELPER

#define CAT_HELPER (   a,
  b 
)    a ## b

◆ CONCAT

#define CONCAT (   A,
  B 
)    CAT_HELPER(A, B)

Typedef Documentation

◆ byte

Byte type. This is not defined in any C or C++ standard header.

◆ pFromByteConverter

typedef int16_t(* pFromByteConverter) (byte in)

Models byte->int16 conversion.

See also
table3d_axis_io_converter

◆ pToByteConverter

typedef byte(* pToByteConverter) (int16_t value)

Models int16->byte conversion.

See also
table3d_axis_io_converter

◆ table3d_axis_t

The type of each axis value.

◆ table3d_dim_t

Encodes the length of the axes.

◆ table3d_value_t

The type of each table value.

Enumeration Type Documentation

◆ axis_domain

Encodes the real world measurement that a table axis captures.

Enumerator
axis_domain_Rpm 

RPM (engine speed)

axis_domain_Load 

Load

axis_domain_Tps 

Throttle position

◆ table_type_t

Table type identifiers. Limited compile time RTTI.

With no virtual functions (they have quite a bit of overhead in both space & time), we have to pass void* around in certain cases. In order to cast that back to a concrete table type, we need to somehow identify the type.

Once approach is to register each type - but that requires a central registry which will use RAM.

Since we have a compile time fixed set of table types, we can map a unique identifier to the type via a cast - this enum is that unique identifier.

Typically used in conjunction with the 'CONCRETE_TABLE_ACTION' macro

Enumerator
table_type_None 

Function Documentation

◆ get_table3d_axis_converter()

table3d_axis_io_converter get_table3d_axis_converter ( axis_domain  domain)

Obtain a converter instance for a given axis domain.

Often we need to deal internally with values that fit in 16-bits but do not require much accuracy. E.g. RPM. For these values we can save storage space (EEPROM) by scaling to/from 8-bits.

The converter is dependent on the domain. I.e all axes with the same domain use the same converter

Conversion during I/O is orthogonal to other axis concerns, so is separated and encapsulated here.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ x_begin()

table_axis_iterator x_begin ( void pTable,
table_type_t  key 
)

Convert page iterator to table x axis iterator.

Here is the call graph for this function:

◆ x_rbegin()

table_axis_iterator x_rbegin ( void pTable,
table_type_t  key 
)
Here is the call graph for this function:

◆ y_begin()

table_axis_iterator y_begin ( void pTable,
table_type_t  key 
)

Convert page iterator to table y axis iterator.

Here is the call graph for this function:

◆ y_rbegin()

table_axis_iterator y_rbegin ( void pTable,
table_type_t  key 
)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ key

◆ Load

Load

◆ Rpm

Rpm

◆ Tps

Tps