rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
custom_engine.cpp
Go to the documentation of this file.
1/**
2 * @file custom_engine.cpp
3 *
4 *
5 * set engine_type 49
6 * FRANKENSO_QA_ENGINE
7 * See also DEFAULT_ENGINE_TYPE
8 * Frankenso QA 12 cylinder engine
9 *
10 * @date Jan 18, 2015
11 * @author Andrey Belomutskiy, (c) 2012-2020
12 */
13
14#include "pch.h"
15
16#include "custom_engine.h"
17#include "mre_meta.h"
18#include "proteus_meta.h"
19#include "hellen_meta.h"
20#include "odometer.h"
21#include "defaults.h"
22#if EFI_PROD_CODE
24#endif /* EFI_PROD_CODE */
25
26#if EFI_ELECTRONIC_THROTTLE_BODY
27#include "electronic_throttle.h"
28#endif
29
30#if EFI_PROD_CODE
31#include "can_hw.h"
32#include "scheduler.h"
33#endif /* EFI_PROD_CODE */
34
36}
37
38#if defined(HW_NUCLEO_F767) || defined(HW_NUCLEO_H743) || defined(HW_FRANKENSO)
39
40/**
41 * set engine_type 59
42 */
44// spi3mosiPin = Gpio::B5 grey
45// spi3misoPin = Gpio::B4; vio
46// spi3sckPin = Gpio::B3; blue
47// CS PC5 white
48// EN PA6 yellow
49
50 engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
51 engineConfiguration->clt.adcChannel = EFI_ADC_NONE;
52 engineConfiguration->triggerSimulatorPins[0] = Gpio::Unassigned;
53 engineConfiguration->triggerSimulatorPins[1] = Gpio::Unassigned;
54
55 engineConfiguration->mc33810_cs[0] = Gpio::C5;
56
59 engineConfiguration->injectionPins[2] = Gpio::Unassigned;
60 engineConfiguration->injectionPins[3] = Gpio::Unassigned;
61
66
67 engineConfiguration->cylindersCount = 2;
68 engineConfiguration->firingOrder = FO_1_2;
69}
70#endif // HW_FRANKENSO
71
72// todo: should this be part of more default configurations?
74#ifdef HW_FRANKENSO
76
78
79 /**
80 * Frankenso analog #1 PC2 ADC12 CLT
81 * Frankenso analog #2 PC1 ADC11 IAT
82 * Frankenso analog #3 PA0 ADC0 MAP
83 * Frankenso analog #4 PC3 ADC13 WBO / O2
84 * Frankenso analog #5 PA2 ADC2 TPS
85 * Frankenso analog #6 PA1 ADC1
86 * Frankenso analog #7 PA4 ADC4
87 * Frankenso analog #8 PA3 ADC3
88 * Frankenso analog #9 PA7 ADC7
89 * Frankenso analog #10 PA6 ADC6
90 * Frankenso analog #11 PC5 ADC15
91 * Frankenso analog #12 PC4 ADC14 VBatt
92 */
93 engineConfiguration->tps1_1AdcChannel = EFI_ADC_2; // PA2
94
95 engineConfiguration->map.sensor.hwChannel = EFI_ADC_0;
96
97 engineConfiguration->clt.adcChannel = EFI_ADC_12;
98 engineConfiguration->iat.adcChannel = EFI_ADC_11;
99 engineConfiguration->afr.hwChannel = EFI_ADC_13;
100
101 // Frankenso hardware
102 engineConfiguration->clt.config.bias_resistor = 2700;
103 engineConfiguration->iat.config.bias_resistor = 2700;
104
105 /**
106 * http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board
107 */
108 // Frankenso low out #1: PE6
109 // Frankenso low out #2: PE5
110 // Frankenso low out #3: PD7 Main Relay
111 // Frankenso low out #4: PC13 Idle valve solenoid
112 // Frankenso low out #5: PE3
113 // Frankenso low out #6: PE4 fuel pump relay
114 // Frankenso low out #7: PE1 (do not use with discovery!)
115 // Frankenso low out #8: PE2 injector #2
116 // Frankenso low out #9: PB9 injector #1
117 // Frankenso low out #10: PE0 (do not use with discovery!)
118 // Frankenso low out #11: PB8 injector #3
119 // Frankenso low out #12: PB7 injector #4
120
121 engineConfiguration->fuelPumpPin = Gpio::E4;
122 engineConfiguration->mainRelayPin = Gpio::D7;
123 engineConfiguration->idle.solenoidPin = Gpio::C13;
124
126
127 engineConfiguration->injectionPins[0] = Gpio::B9; // #1
128 engineConfiguration->injectionPins[1] = Gpio::E2; // #2
129 engineConfiguration->injectionPins[2] = Gpio::B8; // #3
130#ifndef EFI_INJECTOR_PIN3
131 engineConfiguration->injectionPins[3] = Gpio::B7; // #4
132#else /* EFI_INJECTOR_PIN3 */
133 engineConfiguration->injectionPins[3] = EFI_INJECTOR_PIN3; // #4
134#endif /* EFI_INJECTOR_PIN3 */
135
136 setAlgorithm(engine_load_mode_e::LM_SPEED_DENSITY);
137
138 engineConfiguration->injectionPins[4] = Gpio::Unassigned;
139 engineConfiguration->injectionPins[5] = Gpio::Unassigned;
140 engineConfiguration->injectionPins[6] = Gpio::Unassigned;
141 engineConfiguration->injectionPins[7] = Gpio::Unassigned;
142 engineConfiguration->injectionPins[8] = Gpio::Unassigned;
143 engineConfiguration->injectionPins[9] = Gpio::Unassigned;
144 engineConfiguration->injectionPins[10] = Gpio::Unassigned;
145 engineConfiguration->injectionPins[11] = Gpio::Unassigned;
146
147 engineConfiguration->ignitionPins[0] = Gpio::E14;
148 engineConfiguration->ignitionPins[1] = Gpio::C7;
149 engineConfiguration->ignitionPins[2] = Gpio::C9;
150 // set_ignition_pin 4 PE10
151 engineConfiguration->ignitionPins[3] = Gpio::E10;
152
153 // todo: 8.2 or 10k?
154 engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2;
155#endif // HW_FRANKENSO
156}
157
158// ETB_BENCH_ENGINE
159// set engine_type 58
161 // VAG test ETB
162 engineConfiguration->tpsMin = 54;
163 // by the way this ETB has default position of ADC=74 which is about 4%
164 engineConfiguration->tpsMax = 540;
165
166 // yes, 30K - that's a test configuration
167 engineConfiguration->rpmHardLimit = 30000;
168
171
172
173 engineConfiguration->ignitionPins[0] = Gpio::Unassigned;
174 engineConfiguration->ignitionPins[1] = Gpio::Unassigned;
175 engineConfiguration->ignitionPins[2] = Gpio::Unassigned;
176 engineConfiguration->ignitionPins[3] = Gpio::Unassigned;
177 /**
178 * remember that some H-bridges require 5v control lines, not just 3v logic outputs we have on stm32
179 */
180 engineConfiguration->etbIo[0].directionPin1 = Gpio::C7; // Frankenso high-side in order to get 5v control
181 engineConfiguration->etbIo[0].directionPin2 = Gpio::C9;
182 engineConfiguration->etbIo[0].controlPin = Gpio::E14;
183
184#if EFI_ELECTRONIC_THROTTLE_BODY
186#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
187
188 engineConfiguration->tps1_1AdcChannel = EFI_ADC_2; // PA2
189 engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_9; // PB1
190
191 // turning off other PWMs to simplify debugging
192 engineConfiguration->triggerSimulatorRpm = 0;
193 engineConfiguration->stepperEnablePin = Gpio::Unassigned;
194 engineConfiguration->idle.stepperStepPin = Gpio::Unassigned;
195 engineConfiguration->idle.stepperDirectionPin = Gpio::Unassigned;
196 engineConfiguration->useStepperIdle = true;
197
198 // no analog dividers - all sensors with 3v supply, naked discovery bench setup
199 engineConfiguration->analogInputDividerCoefficient = 1;
200
201 // see also setDefaultEtbBiasCurve
202}
203
204#if defined(HW_FRANKENSO) && EFI_PROD_CODE && HAL_USE_EEPROM
205
206// todo: page_size + 2
207// todo: CC_SECTION(".nocache")
208static uint8_t write_buf[EE_PAGE_SIZE + 10];
209
210
211#define EEPROM_WRITE_TIME_MS 10 /* time to write one page in ms. Consult datasheet! */
212
213/**
214 * https://www.onsemi.com/pdf/datasheet/cat24c32-d.pdf
215 * CAT24C32
216 */
217static const I2CEepromFileConfig i2cee = {
218 .barrier_low = 0,
219 .barrier_hi = EE_SIZE - 1,
220 .size = EE_SIZE,
221 .pagesize = EE_PAGE_SIZE,
222 .write_time = TIME_MS2I(EEPROM_WRITE_TIME_MS),
223 .i2cp = &EE_U2CD,
224 .addr = 0x50,
225 .write_buf = write_buf
226};
227
228extern EepromDevice eepdev_24xx;
229static I2CEepromFileStream ifile;
230
231/**
232 * set engine_type 61
233 */
235 engineConfiguration->useEeprom = true;
236 engineConfiguration->ignitionPins[2] = Gpio::Unassigned;
237 // dirty hack
239 efiSetPadMode("I2C", Gpio::A8, PAL_MODE_ALTERNATE(4));
240 efiSetPadMode("I2C", Gpio::C9, PAL_MODE_ALTERNATE(4));
241
242
243 addConsoleActionI("ee_read",
244 [](int value) {
245 if (ifile.vmt != eepdev_24xx.efsvmt) {
246 EepromFileOpen((EepromFileStream *)&ifile, (EepromFileConfig *)&i2cee, &eepdev_24xx);
247 }
248
249 ifile.vmt->setposition(&ifile, 0);
250// chFileStreamSeek(&ifile, 0);
251 int v2;
252 streamRead(&ifile, (uint8_t *)&v2, 4);
253 efiPrintf("EE has %d", v2);
254
255 v2 += 3;
256 ifile.vmt->setposition(&ifile, 0);
257 streamWrite(&ifile, (uint8_t *)&v2, 4);
258
259
260 });
261}
262#endif //HW_FRANKENSO
263
264// F407 discovery
266 // enable_spi 3
267 engineConfiguration->is_enabled_spi_3 = true;
268 // Wire up spi3
269 // green
270 engineConfiguration->spi3mosiPin = Gpio::B5;
271 // blue
272 engineConfiguration->spi3misoPin = Gpio::B4;
273 // white
274 engineConfiguration->spi3sckPin = Gpio::B3;
275
276 engineConfiguration->l9779spiDevice = SPI_DEVICE_3;
277 // orange
278 engineConfiguration->l9779_cs = Gpio::D5;
279}
280
281#if HW_PROTEUS
282/*
283 * set engine_type 96
284 */
285
287 engineConfiguration->isBoostControlEnabled = true;
288 engineConfiguration->etbFunctions[0] = DC_Wastegate;
289 engineConfiguration->etbFunctions[1] = DC_None;
290 engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
291
292 engineConfiguration->tps1_1AdcChannel = EFI_ADC_10;
293 setTPS1Calibration(98, 926, 891, 69);
294
295 engineConfiguration->wastegatePositionSensor = EFI_ADC_6;
296 engineConfiguration->wastegatePositionClosedVoltage = 0.7;
297 engineConfiguration->wastegatePositionOpenedVoltage = 4.0;
298
299 setLuaScript(R"(
300
301mapSensor = Sensor.new("map")
302mapSensor : setTimeout(3000)
303
304function onTick()
305 local tps = getSensor("TPS1")
306 tps = (tps == nil and 0 or tps)
307 mapSensor : set(tps)
308end
309
310 )");
311}
312
313#endif // HW_PROTEUS
314
315static void setBasicNotECUmode() {
317
318 // todo: shall we disable map averaging?
319
320 engineConfiguration->wwaeTau = 0.0;
321 engineConfiguration->wwaeBeta = 0.0;
322
324 engineConfiguration->triggerInputPins[0] = Gpio::Unassigned;
325
326 engineConfiguration->tps1_1AdcChannel = EFI_ADC_NONE;
327 engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE;
328 engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE;
329 engineConfiguration->throttlePedalPositionSecondAdcChannel = EFI_ADC_NONE;
330 engineConfiguration->vehicleSpeedSensorInputPin = Gpio::Unassigned;
331 engineConfiguration->clt.adcChannel = EFI_ADC_NONE;
332 engineConfiguration->iat.adcChannel = EFI_ADC_NONE;
333 engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
334}
335
337 for (int i = 0; i < MAX_CYLINDER_COUNT;i++) {
338 engineConfiguration->ignitionPins[i] = Gpio::Unassigned;
339 engineConfiguration->injectionPins[i] = Gpio::Unassigned;
340 }
342}
343
346
347 engineConfiguration->auxAnalogInputs[0] = MRE_IN_TPS;
348 engineConfiguration->auxAnalogInputs[1] = MRE_IN_MAP;
349 engineConfiguration->auxAnalogInputs[2] = MRE_IN_CLT;
350 engineConfiguration->auxAnalogInputs[3] = MRE_IN_IAT;
351 // engineConfiguration->auxAnalogInputs[0] =
352
353
354 // EFI_ADC_14: "32 - AN volt 6"
355// engineConfiguration->afr.hwChannel = EFI_ADC_14;
356
357
358 setLuaScript( R"(
359txPayload = {}
360function onTick()
361 auxV = getAuxAnalog(0)
362 print('Hello analog ' .. auxV )
363 -- first byte: integer part, would be autoboxed to int
364 txPayload[1] = auxV
365 -- second byte: fractional part, would be autoboxed to int, overflow would be ignored
366 txPayload[2] = auxV * 256;
367 auxV = getAuxAnalog(1)
368 print('Hello analog ' .. auxV )
369 txPayload[3] = auxV
370 txPayload[4] = auxV * 256;
371 auxV = getAuxAnalog(2)
372 print('Hello analog ' .. auxV )
373 txPayload[5] = auxV
374 txPayload[6] = auxV * 256;
375 txCan(1, 0x600, 1, txPayload)
376end
377)");
378
379}
380
381void mreBCM() {
383 // maybe time to kill this feature is pretty soon?
384 engineConfiguration->consumeObdSensors = true;
385}
386
388#if HPFP_LOBE_PROFILE_SIZE == 16
389static const float hardCodedHpfpLobeProfileQuantityBins[16] = {0.0, 1.0, 4.5, 9.5,
39016.5, 25.0, 34.5, 45.0 ,
39155.0, 65.5, 75.0, 83.5,
39290.5, 95.5, 99.0, 100.0};
393 copyArray(config->hpfpLobeProfileQuantityBins, hardCodedHpfpLobeProfileQuantityBins);
394#endif // HPFP_LOBE_PROFILE_SIZE
396 setLinearCurve(config->hpfpDeadtimeVoltsBins, 8, 16, 0.5);
397
398 setRpmTableBin(config->hpfpCompensationRpmBins);
399 setLinearCurve(config->hpfpCompensationLoadBins, 0.005, 0.120, 0.001);
400
401 // This is the configuration for bosch HDEV 5 injectors
402 // all times in microseconds/us
403 engineConfiguration->mc33_hvolt = 65;
404 engineConfiguration->mc33_i_boost = 13000;
405 engineConfiguration->mc33_i_peak = 9400;
406 engineConfiguration->mc33_i_hold = 3700;
407 engineConfiguration->mc33_t_min_boost = 100;
408 engineConfiguration->mc33_t_max_boost = 400;
409 engineConfiguration->mc33_t_peak_off = 10;
410 engineConfiguration->mc33_t_peak_tot = 700;
411 engineConfiguration->mc33_t_bypass = 10;
412 engineConfiguration->mc33_t_hold_off = 60;
413 engineConfiguration->mc33_t_hold_tot = 10000;
414
415 engineConfiguration->mc33_hpfp_i_peak = 5; // A not mA like above
416 engineConfiguration->mc33_hpfp_i_hold = 3;
417 engineConfiguration->mc33_hpfp_i_hold_off = 10; // us
418 engineConfiguration->mc33_hpfp_max_hold = 10; // this value in ms not us
419
420}
421
422/**
423 * set engine_type 107
424 */
425void setRotary() {
426 engineConfiguration->cylindersCount = 2;
427 engineConfiguration->firingOrder = FO_1_2;
428
430 engineConfiguration->twoStroke = true;
431
432 strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA);
433 strcpy(engineConfiguration->engineCode, "13B");
434 strcpy(engineConfiguration->vehicleName, "test");
435
436 engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
437 engineConfiguration->injectionPins[2] = Gpio::Unassigned; // injector in default pinout
438 engineConfiguration->injectionPins[3] = Gpio::Unassigned;
439
440 engineConfiguration->enableTrailingSparks = true;
441 engineConfiguration->trailingCoilPins[0] = Gpio::C9;
442 engineConfiguration->trailingCoilPins[1] = Gpio::E10;
443}
444
445/**
446 * set engine_type 103
447 */
449
450 // grey
451 // default spi3mosiPin PB5
452 // white
453 // default spi3misoPin PB4
454 // violet
455 // default spi3sckPin PB3
456
457
458 engineConfiguration->triggerSimulatorPins[0] = Gpio::Unassigned;
459 engineConfiguration->triggerSimulatorPins[1] = Gpio::Unassigned;
460
461 engineConfiguration->injectionPins[0] = Gpio::B9; // #1
462 engineConfiguration->injectionPins[1] = Gpio::E2; // #2
463 engineConfiguration->injectionPins[2] = Gpio::B8; // #3
464 engineConfiguration->injectionPins[3] = Gpio::B7; // #4
465
466
467 // blue
468 engineConfiguration->mc33816_cs = Gpio::D7;
469 // green
470 engineConfiguration->mc33816_rstb = Gpio::D4;
472 // yellow
473 engineConfiguration->mc33816_driven = Gpio::D6;
474
475 engineConfiguration->mc33816_flag0 = Gpio::D3;
476
477 // enable_spi 3
478 engineConfiguration->is_enabled_spi_3 = true;
479 // Wire up spi3
480 engineConfiguration->spi3mosiPin = Gpio::B5;
481 engineConfiguration->spi3misoPin = Gpio::B4;
482 engineConfiguration->spi3sckPin = Gpio::B3;
483
484 engineConfiguration->isSdCardEnabled = false;
485
486 engineConfiguration->mc33816spiDevice = SPI_DEVICE_3;
487}
488
490#if HW_PROTEUS
491 engineConfiguration->tpsMin = 889;
492 engineConfiguration->tpsMax = 67;
493
494 engineConfiguration->tps1SecondaryMin = 105;
495 engineConfiguration->tps1SecondaryMax = 933;
496
497 strcpy(engineConfiguration->scriptCurveName[2 - 1], "rateofchange");
498
499 strcpy(engineConfiguration->scriptCurveName[3 - 1], "bias");
500
501 /**
502 * for this demo I use ETB just a sample object to control with PID. No reasonable person should consider actually using
503 * Lua for actual intake ETB control while driving around the racing track - hard-coded ETB control is way smarter!
504 */
505 static const float defaultBiasBins[] = {
506 0, 1, 2, 4, 7, 98, 99, 100
507 };
508 static const float defaultBiasValues[] = {
509 -20, -18, -17, 0, 20, 21, 22, 25
510 };
511
512 engineConfiguration->luaOutputPins[0] = Gpio::D12;
513 engineConfiguration->luaOutputPins[1] = Gpio::D10;
514 engineConfiguration->luaOutputPins[2] = Gpio::D11;
515
516 setLinearCurve(config->scriptCurve2Bins, 0, 8000, 1);
517 setLinearCurve(config->scriptCurve2, 0, 100, 1);
518
519 copyArray(config->scriptCurve3Bins, defaultBiasBins);
520 copyArray(config->scriptCurve3, defaultBiasValues);
521
522 engineConfiguration->auxAnalogInputs[0] = PROTEUS_IN_ANALOG_VOLT_10;
523 engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
524
525
526 // ETB direction #1 PD10
527 engineConfiguration->etbIo[0].directionPin1 = Gpio::Unassigned;
528 // ETB control PD12
529 engineConfiguration->etbIo[0].controlPin = Gpio::Unassigned;
530 // ETB disable PD11
531 engineConfiguration->etbIo[0].disablePin = Gpio::Unassigned;
532
533/**
534controlIndex = 0
535directionIndex = 1
536
537 print('pid output ' .. output)
538 print('')
539
540
541
542 local duty = (bias + output) / 100
543
544-- isPositive = duty > 0;
545-- pwmValue = isPositive and duty or -duty
546-- setPwmDuty(controlIndex, pwmValue)
547
548-- dirValue = isPositive and 1 or 0;
549-- setPwmDuty(directionIndex, dirValue)
550
551-- print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
552
553 *
554 */
555
556 auto script = R"(
557
558startPwm(0, 800, 0.1)
559-- direction
560startPwm(1, 80, 1.0)
561-- disable
562startPwm(2, 80, 0.0)
563
564pid = Pid.new(2, 0, 0, -100, 100)
565
566biasCurveIndex = findCurveIndex("bias")
567
568voltageFromCan = nil
569canRxAdd(0x600)
570
571function onCanRx(bus, id, dlc, data)
572 print('got CAN id=' .. id .. ' dlc=' .. dlc)
573 voltageFromCan = data[2] / 256.0 + data[1]
574end
575
576function onTick()
577 local targetVoltage = getAuxAnalog(0)
578
579-- local target = interpolate(1, 0, 3.5, 100, targetVoltage)
580 local target = interpolate(1, 0, 3.5, 100, voltageFromCan)
581-- clamp 0 to 100
582 target = math.max(0, target)
583 target = math.min(100, target)
584
585 print('Decoded target: ' .. target)
586
587 local tps = getSensor("TPS1")
588 tps = (tps == nil and 'invalid TPS' or tps)
589 print('Tps ' .. tps)
590
591 local output = pid:get(target, tps)
592
593 local bias = curve(biasCurveIndex, target)
594 print('bias ' .. bias)
595
596 local duty = (bias + output) / 100
597 isPositive = duty > 0;
598 pwmValue = isPositive and duty or -duty
599 setPwmDuty(0, pwmValue)
600
601 dirValue = isPositive and 1 or 0;
602 setPwmDuty(1, dirValue)
603
604 print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
605 print('')
606end
607 )";
608 setLuaScript(script);
609#endif
610}
611
613#if HW_HELLEN && EFI_PROD_CODE
615#endif //HW_HELLEN EFI_PROD_CODE
616 // todo: add board ID detection?
617 // see hellen128 which has/had alternative i2c board id?
618}
619
620// set engine_type 15
622 engineConfiguration->cranking.rpm = 12000;
623#if EFI_ENGINE_CONTROL
625#endif // EFI_ENGINE_CONTROL
626 setTable(config->postCrankingFactor, 1.0f);
627 setArrayValues(config->crankingFuelCoef, 1.0f);
628 setTable(config->crankingCycleBaseFuel, 1.0f);
630}
631
632#if HW_PROTEUS
633// PROTEUS_STIM_QC
634// set engine_type 73
637 engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
638 engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
639
640 engineConfiguration->triggerInputPins[0] = PROTEUS_DIGITAL_1;
641 engineConfiguration->triggerInputPins[1] = PROTEUS_DIGITAL_2;
642 engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_3;
643 engineConfiguration->camInputs[1] = PROTEUS_DIGITAL_4;
644 engineConfiguration->vehicleSpeedSensorInputPin = PROTEUS_DIGITAL_5;
645 engineConfiguration->brakePedalPin = PROTEUS_DIGITAL_6;
646
648 // EFI_ADC_13: "Analog Volt 4"
649 engineConfiguration->tps2_1AdcChannel = PROTEUS_IN_TPS2_1;
650 // EFI_ADC_0: "Analog Volt 5"
651 engineConfiguration->tps2_2AdcChannel = PROTEUS_IN_ANALOG_VOLT_5;
652 engineConfiguration->oilPressure.hwChannel = PROTEUS_IN_ANALOG_VOLT_6;
653 // pps2 volt 7
654
655 // pps1 volt 9
656 // afr volt 10
657 engineConfiguration->oilTempSensor.adcChannel = PROTEUS_IN_ANALOG_VOLT_11;
658 setCommonNTCSensor(&engineConfiguration->oilTempSensor, 2700);
659
660
661 engineConfiguration->auxLinear1.hwChannel = PROTEUS_IN_ANALOG_TEMP_1;
662 engineConfiguration->auxLinear2.hwChannel = PROTEUS_IN_ANALOG_TEMP_4;
663
664// engineConfiguration->fan2Pin = Gpio::PROTEUS_LS_9;
665// engineConfiguration->malfunctionIndicatorPin = Gpio::PROTEUS_LS_13;
666// engineConfiguration->tachOutputPin = Gpio::PROTEUS_LS_14;
667//
668// engineConfiguration->vvtPins[0] = Gpio::PROTEUS_LS_15;
669// engineConfiguration->vvtPins[1] = Gpio::PROTEUS_LS_16;
670}
671#endif // HW_PROTEUS
672
673// set engine_type 93
675#ifdef HW_FRANKENSO
677#endif
679
681 setTable(config->ignitionIatCorrTable, 0);
682 engineConfiguration->cylindersCount = 6;
683 engineConfiguration->firingOrder = FO_1_5_3_6_2_4;
684 engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
685 engineConfiguration->triggerSimulatorRpm = 4800;
686}
687
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
void addConsoleActionI(const char *token, VoidInt callback)
Register a console command with one Integer parameter.
@ MC33810_0_GD_3
@ Unassigned
@ MC33810_0_OUT_0
@ MC33810_0_GD_2
@ MC33810_0_OUT_1
@ MC33810_0_GD_1
@ MC33810_0_GD_0
void setDiscoveryPdm()
void setEtbTestConfiguration()
void mreBCM()
void detectBoardType()
EepromDevice eepdev_24xx
void mreSecondaryCan()
void fuelBenchMode()
void setFrankensoConfiguration()
void setL9779TestConfiguration()
static uint8_t write_buf[EE_PAGE_SIZE+10]
void setRotary()
void setBodyControlUnit()
void testEngine6451()
void setTest33816EngineConfiguration()
void setEepromTestConfiguration()
void setDiscovery33810Test()
static void setBasicNotECUmode()
void proteusStimQc()
void proteusLuaDemo()
void proteusDcWastegateTest()
void setBoschHDEV_5_injectors()
static const I2CEepromFileConfig i2cee
static I2CEepromFileStream ifile
void setHpfpLobeProfileAngle(int lobes)
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax)
static const float defaultBiasValues[]
static const float defaultBiasBins[]
void setBoschVNH2SP30Curve()
void commonFrankensoAnalogInputs()
void setCrankOperationMode()
void setWholeTimingTable(angle_t value)
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
void setAlgorithm(engine_load_mode_e algo)
void setFlatInjectorLag(float value)
void detectHellenBoardType()
void brain_pin_markUnused(brain_pin_e brainPin)
void setProteusEtbIO()
void setLuaScript(const char *luaScript)
Definition settings.cpp:761
constexpr void setTable(TElement(&dest)[N][M], const VElement value)
void setRpmTableBin(TValue(&array)[TSize])
void setLinearCurve(TValue(&array)[TSize], float from, float to, float precision=0.01f)
void setArrayValues(TValue(&array)[TSize], float value)
void setCommonNTCSensor(ThermistorConf *thermistorConf, float pullup)