FreeEMS
0.2.0-SNAPSHOT-285-g028e24c
|
Go to the source code of this file.
Macros | |
#define | EXTERN extern |
Functions | |
unsigned short | lookupTwoDTableUS (twoDTableUS *, unsigned short) TEXT |
Two D table read function. | |
unsigned short | lookupMainTable (unsigned short, unsigned short, unsigned short) TEXT |
Main table read function. | |
unsigned short | validateTwoDTable (twoDTableUS *) TEXT |
Validate a two D table. | |
unsigned short | validateMainTable (mainTable *) TEXT |
Validate a main table. |
Definition in file tableLookup.h.
#define EXTERN extern |
Definition at line 48 of file tableLookup.h.
unsigned short lookupTwoDTableUS | ( | twoDTableUS * | Table, |
unsigned short | Value | ||
) |
Two D table read function.
Looks up a value from a two D table using interpolation.
Table | is a pointer to the table to read from. |
Value | is the position value used to lookup the return value. |
Definition at line 203 of file tableLookup.c.
References twoDTableUS::Axis, and twoDTableUS::Values.
Referenced by calculateFuelAndIgnition(), decodePacketAndRespond(), generateDerivedVars(), and main().
unsigned short lookupMainTable | ( | unsigned short | realRPM, |
unsigned short | realLoad, | ||
unsigned short | locationID | ||
) |
Main table read function.
Looks up a value from a main table using interpolation.
The process :
Take a table with two movable axis sets and two axis lengths, loop to find which pairs of axis values and indexs we are between, interpolate two pairs down to two values, interpolate two values down to one value.
Table size :
To reduce the table size from 19x24 to something smaller, simply reduce the RPMLength and LoadLength fields to lower values. Increasing the size of either axis is not currently possible.
Values outside the table :
Given that the axis lists are in order, a data point outside the table will give the value adjacent to it, and one outside one of the four corners will give the corner value. This is a clean and reasonable behaviour in my opinion.
Reminder : X/RPM is horizontal, Y/Load is vertical
realRPM | is the current RPM for which a table value is required. |
realLoad | is the current load for which a table value is required. |
locationID | the ID to use to get the memory information to look up the table. |
May go back to these: old param RAMPage is the RAM page that the table is stored in. old param Table is a pointer to the table to read from.
Definition at line 112 of file tableLookup.c.
References block_is_main_table, blockDetails::flags, mainTable::Load, mainTable::LoadLength, lookupBlockDetails(), blockDetails::RAMAddress, blockDetails::RAMPage, RPAGE, mainTable::RPM, mainTable::RPMLength, and mainTable::Table.
Referenced by calculateFuelAndIgnition(), and generateDerivedVars().
unsigned short validateTwoDTable | ( | twoDTableUS * | Table | ) |
Validate a two D table.
Check that the order of the axis values is correct and therefore that the table is valid too.
Table | is a pointer to the table to be validated. |
Definition at line 280 of file tableLookup.c.
References twoDTableUS::Axis, invalidTwoDTableAxisOrder, and TWODTABLEUS_LENGTH.
Referenced by decodePacketAndRespond().
unsigned short validateMainTable | ( | mainTable * | Table | ) |
Validate a main table.
Check that the configuration of the table is valid. Assumes pages are correctly set.
Table | is a pointer to the table to be validated. |
Definition at line 240 of file tableLookup.c.
References invalidMainTableLoadLength, invalidMainTableLoadOrder, invalidMainTableMainLength, invalidMainTableRPMLength, invalidMainTableRPMOrder, mainTable::Load, mainTable::LoadLength, MAINTABLE_MAX_LOAD_LENGTH, MAINTABLE_MAX_MAIN_LENGTH, MAINTABLE_MAX_RPM_LENGTH, mainTable::RPM, and mainTable::RPMLength.
Referenced by decodePacketAndRespond().