remove crazy firing order logic since we don't need it with "always two wire wasted"

This commit is contained in:
Matthew Kennedy 2023-03-09 14:43:24 -08:00
parent 324a115ea6
commit 60f5dd143f
7 changed files with 12 additions and 146 deletions

View File

@ -2098,10 +2098,18 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
dialog = ignitionOutputs, "Ignition Outputs"
field = "Ignition Output Mode", ignitionPinMode, {isIgnitionEnabled == 1}@@if_ts_show_ignitionPinMode
field = "Ignition Output 1", ignitionPins1, {isIgnitionEnabled == 1}
; see rusefi_config.txt comment next to 'ignitionPin2logic' which says
; this section is auto-generated by FiringOrderTSLogic.java
@@FIRINGORDER@@
field = "Ignition Pin 1", ignitionPins1, { isIgnitionEnabled == 1 }
field = "Ignition Pin 2", ignitionPins2, { isIgnitionEnabled == 1 && cylindersCount >= 2 }
field = "Ignition Pin 3", ignitionPins3, { isIgnitionEnabled == 1 && cylindersCount >= 3 }
field = "Ignition Pin 4", ignitionPins4, { isIgnitionEnabled == 1 && cylindersCount >= 4 }
field = "Ignition Pin 5", ignitionPins5, { isIgnitionEnabled == 1 && cylindersCount >= 5 }
field = "Ignition Pin 6", ignitionPins6, { isIgnitionEnabled == 1 && cylindersCount >= 6 }
field = "Ignition Pin 7", ignitionPins7, { isIgnitionEnabled == 1 && cylindersCount >= 7 }
field = "Ignition Pin 8", ignitionPins8, { isIgnitionEnabled == 1 && cylindersCount >= 8 }
field = "Ignition Pin 9", ignitionPins9, { isIgnitionEnabled == 1 && cylindersCount >= 9 }
field = "Ignition Pin 10", ignitionPins10, { isIgnitionEnabled == 1 && cylindersCount >= 10 }
field = "Ignition Pin 11", ignitionPins11, { isIgnitionEnabled == 1 && cylindersCount >= 11 }
field = "Ignition Pin 12", ignitionPins12, { isIgnitionEnabled == 1 && cylindersCount >= 12 }
dialog = ignitionBasic, ""
field = "Enabled", isIgnitionEnabled

View File

