1 /* A formal definition of how the data objects are structured and how to interpret them */
2 { "$schema":{"$ref":"http://www.diyefi.org/InterfaceStructureDescriptions.JSONSchema"},
3 /* The four part interface versioning scheme */
4 "InterfaceVersionUniqueIdentifier": "IFreeEMS Vanilla",
5 "InterfaceVersionUniqueMajor": 0,
6 "InterfaceVersionUniqueMinor": 0,
7 "InterfaceVersionUniqueRevision": 1,
8 /* For megasquirt use the numeric version is not relevant. */
10 {"Key": "Character", "Length": 1, "LabelCount": 1, "Name": "Character"},
11 {"Key": "BitFieldByte", "Length": 1, "LabelCount": 8, "Name": "Boolean Array[8]"},
12 {"Key": "BitFieldWord", "Length": 2, "LabelCount": 16, "Name": "Boolean Array[16]"},
13 {"Key": "BitFieldLong", "Length": 4, "LabelCount": 32, "Name": "Boolean Array[32]"},
14 {"Key": "SignedByte", "Length": 1, "LabelCount": 1, "Name": "Integer Signed Char"},
15 {"Key": "SignedWord", "Length": 2, "LabelCount": 1, "Name": "Integer Signed Short"},
16 {"Key": "SignedLong", "Length": 4, "LabelCount": 1, "Name": "Integer Signed Long"},
17 {"Key": "UnsignedByte", "Length": 1, "LabelCount": 1, "Name": "Integer Unsigned Char"},
18 {"Key": "UnsignedWord", "Length": 2, "LabelCount": 1, "Name": "Integer Unsigned Short"},
19 {"Key": "UnsignedLong", "Length": 4, "LabelCount": 1, "Name": "Integer Unsigned Long"}
21 /* &&&&&&&&&&&&&& Transformation of the raw data stream. &&&&&&&&&&&&&& */
23 /* Character is just that, an unsigned byte interpreted as per the ISO */
24 /* standard character encoding for the latin character set, ISO-8859-1. */
26 /* Bitfields are normal unsigned integers interpreted as a series of */
27 /* bits representing one boolean flag each. As per the C standard zero */
28 /* is considered 'false' and 1 considered 'true'. */
30 /* Integer types are either signed or unsigned, where the signed */
31 /* representation is the standard two's complement format. */
33 /* The data transmitted by FreeEMS is sent in as a structured binary */
34 /* stream in the form of sequential raw values. While some of these can */
35 /* be read directly at face value simply by interpretting them as their */
36 /* basic data type, most require transformation before they can be used */
37 /* to understand the state of engine and other operating parameters. */
39 /* The first stage is to interpret a piece of the binary stream as a */
40 /* raw value. There are two examples are given below, one signed and */
41 /* the other unsigned. */
43 /* If the data type is SignedByte and a single byte is received, 0xAC */
44 /* it must be converted from two's complement : */
47 /* 0xAB ^ 0xFF = 0x54 */
50 /* If the data type is UnsignedWord and two bytes are received, 0x76 */
51 /* first and 0x3F second giving us 0x01CE then : */
55 /* Now suppose this is supposed to be a Lambda value, clearly it isn't */ */
56 /* correct as it stands. */
58 /* A human readable value can be calculated using the offset and ratio */
59 /* in the following way : */
61 /* ratio = between the raw value after offset is applied human value */
62 /* offset = between the value sent and one that is scalable */
63 /* raw value = numeric value of the data interpretted as its basic type */
64 /* human value = a meaningful figure representing the quantity involved */
66 /* [human value] = ( [raw value] + [offset] ) * [ratio] */
68 /* Using our previous example we can assume it was a temperature with */
69 /* the following attributes : */
74 /* raw value = 30271 */
76 /* human value = (30271 - 27315) * 0.01 */
77 /* human value = 2956 * 0.01 */
78 /* human value = 29.56 */
80 /* temperature = 29.56 °C */
82 /* Twenty nine and a half degrees celcius is fairly typical for a turbo */
83 /* application assuming a reasonable ambient air temperature and fairly */
84 /* efficient intercooler setup. */
89 "Description": "Large variable size, three dimensional table (typically RPM, Load, VE/Lambda/Timing/etc).",
93 "Name": "RPM Axis Length",
94 "Description": "How many RPM axis cells this table has.",
95 "Primitive": "UnsignedShort",
100 "Name": "Load Axis Length",
101 "Description": "How many Load axis cells this table has.",
102 "Primitive": "UnsignedShort",
108 "Description": "The RPM axis values.",
109 "Primitive": "UnsignedShort",
110 "TransformDivisor": 2, /* 0 - 32767.5, 0.5 */
116 "Description": "The Load axis values.",
117 "Primitive": "UnsignedShort",
118 "TransformDivisor": 100, /* 0 - 655.35, 0.01 */
124 "Description": "The Volumetric Efficiency table values.",
125 "Primitive": "UnsignedShort",
126 "TransformDivisor": 500, /* 0 - 131.07, 0.002 */
133 "Key": "LambdaTable",
134 "Name": "Lambda Table",
135 "Description": "Large variable size, three dimensional table (RPM, Load, Lambda).",
139 "Name": "RPM Axis Length",
140 "Description": "How many RPM axis cells this table has.",
141 "Primitive": "UnsignedShort",
146 "Name": "Load Axis Length",
147 "Description": "How many Load axis cells this table has.",
148 "Primitive": "UnsignedShort",
154 "Description": "The RPM axis values.",
155 "Primitive": "UnsignedShort",
156 "TransformDivisor": 2, /* 0 - 32767.5, 0.5 */
162 "Description": "The Load axis values.",
163 "Primitive": "UnsignedShort",
164 "TransformDivisor": 100, /* 0 - 655.35, 0.01 */
169 "Name": "Lambda Table",
170 "Description": "The Lambda table values.",
171 "Primitive": "UnsignedShort",
172 "TransformDivisor": 32768, /* 0 - 2.0, 0.00003 */