From c049eea877c7de0e5628f992403f18faa937620b Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 1 Mar 2018 06:01:15 -0500 Subject: [PATCH] fix #570 --- .../trigger/decoders/trigger_chrysler.cpp | 67 ++++++++++--------- .../controllers/trigger/trigger_central.cpp | 2 + .../controllers/trigger/trigger_decoder.cpp | 5 +- .../controllers/trigger/trigger_structure.cpp | 2 +- firmware/rusefi.cpp | 2 +- .../models/src/com/rusefi/config/Fields.java | 4 +- unit_tests/triggers.txt | 50 +++++++++----- 7 files changed, 79 insertions(+), 53 deletions(-) diff --git a/firmware/controllers/trigger/decoders/trigger_chrysler.cpp b/firmware/controllers/trigger/decoders/trigger_chrysler.cpp index 513adcde61..4da86559ca 100644 --- a/firmware/controllers/trigger/decoders/trigger_chrysler.cpp +++ b/firmware/controllers/trigger/decoders/trigger_chrysler.cpp @@ -32,7 +32,7 @@ void configureNeon2003TriggerShapeCrank(TriggerShape *s DECLARE_ENGINE_PARAMETER s->useRiseEdge = true; s->setTriggerSynchronizationGap(3); - int m = 2; + int m = CRANK_MODE_MULTIPLIER; s->addEvent2(m * 25, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); s->addEvent2(m * 30, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); @@ -394,44 +394,46 @@ static void configureNeon1995TriggerShapeCommon(bool withCam, TriggerShape *s DE trigger_wheel_e crank = withCam ? T_SECONDARY : T_PRIMARY; // voodoo magic - we always need 720 at the end - int base = 720 - 560; + int base = withCam ? 720 - 560 : 360 - 135; - s->addEvent2(base - 720 + 600, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base - 720 + 604, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base - 720 + 616, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base - 720 + 620, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base - 720 + 643, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base - 720 + 648, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base - 720 + 671, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base - 720 + 676, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + float m = withCam ? 1 : 2; - if (withCam) + s->addEvent2(m * (base - 120), crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base - 116), crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base - 720 + 616), crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base - 100), crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base - 720 + 643), crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base - 720 + 648), crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base - 720 + 671), crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base - 44), crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + + if (withCam) { s->addEvent2(base + 0, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + } + s->addEvent2(m * (base + 20), crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base + 60), crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base + 75), crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base + 79), crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base + 101), crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base + 106), crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base + 130), crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(m * (base + 135), crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 20, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 60, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 75, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 79, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 101, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 106, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 130, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 135, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - - if (withCam) + if (withCam) { s->addEvent2(base + 200, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); // width = 150 - s->addEvent2(base + 236, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 239, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 250, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 255, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 277, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 282, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 305, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - s->addEvent2(base + 310, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(base + 236, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(base + 239, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(base + 250, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(base + 255, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(base + 277, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(base + 282, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(base + 305, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); + s->addEvent2(base + 310, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); s->addEvent2(base + 374, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); - if (withCam) +// if (withCam) s->addEvent2(base + 395, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); // width = s->addEvent2(base + 418, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); @@ -442,12 +444,15 @@ static void configureNeon1995TriggerShapeCommon(bool withCam, TriggerShape *s DE s->addEvent2(base + 492, crank, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); s->addEvent2(base + 497, crank, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX); - if (withCam) +// if (withCam) s->addEvent2(base + 560, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX); // width = + + } } void configureNeon1995TriggerShapeOnlyCrank(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) { s->initialize(FOUR_STROKE_CRANK_SENSOR, false); + s->setTriggerSynchronizationGap(3.79); configureNeon1995TriggerShapeCommon(false, s PASS_ENGINE_PARAMETER_SUFFIX); } diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index b978e17500..e68145c21e 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -384,6 +384,8 @@ void printAllTriggers() { TriggerShape *s = &engine->triggerCentral.triggerShape; s->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX); + efiAssertVoid(!s->shapeDefinitionError, "trigger error"); + fprintf(fp, "TRIGGERTYPE %d %d %s %.2f\n", triggerId, s->getLength(), getTrigger_type_e(tt), s->tdcPosition); fprintf(fp, "# duty %.2f %.2f\n", s->expectedDutyCycle[0], s->expectedDutyCycle[1]); diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 75c898d3b7..b1ee2b1c94 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -475,10 +475,13 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET break; case TT_DODGE_NEON_1995: - case TT_DODGE_NEON_1995_ONLY_CRANK: configureNeon1995TriggerShape(this PASS_ENGINE_PARAMETER_SUFFIX); break; + case TT_DODGE_NEON_1995_ONLY_CRANK: + configureNeon1995TriggerShapeOnlyCrank(this PASS_ENGINE_PARAMETER_SUFFIX); + break; + case TT_DODGE_STRATUS: configureDodgeStratusTriggerShape(this PASS_ENGINE_PARAMETER_SUFFIX); break; diff --git a/firmware/controllers/trigger/trigger_structure.cpp b/firmware/controllers/trigger/trigger_structure.cpp index 1c0f230617..446d8b2b47 100644 --- a/firmware/controllers/trigger/trigger_structure.cpp +++ b/firmware/controllers/trigger/trigger_structure.cpp @@ -337,7 +337,7 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri efiAssertVoid(angle > 0, "angle should be positive"); if (size > 0) { if (angle <= previousAngle) { - warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: %.2f and %.2f, size=%d", angle, previousAngle, size); + warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: new=%.2f and prev=%.2f, size=%d", angle, previousAngle, size); shapeDefinitionError = true; return; } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 4b61b91268..610dd1085c 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -276,5 +276,5 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20180210; + return 20180301; } diff --git a/java_console/models/src/com/rusefi/config/Fields.java b/java_console/models/src/com/rusefi/config/Fields.java index 5deb914402..472a4c9f64 100644 --- a/java_console/models/src/com/rusefi/config/Fields.java +++ b/java_console/models/src/com/rusefi/config/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config; -// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Feb 25 20:46:04 EST 2018 +// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Feb 26 22:17:31 EST 2018 public class Fields { public static final int LE_COMMAND_LENGTH = 200; public static final int BLOCKING_FACTOR = 400; @@ -1266,7 +1266,7 @@ public class Fields { public static final Field TPSADCCHANNEL = Field.create("TPSADCCHANNEL", 520, FieldType.INT, adc_channel_e); public static final Field OVERRIDECRANKINGIGNITION = Field.create("OVERRIDECRANKINGIGNITION", 524, FieldType.INT); public static final Field SENSORCHARTFREQUENCY = Field.create("SENSORCHARTFREQUENCY", 528, FieldType.INT); - public static final String[] trigger_type_e = {"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", "1+60/2", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "2JZ", "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", "trg39", "trg40", "trg41", "trg42", "INVALID"}; + public static final String[] trigger_type_e = {"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", "1+60/2", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "2JZ", "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", "trg40", "trg41", "trg42", "INVALID"}; public static final Field TRIGGER_TYPE = Field.create("TRIGGER_TYPE", 532, FieldType.INT, trigger_type_e); public static final Field TRIGGER_UNUSEDCUSTOMISSYNCHRONIZATIONNEEDED = Field.create("TRIGGER_UNUSEDCUSTOMISSYNCHRONIZATIONNEEDED", 536, FieldType.BIT, 0); public static final Field TRIGGER_UNUSEDCUSTOMNEEDSECONDTRIGGERINPUT = Field.create("TRIGGER_UNUSEDCUSTOMNEEDSECONDTRIGGERINPUT", 536, FieldType.BIT, 1); diff --git a/unit_tests/triggers.txt b/unit_tests/triggers.txt index 2528d9b434..6bca3876bd 100644 --- a/unit_tests/triggers.txt +++ b/unit_tests/triggers.txt @@ -2411,21 +2411,37 @@ event 182 1001 541.00 event 183 1000 542.00 event 184 1001 543.00 event 185 0 544.00 -TRIGGERTYPE 39 16 TT_DODGE_NEON_1995_ONLY_CRANK 0.00 -# duty 0.00 0.00 +TRIGGERTYPE 39 32 TT_DODGE_NEON_1995_ONLY_CRANK 0.00 +# duty 0.80 0.00 event 0 1 0.00 -event 1 0 0.00 -event 2 1 0.00 -event 3 0 0.00 -event 4 1 0.00 -event 5 0 0.00 -event 6 1 0.00 -event 7 0 0.00 -event 8 1 0.00 -event 9 0 0.00 -event 10 1 0.00 -event 11 0 0.00 -event 12 1 0.00 -event 13 0 0.00 -event 14 1 0.00 -event 15 0 0.00 +event 1 0 4.00 +event 2 1 16.00 +event 3 0 20.00 +event 4 1 43.00 +event 5 0 48.00 +event 6 1 71.00 +event 7 0 76.00 +event 8 1 140.00 +event 9 0 180.00 +event 10 1 195.00 +event 11 0 199.00 +event 12 1 221.00 +event 13 0 226.00 +event 14 1 250.00 +event 15 0 255.00 +event 16 1 360.00 +event 17 0 364.00 +event 18 1 376.00 +event 19 0 380.00 +event 20 1 403.00 +event 21 0 408.00 +event 22 1 431.00 +event 23 0 436.00 +event 24 1 500.00 +event 25 0 540.00 +event 26 1 555.00 +event 27 0 559.00 +event 28 1 581.00 +event 29 0 586.00 +event 30 1 610.00 +event 31 0 615.00