| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | /* | |||
| 2 | * @file mazda_miata_1_6.cpp | |||
| 3 | * | |||
| 4 | * | |||
| 5 | * https://github.com/rusefi/rusefi/wiki/Frankenso_MazdaMiataNA6_pnp | |||
| 6 | * | |||
| 7 | * | |||
| 8 | * Frankenso board | |||
| 9 | * set engine_type 41 | |||
| 10 | * | |||
| 11 | * @date Apr 16, 2016 | |||
| 12 | * @author Andrey Belomutskiy, (c) 2012-2020 | |||
| 13 | */ | |||
| 14 | ||||
| 15 | #include "pch.h" | |||
| 16 | ||||
| 17 | #include "custom_engine.h" | |||
| 18 | #include "mazda_miata_1_6.h" | |||
| 19 | #include "mazda_miata_base_maps.h" | |||
| 20 | #include "mre_meta.h" | |||
| 21 | ||||
| 22 | static const float hardCodedmafDecodingBins[] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.5999985, 0.70000076, 0.79999924, 0.9000015, 1.0, 1.0999985, 1.199997, 1.300003, 1.4000015, 1.5, 1.5999985, 1.699997, 1.800003, 1.9000015, 2.0, 2.100006, 2.2000122, 2.2999878, 2.399994, 2.5, 2.600006, 2.7000122, 2.7999878, 2.899994, 3.0, 3.100006, 3.2000122 | |||
| 23 | // if anyone cares we shall rescale: , 3.2999878, 3.399994, 3.5, 3.600006, 3.7000122, 3.7999878, 3.899994, 4.0, 4.0999756, 4.2 | |||
| 24 | }; | |||
| 25 | ||||
| 26 | static const float hardCodedmafDecoding[] = {570.0, 437.0, 351.5, 293.55078, 237.0, 186.0, 145.0, 116.0, 96.0, 78.84961, 65.549805, 56.049805, 48.0, 40.0, 33.25, 29.449951, 25.649902, 22.800049, 20.899902, 19.0, 17.100098, 16.149902, 13.775024, 12.824951, 11.400024, 10.449951, 9.5, 8.550049, 8.454956, 8.359985, 8.300049, 8.199951 | |||
| 27 | // if anyone cares we shall rescale:, 7.5999756, 7.125, 7.125, 7.125, 6.6500244, 6.6500244, 6.6500244, 6.6500244, 6.6500244, 6.6500244 | |||
| 28 | }; | |||
| 29 | ||||
| 30 | /* Generated by TS2C on Fri Jul 31 14:02:18 EDT 2020*/ | |||
| 31 | 7 | static void setMafDecodingBins() { | ||
| 32 |
2/2✓ Branch 1 taken 224 times.
✓ Branch 2 taken 7 times.
|
2/2✓ Decision 'true' taken 224 times.
✓ Decision 'false' taken 7 times.
|
231 | for (size_t i = 0; i < efi::size(hardCodedmafDecodingBins); i++) { |
| 33 | 224 | config->mafDecodingBins[i] = hardCodedmafDecodingBins[i]; | ||
| 34 | 224 | config->mafDecoding[i] = hardCodedmafDecoding[i]; | ||
| 35 | } | |||
| 36 | ||||
| 37 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
1/2✗ Decision 'true' not taken.
✓ Decision 'false' taken 7 times.
|
7 | for (size_t i = efi::size(hardCodedmafDecodingBins); i < MAF_DECODING_COUNT; i++) { |
| 38 | ✗ | config->mafDecodingBins[i] = 4.2 + 0.01 * i; | ||
| 39 | ✗ | config->mafDecoding[i] = 0; | ||
| 40 | } | |||
| 41 | 7 | } | ||
| 42 | ||||
| 43 | static const uint8_t hardCodedveLoadBins[16] = {20, 30, 34, 38, 43, 48, 54, 60, 67, 74, 82, 90, 99, 108, 118, 128}; | |||
| 44 | ||||
| 45 | static const uint16_t hardCodedveRpmBins[16] = {650, 950, 1250, 1600, 1950, 2350, 2750, 3200, 3700, 4200, 4700, 5200, 5800, 6400, 7100, 7800}; | |||
| 46 | ||||
| 47 | static const uint8_t hardCodedveTable[16][16] = { | |||
| 48 | /* Generated by TS2C on Sun Aug 02 10:02:25 EDT 2020*/ | |||
| 49 | {/* 0 20.000 *//* 0 650.0*/40, /* 1 950.0*/42, /* 2 1250.0*/44, /* 3 1600.0*/44, /* 4 1950.0*/45, /* 5 2350.0*/45, /* 6 2750.0*/42, /* 7 3200.0*/41, /* 8 3700.0*/39, /* 9 4200.0*/41, /* 10 4700.0*/43, /* 11 5200.0*/47, /* 12 5800.0*/52, /* 13 6400.0*/55, /* 14 7100.0*/58, /* 15 7800.0*/58, }, | |||
| 50 | {/* 1 30.000 *//* 0 650.0*/46, /* 1 950.0*/49, /* 2 1250.0*/49, /* 3 1600.0*/49, /* 4 1950.0*/49, /* 5 2350.0*/50, /* 6 2750.0*/51, /* 7 3200.0*/50, /* 8 3700.0*/48, /* 9 4200.0*/49, /* 10 4700.0*/54, /* 11 5200.0*/58, /* 12 5800.0*/64, /* 13 6400.0*/66, /* 14 7100.0*/67, /* 15 7800.0*/68, }, | |||
| 51 | {/* 2 34.000 *//* 0 650.0*/51, /* 1 950.0*/55, /* 2 1250.0*/56, /* 3 1600.0*/55, /* 4 1950.0*/56, /* 5 2350.0*/57, /* 6 2750.0*/59, /* 7 3200.0*/58, /* 8 3700.0*/55, /* 9 4200.0*/56, /* 10 4700.0*/59, /* 11 5200.0*/65, /* 12 5800.0*/70, /* 13 6400.0*/71, /* 14 7100.0*/72, /* 15 7800.0*/73, }, | |||
| 52 | {/* 3 38.000 *//* 0 650.0*/55, /* 1 950.0*/58, /* 2 1250.0*/60, /* 3 1600.0*/62, /* 4 1950.0*/62, /* 5 2350.0*/63, /* 6 2750.0*/66, /* 7 3200.0*/66, /* 8 3700.0*/63, /* 9 4200.0*/63, /* 10 4700.0*/67, /* 11 5200.0*/72, /* 12 5800.0*/76, /* 13 6400.0*/78, /* 14 7100.0*/78, /* 15 7800.0*/78, }, | |||
| 53 | {/* 4 43.000 *//* 0 650.0*/62, /* 1 950.0*/64, /* 2 1250.0*/68, /* 3 1600.0*/70, /* 4 1950.0*/70, /* 5 2350.0*/71, /* 6 2750.0*/74, /* 7 3200.0*/74, /* 8 3700.0*/71, /* 9 4200.0*/70, /* 10 4700.0*/73, /* 11 5200.0*/78, /* 12 5800.0*/82, /* 13 6400.0*/83, /* 14 7100.0*/84, /* 15 7800.0*/84, }, | |||
| 54 | {/* 5 48.000 *//* 0 650.0*/69, /* 1 950.0*/72, /* 2 1250.0*/75, /* 3 1600.0*/78, /* 4 1950.0*/78, /* 5 2350.0*/80, /* 6 2750.0*/82, /* 7 3200.0*/81, /* 8 3700.0*/78, /* 9 4200.0*/78, /* 10 4700.0*/78, /* 11 5200.0*/83, /* 12 5800.0*/87, /* 13 6400.0*/90, /* 14 7100.0*/91, /* 15 7800.0*/91, }, | |||
| 55 | {/* 6 54.000 *//* 0 650.0*/75, /* 1 950.0*/79, /* 2 1250.0*/82, /* 3 1600.0*/84, /* 4 1950.0*/84, /* 5 2350.0*/85, /* 6 2750.0*/86, /* 7 3200.0*/86, /* 8 3700.0*/84, /* 9 4200.0*/83, /* 10 4700.0*/85, /* 11 5200.0*/89, /* 12 5800.0*/93, /* 13 6400.0*/96, /* 14 7100.0*/97, /* 15 7800.0*/98, }, | |||
| 56 | {/* 7 60.000 *//* 0 650.0*/80, /* 1 950.0*/83, /* 2 1250.0*/86, /* 3 1600.0*/90, /* 4 1950.0*/88, /* 5 2350.0*/88, /* 6 2750.0*/90, /* 7 3200.0*/89, /* 8 3700.0*/89, /* 9 4200.0*/89, /* 10 4700.0*/91, /* 11 5200.0*/95, /* 12 5800.0*/98, /* 13 6400.0*/101, /* 14 7100.0*/103, /* 15 7800.0*/104, }, | |||
| 57 | {/* 8 67.000 *//* 0 650.0*/85, /* 1 950.0*/87, /* 2 1250.0*/90, /* 3 1600.0*/94, /* 4 1950.0*/93, /* 5 2350.0*/92, /* 6 2750.0*/94, /* 7 3200.0*/93, /* 8 3700.0*/93, /* 9 4200.0*/95, /* 10 4700.0*/97, /* 11 5200.0*/101, /* 12 5800.0*/105, /* 13 6400.0*/107, /* 14 7100.0*/109, /* 15 7800.0*/110, }, | |||
| 58 | {/* 9 74.000 *//* 0 650.0*/90, /* 1 950.0*/92, /* 2 1250.0*/94, /* 3 1600.0*/99, /* 4 1950.0*/98, /* 5 2350.0*/98, /* 6 2750.0*/99, /* 7 3200.0*/98, /* 8 3700.0*/99, /* 9 4200.0*/101, /* 10 4700.0*/105, /* 11 5200.0*/108, /* 12 5800.0*/111, /* 13 6400.0*/112, /* 14 7100.0*/114, /* 15 7800.0*/114, }, | |||
| 59 | {/* 10 82.000 *//* 0 650.0*/96, /* 1 950.0*/96, /* 2 1250.0*/99, /* 3 1600.0*/102, /* 4 1950.0*/103, /* 5 2350.0*/103, /* 6 2750.0*/103, /* 7 3200.0*/105, /* 8 3700.0*/106, /* 9 4200.0*/109, /* 10 4700.0*/111, /* 11 5200.0*/114, /* 12 5800.0*/116, /* 13 6400.0*/118, /* 14 7100.0*/118, /* 15 7800.0*/118, }, | |||
| 60 | {/* 11 90.000 *//* 0 650.0*/100, /* 1 950.0*/101, /* 2 1250.0*/103, /* 3 1600.0*/107, /* 4 1950.0*/107, /* 5 2350.0*/106, /* 6 2750.0*/106, /* 7 3200.0*/108, /* 8 3700.0*/112, /* 9 4200.0*/114, /* 10 4700.0*/117, /* 11 5200.0*/120, /* 12 5800.0*/121, /* 13 6400.0*/122, /* 14 7100.0*/122, /* 15 7800.0*/121, }, | |||
| 61 | {/* 12 99.000 *//* 0 650.0*/104, /* 1 950.0*/105, /* 2 1250.0*/107, /* 3 1600.0*/109, /* 4 1950.0*/109, /* 5 2350.0*/108, /* 6 2750.0*/108, /* 7 3200.0*/110, /* 8 3700.0*/114, /* 9 4200.0*/117, /* 10 4700.0*/120, /* 11 5200.0*/123, /* 12 5800.0*/125, /* 13 6400.0*/124, /* 14 7100.0*/125, /* 15 7800.0*/124, }, | |||
| 62 | {/* 13 108.000 *//* 0 650.0*/105, /* 1 950.0*/106, /* 2 1250.0*/107, /* 3 1600.0*/108, /* 4 1950.0*/109, /* 5 2350.0*/108, /* 6 2750.0*/109, /* 7 3200.0*/110, /* 8 3700.0*/114, /* 9 4200.0*/117, /* 10 4700.0*/119, /* 11 5200.0*/123, /* 12 5800.0*/124, /* 13 6400.0*/126, /* 14 7100.0*/126, /* 15 7800.0*/125, }, | |||
| 63 | {/* 14 118.000 *//* 0 650.0*/105, /* 1 950.0*/106, /* 2 1250.0*/107, /* 3 1600.0*/109, /* 4 1950.0*/110, /* 5 2350.0*/109, /* 6 2750.0*/109, /* 7 3200.0*/111, /* 8 3700.0*/114, /* 9 4200.0*/116, /* 10 4700.0*/119, /* 11 5200.0*/121, /* 12 5800.0*/123, /* 13 6400.0*/125, /* 14 7100.0*/128, /* 15 7800.0*/128, }, | |||
| 64 | {/* 15 128.000 *//* 0 650.0*/104, /* 1 950.0*/105, /* 2 1250.0*/107, /* 3 1600.0*/108, /* 4 1950.0*/108, /* 5 2350.0*/110, /* 6 2750.0*/111, /* 7 3200.0*/112, /* 8 3700.0*/114, /* 9 4200.0*/116, /* 10 4700.0*/118, /* 11 5200.0*/119, /* 12 5800.0*/121, /* 13 6400.0*/124, /* 14 7100.0*/127, /* 15 7800.0*/130, } | |||
| 65 | }; | |||
| 66 | ||||
| 67 | /* Generated by TS2C on Sun Aug 02 10:02:25 EDT 2020*/ | |||
| 68 | 7 | static void setMapVeTable() { | ||
| 69 | #if (VE_LOAD_COUNT == 16) && (VE_RPM_COUNT == 16) | |||
| 70 | 7 | copyArray(config->veLoadBins, hardCodedveLoadBins); | ||
| 71 | 7 | copyArray(config->veRpmBins, hardCodedveRpmBins); | ||
| 72 | 7 | copyTable(config->veTable, hardCodedveTable); | ||
| 73 | #endif | |||
| 74 | 7 | } | ||
| 75 | ||||
| 76 | #if (IGN_LOAD_COUNT == 16) && (IGN_RPM_COUNT == 16) | |||
| 77 | static const uint8_t mapBased16IgnitionTable[16][16] = { | |||
| 78 | /* Generated by TS2C on Wed Jun 15 21:22:11 EDT 2016*/ | |||
| 79 | {/* 0 18.000 *//* 0 650.0*/10, /* 1 1100.0*/11, /* 2 1550.0*/12, /* 3 2000.0*/14, /* 4 2450.0*/15, /* 5 2900.0*/17, /* 6 3350.0*/18, /* 7 3800.0*/20, /* 8 4250.0*/21, /* 9 4700.0*/22, /* 10 5150.0*/24, /* 11 5650.0*/25, /* 12 6100.0*/27, /* 13 6550.0*/28, /* 14 7000.0*/30, /* 15 7450.0*/30, }, | |||
| 80 | {/* 1 24.000 *//* 0 650.0*/10, /* 1 1100.0*/11, /* 2 1550.0*/12, /* 3 2000.0*/14, /* 4 2450.0*/15, /* 5 2900.0*/16, /* 6 3350.0*/18, /* 7 3800.0*/19, /* 8 4250.0*/21, /* 9 4700.0*/22, /* 10 5150.0*/23, /* 11 5650.0*/25, /* 12 6100.0*/26, /* 13 6550.0*/28, /* 14 7000.0*/29, /* 15 7450.0*/29, }, | |||
| 81 | {/* 2 33.000 *//* 0 650.0*/10, /* 1 1100.0*/11, /* 2 1550.0*/13, /* 3 2000.0*/14, /* 4 2450.0*/15, /* 5 2900.0*/16, /* 6 3350.0*/17, /* 7 3800.0*/19, /* 8 4250.0*/20, /* 9 4700.0*/21, /* 10 5150.0*/22, /* 11 5650.0*/24, /* 12 6100.0*/25, /* 13 6550.0*/26, /* 14 7000.0*/27, /* 15 7450.0*/27, }, | |||
| 82 | {/* 3 39.000 *//* 0 650.0*/10, /* 1 1100.0*/11, /* 2 1550.0*/13, /* 3 2000.0*/14, /* 4 2450.0*/15, /* 5 2900.0*/16, /* 6 3350.0*/17, /* 7 3800.0*/18, /* 8 4250.0*/20, /* 9 4700.0*/21, /* 10 5150.0*/22, /* 11 5650.0*/23, /* 12 6100.0*/24, /* 13 6550.0*/25, /* 14 7000.0*/27, /* 15 7450.0*/27, }, | |||
| 83 | {/* 4 45.000 *//* 0 650.0*/11, /* 1 1100.0*/12, /* 2 1550.0*/13, /* 3 2000.0*/14, /* 4 2450.0*/15, /* 5 2900.0*/16, /* 6 3350.0*/17, /* 7 3800.0*/18, /* 8 4250.0*/19, /* 9 4700.0*/20, /* 10 5150.0*/21, /* 11 5650.0*/22, /* 12 6100.0*/24, /* 13 6550.0*/25, /* 14 7000.0*/26, /* 15 7450.0*/26, }, | |||
| 84 | {/* 5 51.000 *//* 0 650.0*/11, /* 1 1100.0*/11, /* 2 1550.0*/12, /* 3 2000.0*/13, /* 4 2450.0*/14, /* 5 2900.0*/15, /* 6 3350.0*/16, /* 7 3800.0*/17, /* 8 4250.0*/18, /* 9 4700.0*/19, /* 10 5150.0*/21, /* 11 5650.0*/22, /* 12 6100.0*/23, /* 13 6550.0*/24, /* 14 7000.0*/25, /* 15 7450.0*/25, }, | |||
| 85 | {/* 6 60.000 *//* 0 650.0*/9, /* 1 1100.0*/10, /* 2 1550.0*/11, /* 3 2000.0*/12, /* 4 2450.0*/13, /* 5 2900.0*/14, /* 6 3350.0*/15, /* 7 3800.0*/16, /* 8 4250.0*/17, /* 9 4700.0*/18, /* 10 5150.0*/19, /* 11 5650.0*/20, /* 12 6100.0*/21, /* 13 6550.0*/22, /* 14 7000.0*/23, /* 15 7450.0*/23, }, | |||
| 86 | {/* 7 66.000 *//* 0 650.0*/9, /* 1 1100.0*/10, /* 2 1550.0*/11, /* 3 2000.0*/12, /* 4 2450.0*/13, /* 5 2900.0*/14, /* 6 3350.0*/15, /* 7 3800.0*/16, /* 8 4250.0*/17, /* 9 4700.0*/18, /* 10 5150.0*/19, /* 11 5650.0*/20, /* 12 6100.0*/21, /* 13 6550.0*/22, /* 14 7000.0*/23, /* 15 7450.0*/23, }, | |||
| 87 | {/* 8 72.000 *//* 0 650.0*/8, /* 1 1100.0*/9, /* 2 1550.0*/10, /* 3 2000.0*/11, /* 4 2450.0*/12, /* 5 2900.0*/13, /* 6 3350.0*/14, /* 7 3800.0*/15, /* 8 4250.0*/16, /* 9 4700.0*/17, /* 10 5150.0*/18, /* 11 5650.0*/19, /* 12 6100.0*/20, /* 13 6550.0*/21, /* 14 7000.0*/22, /* 15 7450.0*/22, }, | |||
| 88 | {/* 9 78.000 *//* 0 650.0*/8, /* 1 1100.0*/9, /* 2 1550.0*/10, /* 3 2000.0*/11, /* 4 2450.0*/12, /* 5 2900.0*/13, /* 6 3350.0*/14, /* 7 3800.0*/14, /* 8 4250.0*/15, /* 9 4700.0*/16, /* 10 5150.0*/17, /* 11 5650.0*/18, /* 12 6100.0*/19, /* 13 6550.0*/20, /* 14 7000.0*/21, /* 15 7450.0*/21, }, | |||
| 89 | {/* 10 84.000 *//* 0 650.0*/7, /* 1 1100.0*/8, /* 2 1550.0*/9, /* 3 2000.0*/10, /* 4 2450.0*/11, /* 5 2900.0*/12, /* 6 3350.0*/13, /* 7 3800.0*/14, /* 8 4250.0*/15, /* 9 4700.0*/16, /* 10 5150.0*/17, /* 11 5650.0*/18, /* 12 6100.0*/19, /* 13 6550.0*/19, /* 14 7000.0*/20, /* 15 7450.0*/20, }, | |||
| 90 | {/* 11 93.000 *//* 0 650.0*/7, /* 1 1100.0*/8, /* 2 1550.0*/8, /* 3 2000.0*/9, /* 4 2450.0*/10, /* 5 2900.0*/11, /* 6 3350.0*/12, /* 7 3800.0*/13, /* 8 4250.0*/14, /* 9 4700.0*/15, /* 10 5150.0*/16, /* 11 5650.0*/17, /* 12 6100.0*/17, /* 13 6550.0*/18, /* 14 7000.0*/19, /* 15 7450.0*/19, }, | |||
| 91 | {/* 12 99.000 *//* 0 650.0*/6, /* 1 1100.0*/6, /* 2 1550.0*/8, /* 3 2000.0*/9, /* 4 2450.0*/9, /* 5 2900.0*/10, /* 6 3350.0*/11, /* 7 3800.0*/12, /* 8 4250.0*/13, /* 9 4700.0*/14, /* 10 5150.0*/15, /* 11 5650.0*/16, /* 12 6100.0*/17, /* 13 6550.0*/17, /* 14 7000.0*/18, /* 15 7450.0*/18, }, | |||
| 92 | {/* 13 105.000 *//* 0 650.0*/6, /* 1 1100.0*/7, /* 2 1550.0*/7, /* 3 2000.0*/8, /* 4 2450.0*/9, /* 5 2900.0*/10, /* 6 3350.0*/11, /* 7 3800.0*/12, /* 8 4250.0*/12, /* 9 4700.0*/13, /* 10 5150.0*/14, /* 11 5650.0*/15, /* 12 6100.0*/16, /* 13 6550.0*/17, /* 14 7000.0*/18, /* 15 7450.0*/18, }, | |||
| 93 | {/* 14 111.000 *//* 0 650.0*/5, /* 1 1100.0*/6, /* 2 1550.0*/7, /* 3 2000.0*/8, /* 4 2450.0*/8, /* 5 2900.0*/9, /* 6 3350.0*/10, /* 7 3800.0*/11, /* 8 4250.0*/12, /* 9 4700.0*/13, /* 10 5150.0*/13, /* 11 5650.0*/14, /* 12 6100.0*/15, /* 13 6550.0*/16, /* 14 7000.0*/17, /* 15 7450.0*/17, }, | |||
| 94 | {/* 15 120.000 *//* 0 650.0*/5, /* 1 1100.0*/5, /* 2 1550.0*/6, /* 3 2000.0*/7, /* 4 2450.0*/8, /* 5 2900.0*/8, /* 6 3350.0*/9, /* 7 3800.0*/10, /* 8 4250.0*/11, /* 9 4700.0*/12, /* 10 5150.0*/12, /* 11 5650.0*/13, /* 12 6100.0*/14, /* 13 6550.0*/15, /* 14 7000.0*/16, /* 15 7450.0*/16, }, | |||
| 95 | }; | |||
| 96 | #endif | |||
| 97 | ||||
| 98 | 7 | void miataNAcommonEngineSettings() { | ||
| 99 | 7 | engineConfiguration->trigger.type = trigger_type_e::TT_MAZDA_MIATA_NA; | ||
| 100 | 7 | engineConfiguration->cylindersCount = 4; | ||
| 101 | 7 | engineConfiguration->firingOrder = FO_1_3_4_2; | ||
| 102 | 7 | engineConfiguration->compressionRatio = 9.1; | ||
| 103 | 7 | engineConfiguration->cranking.rpm = 400; | ||
| 104 | 7 | engineConfiguration->cylinderBore = 78; | ||
| 105 | 7 | config->dynoCarCarMassKg = 950; | ||
| 106 | // engineConfiguration->totalGearsCount = 5; | |||
| 107 | ||||
| 108 | 7 | engineConfiguration->rpmHardLimit = 7200; | ||
| 109 | 7 | engineConfiguration->enableFan1WithAc = true; | ||
| 110 | 7 | engineConfiguration->enableFan2WithAc = true; | ||
| 111 | ||||
| 112 | 7 | engineConfiguration->tachPulsePerRev = 2; | ||
| 113 | ||||
| 114 | 7 | setCommonNTCSensorParameters(&engineConfiguration->clt); | ||
| 115 | 7 | setCommonNTCSensorParameters(&engineConfiguration->iat); | ||
| 116 | ||||
| 117 | #if IGN_LOAD_COUNT == 16 && IGN_RPM_COUNT == 16 | |||
| 118 | 7 | copyTable(config->ignitionTable, mapBased16IgnitionTable); | ||
| 119 | #endif | |||
| 120 | ||||
| 121 | #ifdef HW_HELLEN_UAEFI | |||
| 122 | engineConfiguration->injectionPins[4] = Gpio::Unassigned; | |||
| 123 | engineConfiguration->injectionPins[5] = Gpio::Unassigned; | |||
| 124 | engineConfiguration->ignitionPins[4] = Gpio::Unassigned; | |||
| 125 | engineConfiguration->ignitionPins[5] = Gpio::Unassigned; | |||
| 126 | ||||
| 127 | engineConfiguration->camInputs[0] = Gpio::Unassigned; | |||
| 128 | engineConfiguration->camInputs[1] = Gpio::Unassigned; | |||
| 129 | // Gpio::MM100_IN_D1; // HALL1 | |||
| 130 | // Gpio::MM100_IN_D2; // HALL2 | |||
| 131 | // engineConfiguration->triggerInputPins[1] = | |||
| 132 | #endif // HW_HELLEN_UAEFI | |||
| 133 | ||||
| 134 | 7 | miataNA_setCltIdleCorrBins(); | ||
| 135 | 7 | miataNA_setCltIdleRpmBins(); | ||
| 136 | 7 | miataNA_setIacCoastingBins(); | ||
| 137 | 7 | setMafDecodingBins(); | ||
| 138 | 7 | miataNA_setIgnitionTable(); | ||
| 139 | ||||
| 140 | 7 | engineConfiguration->ignitionMode = IM_WASTED_SPARK; | ||
| 141 | ||||
| 142 | 7 | setMapVeTable(); | ||
| 143 | ||||
| 144 | 7 | engineConfiguration->idleMode = idle_mode_e::IM_AUTO; | ||
| 145 | // below 20% this valve seems to be opening for fail-safe idle air | |||
| 146 | 7 | engineConfiguration->idleRpmPid.minValue = 20; | ||
| 147 | 7 | engineConfiguration->idleRpmPid.pFactor = 0.01; | ||
| 148 | 7 | engineConfiguration->idleRpmPid.iFactor = 0.00001; | ||
| 149 | 7 | engineConfiguration->idleRpmPid.dFactor = 0.0001; | ||
| 150 | 7 | engineConfiguration->idleRpmPid.periodMs = 100; | ||
| 151 | ||||
| 152 | /** | |||
| 153 | * http://miataturbo.wikidot.com/fuel-injectors | |||
| 154 | * 90-93 (Blue) - #195500-1970 | |||
| 155 | */ | |||
| 156 | 7 | engineConfiguration->injector.flow = 212; | ||
| 157 | ||||
| 158 | // set cranking_timing_angle 10 | |||
| 159 | 7 | engineConfiguration->crankingTimingAngle = 10; | ||
| 160 | ||||
| 161 | 7 | engineConfiguration->map.sensor.type = MT_GM_3_BAR; | ||
| 162 | ||||
| 163 | // chartsize 200 | |||
| 164 | 7 | engineConfiguration->engineChartSize = 200; | ||
| 165 | 7 | setTable(config->crankingCycleBaseFuel, 27.5); | ||
| 166 | ||||
| 167 | 7 | engineConfiguration->displacement = 1.6; | ||
| 168 | 7 | strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA); | ||
| 169 | 7 | strcpy(engineConfiguration->engineCode, "NA6"); | ||
| 170 | ||||
| 171 | // my car was originally a manual so proper TPS | |||
| 172 | 7 | engineConfiguration->tpsMin = 100; // convert 12to10 bit (ADC/4) | ||
| 173 | 7 | engineConfiguration->tpsMax = 650; // convert 12to10 bit (ADC/4) | ||
| 174 | ||||
| 175 | 7 | engineConfiguration->injectionMode = IM_BATCH; | ||
| 176 | ||||
| 177 | // CLT/IAT | |||
| 178 | 7 | engineConfiguration->clt.config = { -20, 40, 80, 16150, 1150, 330, 2700 }; | ||
| 179 | 7 | engineConfiguration->iat.config = { -20, 40, 80, 16150, 1150, 330, 2700 }; | ||
| 180 | ||||
| 181 | 7 | engineConfiguration->map.sensor.type = MT_GM_3_BAR; | ||
| 182 | ||||
| 183 | // Vehicle speed/gears | |||
| 184 | 7 | engineConfiguration->totalGearsCount = 5; | ||
| 185 | 7 | engineConfiguration->gearRatio[0] = 3.136; | ||
| 186 | 7 | engineConfiguration->gearRatio[1] = 1.888; | ||
| 187 | 7 | engineConfiguration->gearRatio[2] = 1.330; | ||
| 188 | 7 | engineConfiguration->gearRatio[3] = 1.000; | ||
| 189 | 7 | engineConfiguration->gearRatio[4] = 0.814; | ||
| 190 | ||||
| 191 | // These may need to change based on your real car | |||
| 192 | 7 | engineConfiguration->driveWheelRevPerKm = 551; | ||
| 193 | 7 | engineConfiguration->finalGearRatio = 4.3; | ||
| 194 | ||||
| 195 | // This should be correct for factory matched speedo gears and diffs, | |||
| 196 | // but will need to be adjusted for mismatched combinations. | |||
| 197 | ||||
| 198 | // - 6 teeth on transmission output shaft | |||
| 199 | // - 23 teeth on speedometer sensor | |||
| 200 | // - 4.3 rear axle ratio | |||
| 201 | // 4.3 * 6 / 23 ~= 1.12 | |||
| 202 | 7 | engineConfiguration->vssGearRatio = 4.3 * 6 / 23; | ||
| 203 | 7 | engineConfiguration->vssToothCount = 4; | ||
| 204 | 7 | } | ||
| 205 | ||||
| 206 | /** | |||
| 207 | * MIATA_NA6_MAP | |||
| 208 | */ | |||
| 209 | 7 | void setMiataNA6_MAP_Frankenso() { | ||
| 210 | 7 | setFrankensoConfiguration(); | ||
| 211 | 7 | miataNAcommonEngineSettings(); | ||
| 212 | ||||
| 213 | ||||
| 214 | // Frankenso middle plug 2J, W32 top <> W47 bottom "#5 Green" jumper, not OEM | |||
| 215 | 7 | engineConfiguration->map.sensor.hwChannel = EFI_ADC_4; | ||
| 216 | ||||
| 217 | 7 | engineConfiguration->mafAdcChannel = EFI_ADC_0; | ||
| 218 | ||||
| 219 | // Wide band oxygen (from middle plug) to W52 | |||
| 220 | 7 | engineConfiguration->afr.hwChannel = EFI_ADC_13; // PA3 | ||
| 221 | ||||
| 222 | 7 | engineConfiguration->vbattDividerCoeff = 9.75;// ((float) (8.2 + 33)) / 8.2 * 2; | ||
| 223 | ||||
| 224 | 7 | engineConfiguration->isSdCardEnabled = true; | ||
| 225 | ||||
| 226 | 7 | engineConfiguration->injectionPins[0] = Gpio::D3; // #1&3 pin 3U | ||
| 227 | 7 | engineConfiguration->injectionPins[1] = Gpio::E2; // #2&4 pin 3V | ||
| 228 | 7 | engineConfiguration->injectionPins[2] = Gpio::Unassigned; | ||
| 229 | 7 | engineConfiguration->injectionPins[3] = Gpio::Unassigned; | ||
| 230 | ||||
| 231 | // white wire from 1E - TOP of W4 to BOTTOM W62 | |||
| 232 | 7 | engineConfiguration->malfunctionIndicatorPin = Gpio::D5; | ||
| 233 | ||||
| 234 | // yellow wire from 1V/W22 to bottom of W48 | |||
| 235 | 7 | engineConfiguration->clutchDownPin = Gpio::A3; | ||
| 236 | 7 | engineConfiguration->clutchDownPinMode = PI_PULLUP; | ||
| 237 | ||||
| 238 | // green wire from 1Q/W17 to bottom of W46 | |||
| 239 | 7 | engineConfiguration->acSwitch = Gpio::A6; | ||
| 240 | ||||
| 241 | #if ! EFI_UNIT_TEST | |||
| 242 | // W57 PE3 A/C compressor relay out | |||
| 243 | engineConfiguration->acRelayPin = Gpio::E3; | |||
| 244 | // W58 PE4 A/C fan relay out | |||
| 245 | #endif /* EFI_UNIT_TEST */ | |||
| 246 | ||||
| 247 | 7 | engineConfiguration->idle.solenoidPin = Gpio::B9; // this W61 <> W61 jumper, pin 3W | ||
| 248 | ||||
| 249 | 7 | engineConfiguration->ignitionPins[0] = Gpio::E14; // Frankenso high side - pin 1G | ||
| 250 | 7 | engineConfiguration->ignitionPins[1] = Gpio::Unassigned; | ||
| 251 | 7 | engineConfiguration->ignitionPins[2] = Gpio::C7; // Frankenso high side - pin 1H | ||
| 252 | 7 | engineConfiguration->ignitionPins[3] = Gpio::Unassigned; | ||
| 253 | ||||
| 254 | #if defined(HW_NUCLEO_F767) || defined(HW_NUCLEO_H743) | |||
| 255 | // default PA1-6 ADC pins conflict with the ethernet module on F767, used on HW CI | |||
| 256 | engineConfiguration->afr.hwChannel = EFI_ADC_36; | |||
| 257 | engineConfiguration->map.sensor.hwChannel = EFI_ADC_39; | |||
| 258 | engineConfiguration->acSwitch = Gpio::Unassigned; | |||
| 259 | engineConfiguration->camInputs[0] = Gpio::E0; | |||
| 260 | #endif | |||
| 261 | ||||
| 262 | 7 | } | ||
| 263 | ||||
| 264 | ✗ | void setMazdaMiataNA94() { | ||
| 265 | ✗ | miataNAcommonEngineSettings(); | ||
| 266 | ✗ | strcpy(engineConfiguration->engineCode, "94"); | ||
| 267 | /** | |||
| 268 | * http://miataturbo.wikidot.com/fuel-injectors | |||
| 269 | * 94-97 Tan - #195500-2180 | |||
| 270 | */ | |||
| 271 | ✗ | engineConfiguration->injector.flow = 254; | ||
| 272 | ||||
| 273 | ✗ | engineConfiguration->displacement = 1.8; | ||
| 274 | ✗ | engineConfiguration->injectionMode = IM_SEQUENTIAL; | ||
| 275 | ✗ | engineConfiguration->map.sensor.type = MT_MPX4250; | ||
| 276 | ||||
| 277 | ✗ | engineConfiguration->fanOnTemperature = 100; | ||
| 278 | ✗ | engineConfiguration->fanOffTemperature = 96; | ||
| 279 | ✗ | engineConfiguration->fan2OnTemperature = 95; | ||
| 280 | ✗ | engineConfiguration->fan2OffTemperature = 91; | ||
| 281 | ||||
| 282 | #ifdef HW_HELLEN_MIATA_NA6 | |||
| 283 | engineConfiguration->fan2Pin = Gpio::D9; // 3S - A/C Fan 94-95 | |||
| 284 | #endif //HW_HELLEN_MIATA_NA6 | |||
| 285 | ✗ | } | ||
| 286 | ||||
| 287 | ✗ | void setMazdaMiataNA6() { | ||
| 288 | ✗ | miataNAcommonEngineSettings(); | ||
| 289 | ✗ | engineConfiguration->map.sensor.type = MT_MPX4250; | ||
| 290 | ✗ | } | ||
| 291 |