nissan 4yl crank pattern (#3462)

* refactoring nissan trigger

* comments

* plumbing

* b
This commit is contained in:
Matthew Kennedy 2021-11-05 04:15:03 -07:00 committed by GitHub
parent 1ead914f93
commit 365691cb37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 8 deletions

View File

@ -515,13 +515,15 @@ typedef enum {
TT_HONDA_K_4_1 = 67,
TT_NISSAN_MR18_CRANK = 68,
// do not forget to edit "#define trigger_type_e_enum" line in integration/rusefi_config.txt file to propogate new value to rusefi.ini TS project
// do not forget to invoke "gen_config.bat" once you make changes to integration/rusefi_config.txt
// todo: one day a hero would integrate some of these things into Makefile in order to reduce manual magic
//
// Another point: once you add a new trigger, run get_trigger_images.bat which would run rusefi_test.exe from unit_tests
//
TT_UNUSED = 68, // this is used if we want to iterate over all trigger types
TT_UNUSED = 69, // this is used if we want to iterate over all trigger types
// todo: convert to ENUM_16_BITS? I can see 257 triggers but not 65K triggers
Force_4_bytes_size_trigger_type = ENUM_32_BITS,

View File

@ -129,20 +129,40 @@ void initializeNissanVQvvt(TriggerWaveform *s) {
s->setTriggerSynchronizationGap(5);
}
void initializeNissanVQ35crank(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR);
void makeNissanPattern(TriggerWaveform* s, size_t halfCylinderCount, size_t totalWheel, size_t missing) {
s->setTriggerSynchronizationGap(0.33);
s->tdcPosition = 675;
auto toothAngle = 360.0f / totalWheel;
float currentAngle = 20;
for (int i = 0;i < 10;i++) {
currentAngle += 10;
auto patternTeeth = totalWheel / halfCylinderCount;
auto toothCount = patternTeeth - missing;
float currentAngle = missing * toothAngle;
for (int i = 0; i < toothCount; i++) {
currentAngle += toothAngle;
s->addEventAngle(currentAngle - 5, T_PRIMARY, TV_RISE);
s->addEventAngle(currentAngle, T_PRIMARY, TV_FALL);
}
}
void initializeNissanVQ35crank(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR);
s->tdcPosition = 675;
// 6 cylinder = 36 tooth wheel, missing 2 teeth in 3 spots
makeNissanPattern(s, 3, 36, 2);
}
void initializeNissanMR18crank(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR);
s->tdcPosition = 640;
// 4 cylinder = 36 tooth wheel, missing 2 teeth in 2 spots
makeNissanPattern(s, 2, 36, 2);
}
void initializeNissanQR25crank(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR);
s->setTriggerSynchronizationGap(0.33);

View File

@ -14,6 +14,7 @@ void initializeNissanSR20VE_4_360(TriggerWaveform *s);
void initializeNissanVQvvt(TriggerWaveform *s);
void initializeNissanVQ35crank(TriggerWaveform *s);
void initializeNissanMR18crank(TriggerWaveform *s);
void initializeNissanQR25crank(TriggerWaveform *s);
void initializeNissanVQ30cam(TriggerWaveform *s);

View File

@ -578,6 +578,10 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat
initializeNissanVQ35crank(this);
break;
case TT_NISSAN_MR18_CRANK:
initializeNissanMR18crank(this);
break;
case TT_KAWA_KX450F:
configureKawaKX450F(this);
break;

View File

@ -583,7 +583,7 @@ adc_channel_e fuelLevelSensor;+This is the processor pin that your fuel level se
struct trigger_config_s @brief Trigger wheel(s) configuration
#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Miata NB", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "Honda 4+24+1", "Mitsubishi", "Honda 4+24", "Honda 1+4+24", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "INVALID", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "dev 2JZ 3/34 simulator", "Rover K", "GM LS 24", "Honda CBR 600", "2JZ_1_12", "Honda CBR 600 custom", "3/1 skipped", "Dodge Neon 2003 crank", "Miata VVT", "trg34", "trg35", "Subaru 7+6", "Jeep 18-2-2-2", "WIP", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "trg43", "Renix 44-2-2", "Renix 66-2-2-2", "Honda K 12+1", "trg47", "36/2", "Subaru SVX", "1+16", "Subaru 7 without 6", "trg52", "TriTach", "GM 60/2/2/2", "Skoda Favorit", "Barra 3+1 Cam", "Kawa KX450F", "Nissan VQ35", "trg59", "Nissan VQ30", "Nissan QR25", "trg62", "Subaru SVX Crank 1", "Subaru SVX Cam VVT", "Ford PIP", "Suzuki G13B", "Honda K 4+1", "trg68", "trg69"
#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Miata NB", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "Honda 4+24+1", "Mitsubishi", "Honda 4+24", "Honda 1+4+24", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "INVALID", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "dev 2JZ 3/34 simulator", "Rover K", "GM LS 24", "Honda CBR 600", "2JZ_1_12", "Honda CBR 600 custom", "3/1 skipped", "Dodge Neon 2003 crank", "Miata VVT", "trg34", "trg35", "Subaru 7+6", "Jeep 18-2-2-2", "WIP", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "trg43", "Renix 44-2-2", "Renix 66-2-2-2", "Honda K 12+1", "trg47", "36/2", "Subaru SVX", "1+16", "Subaru 7 without 6", "trg52", "TriTach", "GM 60/2/2/2", "Skoda Favorit", "Barra 3+1 Cam", "Kawa KX450F", "Nissan VQ35", "trg59", "Nissan VQ30", "Nissan QR25", "trg62", "Subaru SVX Crank 1", "Subaru SVX Cam VVT", "Ford PIP", "Suzuki G13B", "Honda K 4+1", "Nissan MR18 Crank", "trg69"
custom trigger_type_e 4 bits, U32, @OFFSET@, [0:6], @@trigger_type_e_enum@@
trigger_type_e type;+https://github.com/rusefi/rusefi/wiki/All-Supported-Triggers\nset trigger_type X