progress - firing order logic to be re-evaluated every time we generate

This commit is contained in:
rusefi 2020-05-04 23:54:28 -04:00
parent a208078f7c
commit 75d76f850d
9 changed files with 23 additions and 29 deletions

View File

@ -20,6 +20,7 @@ java -DSystemOut.name=gen_config ^
-initialize_to_zero false ^
-tool gen_config.bat ^
-c_defines controllers\generated\rusefi_generated.h ^
-firing_order controllers/algo/firing_order.h ^
-c_destination controllers\generated\engine_configuration_generated_structures.h ^
-c_fsio_constants controllers\generated\fsio_enums_generated.def ^
-c_fsio_getters controllers\generated\fsio_getters.def ^

View File

@ -31,6 +31,7 @@ java -DSystemOut.name=gen_config_board ^
-definition integration\rusefi_config.txt ^
-tool gen_config.bat ^
-ts_destination tunerstudio ^
-firing_order controllers/algo/firing_order.h ^
-ts_output_name rusefi_%BOARDNAME%.ini ^
-prepend tunerstudio/%BOARDNAME%_prefix.txt ^
-prepend config/boards/%BOARDNAME%/prepend.txt ^

View File

@ -41,19 +41,6 @@
! all the sub-structures are going to be nested within the primary structure, that's
! needed to get a proper TunerStudio file
! this section is auto-generated by FiringOrderTSLogic.java
#define ignitionPin2logic || ((firingOrder == 2) || (firingOrder == 7) || (firingOrder == 9) || (firingOrder == 11) || (firingOrder == 12))
#define ignitionPin3logic || ((firingOrder == 1) || (firingOrder == 3) || (firingOrder == 4) || (firingOrder == 5) || (firingOrder == 9))
#define ignitionPin4logic || ((firingOrder == 5) || (firingOrder == 7) || (firingOrder == 12))
#define ignitionPin5logic || ((firingOrder == 4) || (firingOrder == 12))
#define ignitionPin6logic
#define ignitionPin7logic || ((firingOrder == 11))
#define ignitionPin8logic || ((firingOrder == 5) || (firingOrder == 11))
#define ignitionPin9logic
#define ignitionPin10logic
#define ignitionPin11logic
#define ignitionPin12logic
struct persistent_config_s
struct_no_prefix engine_configuration_s

View File

@ -1596,17 +1596,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
field = "Ignition Pin 1", ignitionPins1, {isIgnitionEnabled == 1}
; see rusefi_config.txt comment next to 'ignitionPin2logic' which says
; this section is auto-generated by FiringOrderTSLogic.java
field = "Ignition Pin 2", ignitionPins2, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 1) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 2) || (firingOrder == 7) || (firingOrder == 9) || (firingOrder == 11) || (firingOrder == 12)))}
field = "Ignition Pin 3", ignitionPins3, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 2) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 1) || (firingOrder == 3) || (firingOrder == 4) || (firingOrder == 5) || (firingOrder == 9)))}
field = "Ignition Pin 4", ignitionPins4, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 3) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 5) || (firingOrder == 7) || (firingOrder == 12)))}
field = "Ignition Pin 5", ignitionPins5, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 4) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 4) || (firingOrder == 12)))}
field = "Ignition Pin 6", ignitionPins6, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 5) && (ignitionMode !=2 || twoWireBatchIgnition == 1 )}
field = "Ignition Pin 7", ignitionPins7, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 6) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 11)))}
field = "Ignition Pin 8", ignitionPins8, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 7) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 5) || (firingOrder == 11)))}
field = "Ignition Pin 9", ignitionPins9, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 8) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 5) || (firingOrder == 11)))}
field = "Ignition Pin 10", ignitionPins10, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 9) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 5) || (firingOrder == 11)))}
field = "Ignition Pin 11", ignitionPins11, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 10) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 5) || (firingOrder == 11)))}
field = "Ignition Pin 12", ignitionPins12, {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount > 11) && (ignitionMode !=2 || twoWireBatchIgnition == 1 || ((firingOrder == 5) || (firingOrder == 11)))}
@@FIRINGORDER@@
field = "This is useful to have tachometer working"
field = " while converting from distributor"
field = "Dizzy out Pin", dizzySparkOutputPin, {isIgnitionEnabled == 1}

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="FiringOrderTSLogic" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.rusefi.FiringOrderTSLogic" />
<module name="models" />
<module name="configuration_definition" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<extension name="coverage">
<pattern>

