diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 17aae2d4789..4c3d29f530a 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -293,6 +293,9 @@ typedef enum { // 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 = 43, // this is used if we want to iterate over all trigger types Force_4_bytes_size_trigger_type = ENUM_32_BITS, diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 9a418e5e15d..0e97e53713a 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -447,7 +447,10 @@ void printAllTriggers() { FILE * fp = fopen (TRIGGERS_FILE_NAME, "w+"); - fprintf(fp, "# Generated by rusEfi\n"); + fprintf(fp, "# Generated by rusEfi unit test suite\n"); + fprintf(fp, "# This file is used by TriggerImage tool\n"); + fprintf(fp, "# See 'gen_trigger_images.bat'\n"); + printTriggerDebug = true; for (int triggerId = 1; triggerId < TT_UNUSED; triggerId++) { trigger_type_e tt = (trigger_type_e) triggerId; diff --git a/firmware/gen_trigger_images.bat b/firmware/gen_trigger_images.bat index 25c5677c62d..fd5e2d7789b 100644 --- a/firmware/gen_trigger_images.bat +++ b/firmware/gen_trigger_images.bat @@ -1,4 +1,20 @@ rem This takes triggers.txt generated by unit_test binary and produces a bunch of .png files rem these images are published at +cd ../unit_tests +make +if not exist build/rusefi_test.exe echo UNIT TEST COMPILATION FAILED +if not exist build/rusefi_test.exe exit -1 + +rem This is me using Cygwin on all my Windows devices +ls -l build/rusefi_test.exe + + +del triggers.txt +build\rusefi_test.exe +pwd + +if not exist triggers.txt echo triggers.txt generation FAILED +if not exist triggers.txt exit -1 + java -cp ../java_console_binary/rusefi_console.jar com.rusefi.TriggerImage \ No newline at end of file diff --git a/java_console/models/src/com/rusefi/config/Fields.java b/java_console/models/src/com/rusefi/config/Fields.java index 8e27faeb50a..dbe96224437 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 Tue Oct 30 04:58:47 EDT 2018 +// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Nov 22 10:00:39 EST 2018 public class Fields { public static final int LE_COMMAND_LENGTH = 200; public static final int BLOCKING_FACTOR = 400; @@ -1288,7 +1288,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", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "trg42", "trg43", "trg44", "trg45", "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", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "trg43", "trg44", "trg45", "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 ccf91c56377..5452d7d03c7 100644 --- a/unit_tests/triggers.txt +++ b/unit_tests/triggers.txt @@ -1,4 +1,6 @@ -# Generated by rusEfi +# Generated by rusEfi unit test suite +# This file is used by TriggerImage tool +# See 'gen_trigger_images.bat' TRIGGERTYPE 1 10 TT_FORD_ASPIRE 0.00 # duty 0.50 0.38 event 0 1 0.00 @@ -2487,3 +2489,13 @@ event 0 1 0.00 event 1 0 120.00 event 2 1 180.00 event 3 0 660.00 +TRIGGERTYPE 42 8 TT_MAZDA_Z5 0.00 +# duty 0.36 0.00 +event 0 0 0.00 +event 1 1 120.00 +event 2 0 180.00 +event 3 1 300.00 +event 4 0 360.00 +event 5 1 480.00 +event 6 0 558.00 +event 7 1 660.00