Removed an empty header file, documented all header files that required it, added...
[freeems-vanilla.git] / src / inc / FixedConfigs.h
blob1cfd5954992b6d8ca174c68057ac89c0a429d8a1
1 /* Copyright 2008 Fred Cooke
3 This file is part of the FreeEMS project.
5 FreeEMS software is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 FreeEMS software is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
18 We ask that if you make any changes to this file you email them upstream to
19 us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
21 Thank you for choosing FreeEMS to run your engine! */
24 /** @file FixedConfigs.h
25 * @ingroup allHeaders
26 * @ingroup globalHeaders
28 * @brief Struct typedefs for fixed configuration
30 * This file contains the struct data type definitions for fixed configuration items.
32 * Fixed, in this context means that it typically is not tuned in a live way
33 * and therefore should not be cached in RAM while running. Usually these are
34 * values that do not change such as cylinder volume, injector size, cylinder
35 * count and other constants related to physical aspects of the engine setup.
36 * When adding configuration values, please consider adding them here first.
37 * If a value doesn't need to be live tunable definitely put it here instead.
39 * @author Fred Cooke
43 /* Header file multiple inclusion protection courtesy eclipse Header Template */
44 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */
45 #ifndef FILE_FIXED_CONFIGS_H_SEEN
46 #define FILE_FIXED_CONFIGS_H_SEEN
49 /**
50 * One of two structs of fixed configuration data such as physical parameters etc.
51 * If you add something here, please ensure you update all of the following :
52 * - Default values in the initial definitions in FixedConfig1.c and FixedConfig2.c
53 * - The lookupBlockDetails() function in blockDetailsLookup.c
54 * - The JSON data map and other related firmware interface definition files
56 * @todo TODO split this up!
57 * @todo TODO add doxy comments for each element of the struct
59 typedef struct {
61 /* Settings variables : 0 = false */
62 unsigned short coreSettingsA; /* Each bit represents the state of some core setting, masks below and above where the same one is used */
63 /* Bit masks for coreSettingsA */ // TODO needs a rename, as does coreStatusA
64 //#define COREA1 BIT1_16 /* 1 */
65 #define PRIMARY_POLARITY BIT2_16 /* 2 1 = high teeth 0 = low teeth */
66 #define SECONDARY_POLARITY BIT3_16 /* 3 1 = high teeth 0 = low teeth */
67 //#define COREA4 BIT4_16 /* 4 */
68 //#define FUEL_CUT BIT5_16 /* 5 Remove injection completely */
69 //#define HARD_SPARK_CUT BIT6_16 /* 6 Remove ignition completely */
70 //#define SOFT_SPARK_CUT BIT7_16 /* 7 Remove ignition events round robin style */
71 //#define SPARK_RETARD BIT8_16 /* 8 Retard ignition in RPM dependent way */
72 #define STAGED_ON BIT9_16 /* 9 Whether we are firing the staged injectors */
73 #define STAGED_START BIT10_16 /* 10 1 = Fixed start 0 = Scheduled start */
74 #define STAGED_END BIT11_16 /* 11 1 = Fixed end 0 = Scheduled end */
75 //#define COREA12 BIT12_16 /* 12 */
76 //#define COREA13 BIT13_16 /* 13 */
77 //#define COREA14 BIT14_16 /* 14 */
78 //#define COREA15 BIT15_16 /* 15 */
79 //#define COREA16 BIT16_16 /* 16 */
82 /* Pre configured value settings for the sensor inputs */
83 unsigned short presetIAT;
84 unsigned short presetCHT;
85 unsigned short presetTPS;
86 unsigned short presetEGO;
87 unsigned short presetBRV;
88 unsigned short presetMAP;
89 unsigned short presetAAP;
90 unsigned short presetMAT;
91 unsigned short presetEGO2;
92 unsigned short presetIAP;
93 unsigned short presetBPW; /* Base Pulse Width */
94 unsigned short presetAF; /* Air Flow */
97 /* Fuel injection settings TODO duplication from original temp code below!! */
98 unsigned short perCylinderVolume; /* 500cc = 0.5l 0.5 * 32768 = pcv, so divide by 32768 go get litres */
99 unsigned short stoichiometricAFR; /* 34 for hydrogen, all others less, figure is 14.7 * 1024, divide by 1024 to get AFR */
100 unsigned short injectorFlow; /* Injector flow of 240cc/min / 60 is 4ml/second is multiplied by 1024, so divide by 1024 for ml/second, divide by 1000 for litres/second */
101 unsigned short densityOfFuelAtSTP; /* 703gm/litre for Octane. 32 * fuel density = number, divide by 32 for the real figure */
103 /* Sensor related settings */
104 unsigned short TPSClosedMAP;
105 unsigned short TPSOpenMAP;
108 /* Sensor input conditioning settings */
109 /* These are used to calculate MAP, EGO and TPS from ADC readings. */
111 /* For MAP, default to MPX4250A 260kPa - 8kPa = 252kPa See the link for the transfer function*/
112 unsigned short MAPMinimum; /* 0 kPa usually. */
113 unsigned short MAPRange; /* 10000, 11500, 25000, 30000, 40000 etc (/100 for kPa) */
115 /* For AAP, default to MPX4100A 107.5kPa - 14kPa = 93.5kPa See the link for the transfer function */
116 unsigned short AAPMinimum; /* 0 kPa usually. */
117 unsigned short AAPRange; /* 10000, 11500, 25000, 30000, 40000 etc (/100 for kPa) */
119 /* Default to Innovate LC-1 on lambda 0.5 - 1.5 for 0-5V range (lambda range = 1.0) */
120 unsigned short EGOMinimum; /* 0.5 lambda ? (0.5 x 32768 = 16384) */
121 unsigned short EGORange; /* 1.5 lambda ? ((1.5 - 0.5) x 32768 = 32768 (max 49152)) */
123 /* 0 - 24.5 Volt measurement with 10k and 39k resistors */
124 /* http://www.google.com/search?hl=en&safe=off&q=5+*+(39000+%2B+10000)+%2F+10000&btnG=Search */
125 unsigned short BRVMinimum; /* 0 Volts usually. */
126 unsigned short BRVRange; /* 24.5 Volts for 10k and 39k resistors on a 12v vehicle */
128 /* Default to 25% of voltage = closed (0%) */
129 /* 75% of voltage = open (100%) */
130 unsigned short TPSMinimumADC; /* *should* be zero, but often isn't, this value corresponds to 0% TPS */
131 unsigned short TPSMaximumADC; /* */
132 // unsigned short TPSADCRange; // ?? 100% = how many ADCs ?
133 /*efine TPS_MINIMUM 0 ** = 0.00% For clarity ONLY, always zero. */
134 #define TPS_RANGE_MAX 64000 /* = 100.00% */
135 unsigned char userTextField[userTextFieldArrayLength1]; /* "Place your personal notes here!!" */
136 } fixedConfig1;
138 #define FIXED_CONFIG1_SIZE sizeof(fixedConfig1)
141 /** @copydoc fixedConfig1 */
142 typedef struct {
143 /* Setting variables (must be inited with useful values) */
144 unsigned short capacityOfAirPerCombustionEvent; /* How much air it swallows per power producing event */
145 unsigned short perPrimaryInjectorChannelFlowRate; /* How much fuel flows per minute per channel */
146 unsigned short perSecondaryInjectorChannelFlowRate; /* How much fuel flows per minute per channel */
147 unsigned short readingTimeout; /* How often an ADC reading MUST occur */
148 unsigned char ports; /* How many groups of injectors we are firing */
149 unsigned char coils; /* How many coils we are firing */
150 unsigned char combustionEventsPerEngineCycle; /* How many power producing events per engine cycle */
151 unsigned char revolutionsPerEngineCycle; /* Rotary = 1, 2 Stroke = 1, 4 Stroke = 2 */
152 unsigned char primaryTeeth; /* How many teeth are on the crank signal including the missing ones if any (eg. 36-1 primary = 36 not 35) */
153 unsigned char missingTeeth; /* Number sequentially removed from primary teeth (eg. 36-1 missing = 1) */
155 /* Serial settings */
156 unsigned short baudDivisor; /* 22 = (40MHz / (16*115.2kHz)) = 21.7013889 */
157 unsigned char networkAddress; /* Default = 1, Default for PC = 10 */
159 /* Tacho settings */
160 unsigned char tachoTickFactor;
161 unsigned short tachoTotalFactor;
163 /* User text field for noting which installation the unit is from etc. */
164 unsigned char userTextField[userTextFieldArrayLength2]; /* "Place your personal notes here!!" */
165 } fixedConfig2;
167 #define FIXED_CONFIG2_SIZE sizeof(fixedConfig2)
170 #else
171 /* let us know if we are being untidy with headers */
172 #warning "Header file FIXED_CONFIGS_H seen before, sort it out!"
173 /* end of the wrapper ifdef from the very top */
174 #endif