FreeEMS  0.2.0-SNAPSHOT-282-g9efc524
FixedConfig2.c
Go to the documentation of this file.
1 /* FreeEMS - the open source engine management system
2  *
3  * Copyright 2008-2013 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 Second fixed config block
32  *
33  * This file contains the definition of the second 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  sensorSources:{
46  BRV: SOURCE_NORMAL,
47  CHT: SOURCE_NORMAL,
48  IAT: SOURCE_NORMAL,
49  },
50  sensorPresets:{
51  presetIAT: DEGREES_C(20), // Room temperature
52  presetCHT: DEGREES_C(85), // Running temperature
53  presetBRV: VOLTS(14.4), // Standard alternator charging level for wet cell lead acid
54 
55  failsafeIATIgnition: DEGREES_C(40),
56  failsafeIATInjection: DEGREES_C(0),
57  failsafeCHT: DEGREES_C(100),
58  failsafeMAP: KPA(60),
59  failsafeBRV: VOLTS(14.4),
60  failsafeAAP: KPA(100),
61  failsafeTPS: PERCENT(10), // Enough for light throttle and idle in Alpha-N with a fault
62  },
63  sensorRanges:{
64 // MAP Sensor Configuration
65 #if CONFIG == HOTEL_ID
66  MAPMinimum: MPX4250AMin,
67  MAPRange: MPX4250ARange,
68 #elif CONFIG == PRESTO_ID
69  MAPMinimum: HondaDenso183kPaMin,
70  MAPRange: HondaDenso183kPaRange,
71 #elif CONFIG == SNOTROCKET_ID
72  MAPMinimum: HondaDenso183kPaMin,
73  MAPRange: HondaDenso183kPaRange,
74 #elif CONFIG == SEANKLT1_ID
75  MAPMinimum: GM2BarMin,
76  MAPRange: GM2BarRange,
77 #elif CONFIG == SLATER_ID
78  MAPMinimum: HondaDenso183kPaMin,
79  MAPRange: HondaDenso183kPaRange,
80 #elif CONFIG == DEUCECOUPE_ID
81  MAPMinimum: MPX4100AMin,
82  MAPRange: MPX4100ARange,
83 #elif CONFIG == DEUCES10_ID
84  MAPMinimum: GM1BarMin,
85  MAPRange: GM1BarRange,
86 #else
87  MAPMinimum: MPX4250AMin,
88  MAPRange: MPX4250ARange,
89 #endif
90 // AAP Sensor Configuration
91 #if CONFIG == SNOTROCKET_ID
92  AAPMinimum: HondaDenso183kPaMin,
93  AAPRange: HondaDenso183kPaRange,
94 #else
95  AAPMinimum: MPXA6115AMin,
96  AAPRange: MPXA6115ARange,
97 #endif
98 #if CONFIG == SEANKLT1_ID
99  EGOMinimum: AFR1020LambdaMin,
100  EGORange: AFR1020LambdaRange,
101 #elif CONFIG == SCAVENGER_ID // http://www.schnitzracing.com/manuals/AEMWBK.pdf
102  EGOMinimum: LAMBDA(0.683),
103  EGORange: (LAMBDA(1.365) - LAMBDA(0.683)),
104 #elif CONFIG == HOTEL_ID
105  EGOMinimum: AFR1020LambdaMin,
106  EGORange: AFR1020LambdaRange,
107 #else
108  EGOMinimum: LC1LambdaMin,
109  EGORange: LC1LambdaRange,
110 #endif
111 #if CONFIG == HOTEL_ID
112  BRVMinimum: VOLTS(0),
113  BRVRange: VOLTS(25.082),
114 #elif CONFIG == SNOTROCKET_ID
115  BRVMinimum: VOLTS(0),
116  BRVRange: VOLTS(24.5), // Shoebox build value: 24.777, reverted to 24.5 for Jaguar build.
117 #elif CONFIG == DEUCES10_ID
118  BRVMinimum: VOLTS(0),
119  BRVRange: VOLTS(24.65), // This is calibrated for the Jaguar A2 in the 1997 S10 on 01-12-2013.
120 #else
121  BRVMinimum: VOLTS(0),
122  BRVRange: VOLTS(24.5), // Standard 3.9k and 1k values.
123 #endif
124 #if CONFIG == HOTEL_ID
125  TPSMinimumADC: 913, // Idle! The hotel has a reversed TPS slope on purpose for code testing
126  TPSMaximumADC: 0 // WOT! So these values are backward compared to normal
127 #elif CONFIG == DEUCECOUPE_ID
128  TPSMinimumADC: 81, // Idle
129  TPSMaximumADC: 574 // WOT
130 #elif CONFIG == DEUCES10_ID // This is an estimate for the S10 TPS.
131  TPSMinimumADC: 120, // Idle
132  TPSMaximumADC: 560 // WOT
133 #elif CONFIG == SNOTROCKET_ID
134  TPSMinimumADC: 185,
135  TPSMaximumADC: 809
136 #else // Default for a normal TPS slope
137  TPSMinimumADC: 0,
138  TPSMaximumADC: ADC_MAX_VALUE
139 #endif
140  },
141  sensorSettings:{ // Warning, until the following mods are made to ADC use, setting this lower than your cranking rpm will result in a pulsing fuel pump.
142  readingTimeout: 500, /** Default to 0.5 of a second 120rpm for a 4 cylinder @todo TODO new method of ADC sampling, Always sample ADC async, If no sync, use async ADC readings, otherwise use synced. Do this with pointer to array set at beginning of math */
143  numberOfADCsToRead: 8,
144  fuelPumpPrimePeriod: 4 // Currently in seconds, may switch units later. Must be at least 1 and at most 60.
145  },
146  algorithmSettings:{
147  loadType: LOAD_MAP,
148  algorithmType: ALGO_SPEED_DENSITY,
149 #if CONFIG == DEUCECOUPE_ID
150  dwellType: DWELL_RPM,
151 #elif CONFIG == DEUCES10_ID
152  dwellType: DWELL_RPM,
153 #elif CONFIG == SEANKLT1_ID
154  dwellType: DWELL_FIXED,
155 #else
156  dwellType: DWELL_BRV,
157 #endif
158  padding: 0,
159 #if CONFIG == SEANKLT1_ID
160  dwellFixedPeriod: T(2)
161 #else
162  dwellFixedPeriod: T(3)
163 #endif
164  },
165  inputOutputSettings:{
166 // PullUpEnable: 0x00, // Unused right now
167 // ReducedDrive: 0x00, // Unused right now
168 
169  PWMEnable: 0xFF, // Enable all PWM channels by default
170  PWMPolarity: 0xFF, // Default to "duty is high portion" for all pins
171  PWMClock: 0x00, // The fastest we can go for all channels
172  PWMClockPrescaler: 0x00, // The fastest prescaler we can go for all channels
173  PWMCenterAlign: 0x00, // Default to left aligned
174  PWMControl: 0x00, // Default to all 8 bit channels
175  PWMScalerA: 0x00, // 0 = 256, 1 = 1, 255 = 255, 0x00 is the slowest we can go
176  PWMScalerB: 0x00, // 0 = 256, 1 = 1, 255 = 255, 0x00 is the slowest we can go
177 
178  // Default to ~0.4% granularity
179  PWMPeriod0: 0xFF,
180  PWMPeriod1: 0xFF,
181  PWMPeriod2: 0xFF,
182  PWMPeriod3: 0xFF,
183  PWMPeriod4: 0xFF,
184  PWMPeriod5: 0xFF,
185  PWMPeriod6: 0xFF,
186  PWMPeriod7: 0xFF,
187 
188  // Default to pins all low/off
189  PWMInitialDuty0: 0x00,
190  PWMInitialDuty1: 0x00,
191  PWMInitialDuty2: 0x00,
192  PWMInitialDuty3: 0x00,
193  PWMInitialDuty4: 0x00,
194  PWMInitialDuty5: 0x00,
195  PWMInitialDuty6: 0x00,
196  PWMInitialDuty7: 0x00,
197 
198  // Mostly default to low/off state
199  PortInitialValueA: 0x00, // Overridden for fuel pump and CEL outputs
200  PortInitialValueB: 0x00,
201  PortInitialValueC: 0x00,
202  PortInitialValueD: 0x00,
203  PortInitialValueE: 0x00, // TODO necessary to override???
204  PortInitialValueH: 0x00,
205  PortInitialValueJ: 0x00,
206  PortInitialValueK: 0x00,
207  PortInitialValueM: 0x00,
208  PortInitialValueP: 0x00,
209  PortInitialValueS: 0x00, // Overridden for main communications on SCI0
210  PortInitialValueT: 0x00, // Ignored! TODO: Overridden for precision timed outputs
211 
212  // Mostly default to outputs to reduce power consumption and heat. See the note at the end of chapter 1.2.2 of MC9S12XDP512V2.pdf
213  PortDirectionA: 0xFF, // Overridden for fuel pump and CEL outputs
214  PortDirectionB: 0xFF,
215  PortDirectionC: 0xFF,
216  PortDirectionD: 0xFF,
217  PortDirectionE: 0xFF,
218  PortDirectionH: 0x00, // All pins configured as inputs for misc isrs
219  PortDirectionJ: 0xFF,
220  PortDirectionK: 0xFF,
221  PortDirectionM: 0xFF,
222  PortDirectionP: 0xFF,
223  PortDirectionS: 0xFF, // Overridden for main communications on SCI0
224  PortDirectionT: 0xFF // Ignored! TODO: Overridden for precision timed outputs
225  },
226  decoderSettings:{
227  syncConfirmationsRunning: 10, // This number is arbitrary, add an if block and configure to taste.
228  syncConfirmationsStarting: 0, // Most users should leave this zero, however having it set to 1 or 2 could be beneficial
229 #if CONFIG == HOTEL_ID
230  accelerationInputEventTimeTolerance: ACCEL_TIME_TOL(120), // once started this needs a lot less... fix
231  decelerationInputEventTimeTolerance: DECEL_TIME_TOL(120),
232 #elif CONFIG == SNOTROCKET_ID
233  accelerationInputEventTimeTolerance: ACCEL_TIME_TOL(100),
234  decelerationInputEventTimeTolerance: DECEL_TIME_TOL(100),
235 #elif CONFIG == SCAVENGER_ID
236  accelerationInputEventTimeTolerance: ACCEL_TIME_TOL(100),
237  decelerationInputEventTimeTolerance: DECEL_TIME_TOL(100),
238 #else
239  accelerationInputEventTimeTolerance: ACCEL_TIME_TOL(50),
240  decelerationInputEventTimeTolerance: DECEL_TIME_TOL(50),
241 #endif
242  missingToothTolerance: 2048 // 2048 is 50% right now...
243  },
244  userTextField2: "Place your personal notes about whatever you like in here!"
245  " Don't hesitate to tell us a story about something interesting."
246  " Do keep in mind though that when you upload your settings file to "
247  "the forum this message WILL be visible to all and sundry, so don't "
248  "be putting too many personal details, bank account numbers, "
249  "passwords, PIN numbers, license plates, national insurance numbers, "
250  "IRD numbers, social security numbers, phone numbers, email addresses,"
251  " love stories and other private information in this field. In fact it"
252  " is probably best if you keep the information stored here purely "
253  "related to the vehicle that this system is installed on and relevant "
254  "to the state of tune and configuration of settings. Lastly, please "
255  "remember that this field WILL be shrinking in length from it's "
256  "currently large size to something more reasonable in future. I would "
257  "like to attempt to keep it at least thirty two characters lon"
258 };