| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | /* | |||
| 2 | * @file nissan_vq.cpp | |||
| 3 | * | |||
| 4 | * Created on: Jul 2, 2021 | |||
| 5 | * @author Andrey Belomutskiy, (c) 2012-2021 | |||
| 6 | */ | |||
| 7 | ||||
| 8 | #include "pch.h" | |||
| 9 | ||||
| 10 | #include "nissan_vq.h" | |||
| 11 | #include "hellen_all_meta.h" | |||
| 12 | #include "defaults.h" | |||
| 13 | ||||
| 14 | #define NISSAN_VQ_VVT_OFFSET 157 | |||
| 15 | ||||
| 16 | ✗ | void setHellen121nissanQR() { | ||
| 17 | ✗ | engineConfiguration->trigger.type = trigger_type_e::TT_NISSAN_QR25; | ||
| 18 | ||||
| 19 | ✗ | setInline4(); | ||
| 20 | ✗ | engineConfiguration->displacement = 2; | ||
| 21 | ✗ | strcpy(engineConfiguration->engineCode, "QR"); | ||
| 22 | ||||
| 23 | ✗ | engineConfiguration->camInputs[1 * CAMS_PER_BANK] = Gpio::Unassigned; | ||
| 24 | ||||
| 25 | ✗ | engineConfiguration->vvtMode[0] = VVT_NISSAN_VQ; | ||
| 26 | ||||
| 27 | // we have this here and not in board_configuration.cpp so that unit test would get this value | |||
| 28 | ✗ | engineConfiguration->invertCamVVTSignal = true; | ||
| 29 | ||||
| 30 | ✗ | engineConfiguration->vvtOffsets[0] = 157; | ||
| 31 | ||||
| 32 | ✗ | } | ||
| 33 | ||||
| 34 | 3 | static void setNissanVqEngineConfig() { | ||
| 35 | 3 | setNissanMAF0031(); | ||
| 36 | 3 | engineConfiguration->trigger.type = trigger_type_e::TT_NISSAN_VQ35; | ||
| 37 | ||||
| 38 | 3 | engineConfiguration->cylindersCount = 6; | ||
| 39 | 3 | engineConfiguration->firingOrder = FO_1_2_3_4_5_6; | ||
| 40 | 3 | engineConfiguration->displacement = 4; | ||
| 41 | 3 | strcpy(engineConfiguration->engineCode, "VQ"); | ||
| 42 | ||||
| 43 | 3 | engineConfiguration->vvtMode[0] = VVT_NISSAN_VQ; | ||
| 44 | ||||
| 45 | 3 | engineConfiguration->vvtOffsets[0 * CAMS_PER_BANK] = NISSAN_VQ_VVT_OFFSET; | ||
| 46 | 3 | engineConfiguration->vvtOffsets[1 * CAMS_PER_BANK] = NISSAN_VQ_VVT_OFFSET + NISSAN_VQ_CAM_OFFSET; | ||
| 47 | ||||
| 48 | // VVT closed loop | |||
| 49 | 3 | engineConfiguration->auxPid[0].pFactor = 2; | ||
| 50 | 3 | engineConfiguration->auxPid[0].iFactor = 0.5; | ||
| 51 | 3 | engineConfiguration->auxPid[0].dFactor = 0.05; | ||
| 52 | 3 | engineConfiguration->auxPid[0].offset = 50; | ||
| 53 | // engineConfiguration->auxPid[0].minValue = 20; | |||
| 54 | // engineConfiguration->auxPid[0].maxValue = 90; | |||
| 55 | ||||
| 56 | 3 | setTable(config->crankingCycleBaseFuel, 35); | ||
| 57 | 3 | } | ||
| 58 | ||||
| 59 | 3 | void setHellen121nissanVQ() { | ||
| 60 | #include "nissan_vq.lua" | |||
| 61 | ||||
| 62 | 3 | setNissanVqEngineConfig(); | ||
| 63 | ||||
| 64 | // we have this here and not in board_configuration.cpp so that unit test would get this value | |||
| 65 | 3 | engineConfiguration->invertCamVVTSignal = true; | ||
| 66 | ||||
| 67 | #if HW_HELLEN && EFI_PROD_CODE | |||
| 68 | engineConfiguration->vvtPins[0 * CAMS_PER_BANK] = H176_LS_7; | |||
| 69 | engineConfiguration->vvtPins[1 * CAMS_PER_BANK] = H176_LS_8; | |||
| 70 | #endif | |||
| 71 | 3 | } | ||
| 72 | ||||
| 73 | ✗ | void setProteusNissanVQ() { | ||
| 74 | ✗ | setNissanVqEngineConfig(); | ||
| 75 | ||||
| 76 | // open question if that's a board setting or engine setting | |||
| 77 | ✗ | engineConfiguration->invertCamVVTSignal = true; | ||
| 78 | ✗ | } | ||
| 79 | ||||
| 80 | ✗ | void setHellen121nissanAltimaN16() { | ||
| 81 | // https://en.wikipedia.org/wiki/Nissan_QG_engine | |||
| 82 | // https://en.wikipedia.org/wiki/N-VCT | |||
| 83 | ✗ | setHellen121nissanQR(); | ||
| 84 | ✗ | engineConfiguration->displacement = 1.8; | ||
| 85 | ✗ | strcpy(engineConfiguration->engineCode, "N16"); | ||
| 86 | ||||
| 87 | ✗ | } | ||
| 88 |