Binary file not shown.

View File

@ -6,10 +6,12 @@ import com.rusefi.util.LazyFile;
import com.rusefi.util.SystemOut;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -36,6 +38,7 @@ public class ConfigDefinition {
private static final String KEY_WITH_C_DEFINES = "-with_c_defines";
private static final String KEY_JAVA_DESTINATION = "-java_destination";
private static final String KEY_ROMRAIDER_DESTINATION = "-romraider_destination";
private static final String KEY_FIRING = "-firing_order";
public static final String KEY_PREPEND = "-prepend";
private static final String KEY_SKIP = "-skip";
private static final String KEY_ZERO_INIT = "-initialize_to_zero";
@ -69,6 +72,8 @@ public class ConfigDefinition {
return;
}
SystemOut.println("Invoked with " + Arrays.toString(args));
String tsPath = null;
String destCHeaderFileName = null;
String destCDefinesFileName = null;
@ -109,6 +114,10 @@ public class ConfigDefinition {
destCDefinesFileName = args[i + 1];
} else if (key.equals(KEY_JAVA_DESTINATION)) {
javaDestinationFileName = args[i + 1];
} else if (key.equals(KEY_FIRING)) {
String firingEnumFileName = args[i + 1];
SystemOut.println("Reading firing from " + firingEnumFileName);
VariableRegistry.INSTANCE.register("FIRINGORDER", FiringOrderTSLogic.invoke(firingEnumFileName));
} else if (key.equals(KEY_ROMRAIDER_DESTINATION)) {
romRaiderDestination = args[i + 1];
} else if (key.equals(KEY_PREPEND)) {
@ -124,7 +133,7 @@ public class ConfigDefinition {
MESSAGE = getGeneratedAutomaticallyTag() + definitionInputFile + " " + new Date();
SystemOut.println("Reading from " + definitionInputFile);
SystemOut.println("Reading definition from " + definitionInputFile);
String currentMD5 = getDefinitionMD5(definitionInputFile);

View File

@ -25,7 +25,7 @@ public class FiringOrderTSLogic {
readFiringOrders(fileName, state);
StringBuilder sb = new StringBuilder();
for (int i = 2; i <= state.maxOrdinal; i++) {
for (int i = 2; i <= 12; i++) {
String line = processId(i, state);
sb.append(line).append("\r\n");
}
@ -91,7 +91,10 @@ public class FiringOrderTSLogic {
}
String result = logic.length() == 0 ? "" : "|| (" + logic + ")";
String output = "#define ignitionPin" + cylinderId + "logic" + " " + result + "";
//String output = "#define ignitionPin" + cylinderId + "logic" + " " + result + "";
String output = "\t\tfield = \"Ignition Pin " + cylinderId +
"\", ignitionPins" + cylinderId +
", {isIgnitionEnabled == 1 && (ignitionMode != 0 && cylindersCount >= " + cylinderId + ") && (ignitionMode !=2 || twoWireBatchIgnition == 1 " + result + ")}";
System.out.println(output);
return output;
}

View File

@ -67,7 +67,10 @@ public class VariableRegistry {
SystemOut.println("Registering " + var + " as " + value);
data.put(var, value);
cAllDefinitions.put(var, "#define " + var + " " + value + EOL);
if (!value.contains("\n")) {
// multi-lines are not supported in C headers
cAllDefinitions.put(var, "#define " + var + " " + value + EOL);
}
tryToRegisterAsInteger(var, value);
}