FreeEMS  0.2.0-SNAPSHOT-285-g028e24c
FixedConfig1.c
Go to the documentation of this file.
1 /* FreeEMS - the open source engine management system
2  *
3  * Copyright 2008-2012 Fred Cooke
4  *
5  * This file is part of the FreeEMS project.
6  *
7  * FreeEMS software is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * FreeEMS software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
19  *
20  * We ask that if you make any changes to this file you email them upstream to
21  * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
22  *
23  * Thank you for choosing FreeEMS to run your engine!
24  */
25 
26 
27 /** @file
28  *
29  * @ingroup dataInitialisers
30  *
31  * @brief First fixed config block
32  *
33  * This file contains the definition of the first fixed configuration block.
34  * The declaration can be found in the global constants header file.
35  *
36  * Please ensure that all variables added here have good default values.
37  */
38 
39 
40 #include "../inc/freeEMS.h"
41 
42 
43 /// @copydoc fixedConfig1
45  engineSettings:{
46 #if CONFIG == TRUCK_ID
47  perCylinderVolume: CYLINDER_VOLUME(500),
48  injectorFlow: CC_PER_MINUTE(550), // RX7 "550" which em_knaps had tested at 650cc
49 #elif CONFIG == PRESTO_ID
50  perCylinderVolume: CYLINDER_VOLUME(400),
51  injectorFlow: CC_PER_MINUTE(213),
52 #elif CONFIG == SEANKLT1_ID
53  perCylinderVolume: CYLINDER_VOLUME(727),
54  injectorFlow: CC_PER_MINUTE(525),
55 #elif SEANKR1 // No ID assigned yet!
56  perCylinderVolume: CYLINDER_VOLUME(250),
57  injectorFlow: CC_PER_MINUTE(230), // http://www.witchhunter.com/flowdatapix/bcdh210.jpg
58 #elif CONFIG == SNOTROCKET_ID
59  perCylinderVolume: CYLINDER_VOLUME(525),
60  injectorFlow: CC_PER_MINUTE(310),
61 #elif CONFIG == HOTEL_ID
62  perCylinderVolume: CYLINDER_VOLUME(500),
63  injectorFlow: CC_PER_MINUTE(140),
64 #elif CONFIG == SLATER_ID
65  perCylinderVolume: CYLINDER_VOLUME(324),
66  injectorFlow: CC_PER_MINUTE(320),
67 #elif CONFIG == PETERJSERIES_ID
68  perCylinderVolume: CYLINDER_VOLUME(585),
69  injectorFlow: CC_PER_MINUTE(320),
70 #elif CONFIG == DEUCECOUPE_ID
71  perCylinderVolume: CYLINDER_VOLUME(522),
72  injectorFlow: CC_PER_MINUTE(235),
73 #elif CONFIG == DEUCES10_ID
74  perCylinderVolume: CYLINDER_VOLUME(548),
75  injectorFlow: CC_PER_MINUTE(235),
76 #elif CONFIG == SCAVENGER_ID
77  perCylinderVolume: CYLINDER_VOLUME(399.25),
78  injectorFlow: CC_PER_MINUTE(540),
79 #else
80  perCylinderVolume: CYLINDER_VOLUME(500),
81  injectorFlow: CC_PER_MINUTE(550),
82 #endif
83  stoichiometricAFR: stoichiometricAFRPetrol,
84  densityOfFuelAtSTP: densityOfPetrol
85  },
86  serialSettings:{
87  baudDivisor: SCI_BAUD_DIVISOR(115200) // 21.7013889 (22) http://duckduckgo.com/?q=40000000+%2F+%2816*115200%29
88  // http://duckduckgo.com/?q=40000000+%2F+%2816*22%29 113.636 kHz actual speed
89  // http://duckduckgo.com/?q=22+%2F+%28%2840000000%2F16%29%2F115200%29 1.376% error in speed
90  },
91  coarseBitBangSettings:{
92 #if CONFIG == SNOTROCKET_ID // 24 events for a 24+1 CAS setup with 4 cylinder tacho
93  outputActions: {1,0,0,2,0,0,1,0,0,2,0,0,1,0,0,2,0,0,1,0,0,2,0,0},
94 #elif CONFIG == SLATER_ID // 11 events for 12-1 crank setup with 4 cylinder tacho
95  outputActions: {1,0,0,2,0,0,1,0,0,2,0},
96 #else
97  outputActions: standardTachoArray,
98 #endif
99  ports: standardTachoPorts,
100  masks: standardTachoMasks,
101  numberConfigured: 1
102  },
103  schedulingSettings:{
104 // Sadly, FreeEMS car numero uno is gone, RIP Volvo! http://forum.diyefi.org/viewtopic.php?f=55&t=1068
105 
106 #if CONFIG == TRUCK_ID // Fred's Ford Courier http://forum.diyefi.org/viewtopic.php?f=55&t=1069
107  anglesOfTDC: {ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540), ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540)},
108  outputEventPinNumbers: {0,1,2,3,4,5,4,5}, // COP and semi-sequential
109  schedulingConfigurationBits: {0,0,0,0,1,1,1,1}, // First four ignition, last four fuel
110  decoderEngineOffset: ANGLE(90.00), // FE-DOHC, 4and1 CAS approximately centre
111  numberOfConfiguredOutputEvents: 8, // Migrated to new way
112  numberOfInjectionsPerEngineCycle: 2 // Used to be batch, dead time being wrong could have affected AFRs
113 
114 #elif CONFIG == HOTEL_ID // Fred's Hotel Hyundai (Stellar) http://forum.diyefi.org/viewtopic.php?f=55&t=1086
115  anglesOfTDC: {ANGLE(0), ANGLE(45)}, // Simple dual edge dizzy
116  outputEventPinNumbers: {0, 2}, // First pin
117  schedulingConfigurationBits: {0, 1}, // Ignition only
118  decoderEngineOffset: ANGLE(170.00), // Locked dizzy with timing of TDC on edge, used for static timing during cranking.
119  numberOfConfiguredOutputEvents: 2, // One per decoder cycle = 4, and one injector too
120  numberOfInjectionsPerEngineCycle: 4 // Four injections per cycle
121 
122 #elif CONFIG == PRESTO_ID // Preston's silver-top-on-a-stand http://forum.diyefi.org/viewtopic.php?f=55&t=1101
123  anglesOfTDC: {ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540), ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540)},
124  outputEventPinNumbers: {0,1,0,1,4,5,4,5}, // Wasted spark, semi-sequential TODO migrate this to sequential
125  schedulingConfigurationBits: {0,0,0,0,1,1,1,1}, // First four ignition, last four injection
126  decoderEngineOffset: ANGLE(128.52), // Stock silver-top using G? for RPM2 and NE for RPM1, CAS approximately centre, @todo TODO find values for extremes of dizzy placement
127  numberOfConfiguredOutputEvents: 8, // See two lines above
128  numberOfInjectionsPerEngineCycle: 2 // Semi-sequential, for now.
129 
130 #elif CONFIG == SEANKLT1_ID // http://forum.diyefi.org/viewtopic.php?f=55&t=1146
131  anglesOfTDC: {ANGLE(0), ANGLE(90), ANGLE(180), ANGLE(270), ANGLE(360), ANGLE(450), ANGLE(540), ANGLE(630), ANGLE(0), ANGLE(90), ANGLE(180), ANGLE(270), ANGLE(360), ANGLE(450), ANGLE(540), ANGLE(630)},
132  outputEventPinNumbers: {0,0,0,0,0,0,0,0,2,3,4,5,2,3,4,5}, // LTCC e-dizzy, semi-sequential injection 1/6, 8/5, 4/7, 3/2, and repeat
133  schedulingConfigurationBits: {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1}, // See below two lines
134  decoderEngineOffset: ANGLE(0.00), // Decoder has a true zero zero mechanically hard coded
135  numberOfConfiguredOutputEvents: 16, // First half ignition, second half injection
136  numberOfInjectionsPerEngineCycle: 2 // Full sync semi-sequential
137 
138 #elif CONFIG == SNOTROCKET_ID // http://forum.diyefi.org/viewtopic.php?f=3&t=1263 Sim's 2.1 Volvo, semi-squential fuel with CNP using LS1 coils.
139  anglesOfTDC: {ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540), ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540)}, // 1,2,3,4: Firing order: 1-3-4-2 set up in loom
140  outputEventPinNumbers: {0,1,2,3,4,5,4,5}, // COP/CNP ignition, semi-sequential fuel
141  schedulingConfigurationBits: {0,0,0,0,1,1,1,1}, // First four ignition, last four fuel
142  decoderEngineOffset: ANGLE(566.00), // Volvo B21A with DSM/Miata CAS + 24and1 disk
143  numberOfConfiguredOutputEvents: 8, // COP PT2-PT5, injectors drivers wired to PT6 and PT7, pulse-paired, until Xgate
144  numberOfInjectionsPerEngineCycle: 2 // Syncronized semi-sequential
145 
146 #elif CONFIG == SPUDMN_ID // http://forum.diyefi.org/viewtopic.php?f=55&t=1507 Spudmn's mk1 racing mini in NZ :-)
147  anglesOfTDC: {ANGLE(0), ANGLE(180)}, // 1 and 4, 2 and 3
148  outputEventPinNumbers: {0,1}, // Ignition only
149  schedulingConfigurationBits: {0,0}, // Ditto
150  decoderEngineOffset: ANGLE(5.00), // To verify from source build!
151  numberOfConfiguredOutputEvents: 2, // Wasted spark
152  numberOfInjectionsPerEngineCycle: 1 // Ditto
153 
154 #elif CONFIG == SLATER_ID // http://forum.diyefi.org/viewtopic.php?f=62&t=1336 Citroen with t25 turbo on a flat 4 air cooled engine
155  anglesOfTDC: {ANGLE(0), ANGLE(180),(0), ANGLE(180)}, // 1 and 4, 2 and 3, repeat
156  outputEventPinNumbers: {0,1,4,5}, // 2 and 3 are unused in this config, fuel are on 4/5 because he plans to use the same hardware on the V8 Supra with wasted spark and thus 2/3 are required for ignition on that
157  schedulingConfigurationBits: {0,0,1,1}, // 2 ignition 2 injection
158  decoderEngineOffset: ANGLE(120.00), // May need adjusting
159  numberOfConfiguredOutputEvents: 4, // Wasted spark, semi-sequential
160  numberOfInjectionsPerEngineCycle: 2 // Semi-sequential, crank sync only
161 
162 #elif CONFIG == PETERJSERIES_ID // Firing order 1-4-2-5-3-6 http://forum.diyefi.org/viewtopic.php?f=62&t=1533
163  anglesOfTDC: {ANGLE(0), ANGLE(120), ANGLE(240), ANGLE(360), ANGLE(480), ANGLE(600)},
164  outputEventPinNumbers: {0,3,1,4,2,5}, // An example of wiring your engine with cylinder one on output one, harder to grok
165  schedulingConfigurationBits: {1,1,1,1,1,1}, // Ones represent scheduling for injection, zeros represent scheduling for ignition
166  decoderEngineOffset: ANGLE(0.00), // Trim fuel injection END point with this value.
167  numberOfConfiguredOutputEvents: 6, // THESE ARE NOT IGN, THEY ARE FUEL
168  numberOfInjectionsPerEngineCycle: 1 // Sequential, baby, yeah!
169 
170 #elif CONFIG == DEUCECOUPE_ID // DeuceEFI's GM 3100 V6, firing order 1-6-5-4-3-2, wasted spark DIS ignition http://forum.diyefi.org/viewtopic.php?f=3&t=1278
171  anglesOfTDC: {ANGLE(0), ANGLE(120), ANGLE(240), ANGLE(360), ANGLE(480), ANGLE(600), ANGLE(0), ANGLE(120), ANGLE(240), ANGLE(360), ANGLE(480), ANGLE(600)},
172  outputEventPinNumbers: {0,0,0,0,0,0,2,3,4,2,3,4}, // DIS E-dizzy and semi-sequential, for now.
173  schedulingConfigurationBits: {0,0,0,0,0,0,1,1,1,1,1,1}, // Six E-dizzy style DIS ignition outputs and six injection events, two per cycle, semi sequential
174  decoderEngineOffset: ANGLE(0.00), // Nothing for now, so as to be able to figure out what is going on.
175  numberOfConfiguredOutputEvents: 12, // See three lines above
176  numberOfInjectionsPerEngineCycle: 2 // Semi-sequential, for now.
177 
178 #elif CONFIG == DEUCES10_ID // Firing order 1-3-4-2 setup in wiring harness http://forum.diyefi.org/viewtopic.php?f=55&t=1962
179  anglesOfTDC: {ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540), ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540)},
180  outputEventPinNumbers: {0,0,0,0,2,3,4,5}, // DIS E-dizzy and Sequential (2 == Port-T4)
181  schedulingConfigurationBits: {0,0,0,0,1,1,1,1}, // First 4 ign, Last 4 fuel
182  decoderEngineOffset: ANGLE(0.00), // GM DIS 2x Reference signal is at 0 degrees.
183  numberOfConfiguredOutputEvents: 8, // 4 coil events and 4 injector events.
184  numberOfInjectionsPerEngineCycle: 1 // Sequential Fueling!
185 
186 #elif CONFIG == PETERTRUCK_ID // Firing order 1-5-3-6-2-4
187  anglesOfTDC: {ANGLE(0), ANGLE(120), ANGLE(240), ANGLE(360), ANGLE(480), ANGLE(600)},
188  outputEventPinNumbers: {0,4,2,5,1,3}, // An example of wiring your engine with cylinder one on output one, harder to grok
189  schedulingConfigurationBits: {0,0,0,0,0,0}, // Ones represent scheduling for injection, zeros represent scheduling for ignition
190  decoderEngineOffset: ANGLE(0.00), // Trim fuel injection END point with this value.
191  numberOfConfiguredOutputEvents: 6, // THESE ARE IGN, THEY ARE NOT FUEL
192  numberOfInjectionsPerEngineCycle: 1 // Sequential, baby, yeah!
193 
194 #elif CONFIG == SCAVENGER_ID // hentai
195  anglesOfTDC: {ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540), ANGLE(0), ANGLE(180), ANGLE(360), ANGLE(540)},
196  outputEventPinNumbers: {0,1,0,1,2,3,2,3}, // Wasted spark, semi-sequential TODO migrate this to sequential
197  schedulingConfigurationBits: {0,0,0,0,1,1,1,1}, // First four ignition, last four injection
198  decoderEngineOffset: ANGLE(128), // Hentai initial setup value, will change a bit
199  numberOfConfiguredOutputEvents: 8, // See two lines above
200  numberOfInjectionsPerEngineCycle: 2 // Semi-sequential, for now.
201 
202 #else // Nothing scheduled by default, no sensible default for all possible vehicle setups.
203  anglesOfTDC: {}, // Depends on cylinder count and other variables
204  outputEventPinNumbers: {0,1,2,3,4,5}, // Default to a variety of pins for testing purposes. Note: Won't do anything without
205  schedulingConfigurationBits: {}, // All ignition by guarantee of C, configured explicitly for real setups.
206  decoderEngineOffset: ANGLE(0), // Start with zero, work your way to the correct value
207  numberOfConfiguredOutputEvents: 0, // This disables scheduling completely, should match the first, second and third arrays
208  numberOfInjectionsPerEngineCycle: 1 // 720 degree decoders with one injection per cycle
209 #endif
210  },
211  cutAndLimiterSettings:{
212  InjectionRPM:{
213 #if CONFIG == SNOTROCKET_ID
214  disableThreshold: RPM(6300),
215  reenableThreshold: RPM(6200)
216 #elif CONFIG == SLATER_ID
217  disableThreshold: RPM(7000),
218  reenableThreshold: RPM(6900)
219 #elif CONFIG == DEUCES10_ID
220  disableThreshold: RPM(5600),
221  reenableThreshold: RPM(5400)
222 #elif CONFIG == SCAVENGER_ID
223  disableThreshold: RPM(7200),
224  reenableThreshold: RPM(7150)
225 #else
226  disableThreshold: RPM(5850),
227  reenableThreshold: RPM(5800) // Come back on before ignition does
228 #endif
229  },
230  IgnitionRPM:{
231 #if CONFIG == HOTEL_ID
232  disableThreshold: RPM(5800),
233  reenableThreshold: RPM(5750) // Nice and close to save the exhaust
234 #elif CONFIG == SNOTROCKET_ID
235  disableThreshold: RPM(6300),
236  reenableThreshold: RPM(6150)
237 #elif CONFIG == SLATER_ID
238  disableThreshold: RPM(7000),
239  reenableThreshold: RPM(6850)
240 #elif CONFIG == PETERJSERIES_ID
241  disableThreshold: RPM(6000),
242  reenableThreshold: RPM(5950)
243 #elif CONFIG == PETERTRUCK_ID
244  disableThreshold: RPM(5000),
245  reenableThreshold: RPM(4950)
246 #elif CONFIG == DEUCES10_ID
247  disableThreshold: RPM(5600),
248  reenableThreshold: RPM(5300)
249 #elif CONFIG == SCAVENGER_ID
250  disableThreshold: RPM(7200),
251  reenableThreshold: RPM(7100)
252 #else
253  disableThreshold: RPM(5800),
254  reenableThreshold: RPM(5750) // Come back on after injection does
255 #endif
256  },
257  OverBoost:{
258  disableThreshold: KPA(250), // Cut close to std sensor max
259  reenableThreshold: KPA(105) // Re enable when boost gone all together (Setting to anything at or below 100kPa can cause a dead engine)
260  },
261  cutsEnabled:{
262  InjectionRPM: 1,
263  IgnitionRPM: 1,
264  InjOverBoost: 1,
265  IgnOverBoost: 1,
266  Spare0: 1,
267  Spare1: 1,
268  Spare2: 1,
269  Spare3: 1,
270  Spare4: 1,
271  Spare5: 1,
272  Spare6: 1,
273  Spare7: 1,
274  Spare8: 1,
275  Spare9: 1,
276  SpareA: 1,
277  SpareB: 1
278  }
279  },
280  simpleGPIOSettings:{
281  outputConfigs:{
282 #if CONFIG == DEUCECOUPE_ID
283  [0] = {
284  variable: &CoreVars0.RPM,
285  upperValue: RPM(400),
286  lowerValue: RPM(300),
287  port: (unsigned char*)&PORTT,
288  mask: BIT3,
289  flags: 0
290  },
291 #elif CONFIG == DEUCES10_ID
292  [0] = {
293  variable: &CoreVars0.RPM,
294  upperValue: RPM(400),
295  lowerValue: RPM(300),
296  port: (unsigned char*)&PORTT,
297  mask: BIT3,
298  flags: 0
299  },
300 #else
301  [0] = {
302  variable: &CoreVars0.RPM,
303  upperValue: RPM(5000),
304  lowerValue: RPM(4000),
305  port: (unsigned char*)&PORTK,
306  mask: BIT3,
307  flags: 0
308  },
309 #endif
310  [1] = {
311 #if CONFIG == HOTEL_ID // Don't need fan control, do need proper Wideband control
312  variable: &CoreVars0.RPM,
313  upperValue: RPM(700),
314  lowerValue: RPM(400),
315 #else // Default fan control for everyone else
316  variable: &CoreVars0.CHT,
317  upperValue: DEGREES_C(100),
318  lowerValue: DEGREES_C(90),
319 #endif
320  port: (unsigned char*)&PORTK,
321  mask: BIT4,
322  flags: 0
323  }
324  },
325  numberConfigured: 2,
326  spare: 0
327  },
328  userTextField: "Place your personal notes about whatever you like in here!"
329  " Don't hesitate to tell us a story about something interesting."
330  " Do keep in mind though that when you upload your settings file to "
331  "the forum this message WILL be visible to all and sundry, so don't "
332  "be putting too many personal details, bank account numbers, "
333  "passwords, PIN numbers, license plates, national insurance numbers, "
334  "IRD numbers, social security numbers, phone numbers, email addresses,"
335  " love stories and other private information in this field. In fact it"
336  " is probably best if you kee"
337 };