@ -57,7 +57,6 @@ public class ConsoleTools {
registerTool("headless", ConsoleTools::runHeadless, "Connect to rusEFI controller and start saving logs.");
registerTool("ptrace_enums", ConsoleTools::runPerfTraceTool, "NOT A USER TOOL. Development tool to process performance trace enums");
registerTool("firing_order", ConsoleTools::runFiringOrderTool, "NOT A USER TOOL. Development tool relating to adding new firing order into rusEFI firmware.");
registerTool("functional_test", ConsoleTools::runFunctionalTest, "NOT A USER TOOL. Development tool related to functional testing");
registerTool("convert_binary_configuration_to_xml", ConsoleTools::convertBinaryToXml, "NOT A USER TOOL. Development tool to convert binary configuration into XML form.");
@ -157,10 +156,6 @@ public class ConsoleTools {
PerfTraceTool.readPerfTrace(args[1], args[2], args[3], args[4]);
}
private static void runFiringOrderTool(String[] args) throws IOException {
FiringOrderTSLogic.invoke(args[1]);
}
private static void runFunctionalTest(String[] args) throws InterruptedException {
// passing port argument if it was specified
String[] toolArgs = args.length == 1 ? new String[0] : new String[]{args[1]};

Binary file not shown.

View File

@ -169,8 +169,6 @@ public class ConfigDefinition {
FirmwareVersion uniqueId = new FirmwareVersion(IoUtil2.getCrc32(state.getInputFiles()));
SignatureConsumer.storeUniqueBuildId(state, parseState, tsInputFileFolder, uniqueId);
ExtraUtil.handleFiringOrder(firingEnumFileName, state.getVariableRegistry(), parseState);
new TriggerWheelTSLogic().execute(triggersInputFolder, state.getVariableRegistry());
if (pinoutLogic != null) {

View File

@ -8,14 +8,6 @@ import com.rusefi.util.SystemOut;
import java.io.IOException;
public class ExtraUtil {
static void handleFiringOrder(String firingEnumFileName, VariableRegistry variableRegistry, DefinitionsState parseState) throws IOException {
if (firingEnumFileName != null) {
SystemOut.println("Reading firing from " + firingEnumFileName);
String result = FiringOrderTSLogic.invoke(firingEnumFileName);
parseState.addDefinition(variableRegistry, "FIRINGORDER", result, Definition.OverwritePolicy.NotAllowed);
}
}
public static void writeDefinesToFile(VariableRegistry variableRegistry, String fileName, String headerComment) throws IOException {
SystemOut.println("Writing to " + fileName);

View File

@ -1,116 +0,0 @@
package com.rusefi;
import com.devexperts.logging.Logging;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import static com.devexperts.logging.Logging.getLogging;
/**
* Andrey Belomutskiy, (c) 2012-2016
* 7/20/2016
*/
public class FiringOrderTSLogic {
private static final Logging log = getLogging(FiringOrderTSLogic.class);
private static final String FIRING_ORDER_PREFIX = "FO_";
public static void main(String[] args) throws IOException {
// sandbox code
invoke("../firmware/controllers/algo/firing_order.h");
}
public static String invoke(String fileName) throws IOException {
State state = new State();
readFiringOrders(fileName, state);
StringBuilder sb = new StringBuilder();
for (int i = 2; i <= 12; i++) {
String line = processId(i, state);
sb.append(line).append("\r\n");
}
return sb.toString();
}
private static void readFiringOrders(String fileName, State state) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(fileName));
String line;
while ((line = br.readLine()) != null) {
int index = line.indexOf(FIRING_ORDER_PREFIX);
if (index == -1) {
if (log.debugEnabled())
log.debug("Skipping [" + line);
continue;
}
line = line.substring(index + FIRING_ORDER_PREFIX.length());
parseLine(line, state);
}
}
public static void parseLine(String line, State state) {
line = line.replaceAll("[\\s]*\\,.*", "");
line = line.replaceAll("[\\s\\,]", "");
if (log.debugEnabled())
log.debug("Processing " + line);
String s[] = line.split("\\=");
String order[] = s[0].split("_");
int ordinal = Integer.parseInt(s[1]);
if (log.debugEnabled())
log.debug("order " + Arrays.toString(order) + ": " + ordinal);
state.maxOrdinal = Math.max(ordinal, state.maxOrdinal);
state.ordinal2order.put(ordinal, order);
}
private static String processId(int cylinderId, State state) {
StringBuilder logic = new StringBuilder();
for (Map.Entry<Integer, String[]> e : state.ordinal2order.entrySet()) {
Integer ordinal = e.getKey();
String[] order = e.getValue();
if (order.length % 2 != 0) {
// need even number of cylinders for wasted spark, right?
continue;
}
int halfSize = order.length / 2;
boolean allowed = false;
for (int i = 0; i < halfSize; i++) {
allowed |= order[i].equals(Integer.toString(cylinderId));
}
if (allowed) {
if (logic.length() > 0)
logic.append(" || ");
logic.append("(firingOrder == ").append(ordinal).append(")");
}
}
String result = logic.length() == 0 ? "" : "|| (" + logic + ")";
//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;
}
public static class State {
final Map<Integer, String[]> ordinal2order = new HashMap<>();
int maxOrdinal;
}
}

View File

@ -1,11 +0,0 @@
package com.rusefi.test;
import com.rusefi.FiringOrderTSLogic;
import org.junit.Test;
public class FiringOrderTSLogicTest {
@Test
public void parseFiringOrderLine() {
FiringOrderTSLogic.parseLine("FO_1_3_4_2 = 1, // typical inline 4", new FiringOrderTSLogic.State());
}
}