diff --git a/firmware/gen_config_common.sh b/firmware/gen_config_common.sh index 3a4678e75c..b989d98a82 100755 --- a/firmware/gen_config_common.sh +++ b/firmware/gen_config_common.sh @@ -6,6 +6,8 @@ COMMON_GEN_CONFIG=" -enumInputFile controllers/algo/rusefi_enums.h \ -readfile OUTPUTS_SECTION console/binary/generated/output_channels.ini \ -readfile DATALOG_SECTION console/binary/generated/data_logs.ini \ + -readfile LIVE_DATA_MENU_FROM_FILE console/binary/generated/fancy_menu.ini \ + -readfile LIVE_DATA_PANELS_FROM_FILE console/binary/generated/fancy_content.ini \ -ts_destination tunerstudio \ -firing_order controllers/algo/firing_order.h \ -triggerFolder ../unit_tests \ diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index e41c5d932c..99d5c811d7 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1474,6 +1474,9 @@ menuDialog = main subMenu = idleVeTableTbl, "Idle VE", 0, {useSeparateVeForIdle == 1} subMenu = idleAdvanceCurve, "Ignition advance", 0, {useSeparateAdvanceForIdle == 1} + menu = "&View" +@@LIVE_DATA_MENU_FROM_FILE@@ + menu = "&Advanced" subMenu = ignitionCylExtra, "Cylinder offsets", 0 subMenu = gearDetection, "Gear detection", 0 @@ -3138,6 +3141,8 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00" panel = speedSensorAnalog, { enableCanVss == 0 } panel = speedSensorCan +@@LIVE_DATA_PANELS_FROM_FILE@@ + dialog = gearDetection, "Gear Detection" field = "Wheel revolutions per kilometer", driveWheelRevPerKm field = "Final drive ratio", finalGearRatio diff --git a/java_tools/ConfigDefinition.jar b/java_tools/ConfigDefinition.jar index 6bab83274b..090a60569e 100644 Binary files a/java_tools/ConfigDefinition.jar and b/java_tools/ConfigDefinition.jar differ diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/ldmp/UsagesReader.java b/java_tools/configuration_definition/src/main/java/com/rusefi/ldmp/UsagesReader.java index 8fbee83d47..2e411cf1df 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/ldmp/UsagesReader.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/ldmp/UsagesReader.java @@ -26,9 +26,11 @@ public class UsagesReader { "\n" + "typedef enum {\n"); - private StringBuilder totalSensors = new StringBuilder(); + private final StringBuilder totalSensors = new StringBuilder(); - private StringBuilder fancyNewStuff = new StringBuilder(); + private final StringBuilder fancyNewStuff = new StringBuilder(); + + private final StringBuilder fancyNewMenu = new StringBuilder(); private final StringBuilder fragmentsContent = new StringBuilder( header + @@ -59,9 +61,13 @@ public class UsagesReader { fw.write(usagesReader.totalSensors.toString()); } - try (FileWriter fw = new FileWriter("console/binary/generated/wip.ini")) { + try (FileWriter fw = new FileWriter("console/binary/generated/fancy_content.ini")) { fw.write(usagesReader.fancyNewStuff.toString()); } + + try (FileWriter fw = new FileWriter("console/binary/generated/fancy_menu.ini")) { + fw.write(usagesReader.fancyNewMenu.toString()); + } } interface EntryHandler { @@ -116,6 +122,8 @@ public class UsagesReader { fancyNewStuff.append(fragmentDialogConsumer.getContent()); + fancyNewMenu.append(fragmentDialogConsumer.menuLine()); + log.info("Done with " + name + " at " + javaSensorsConsumer.sensorTsPosition); } }; diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/output/FragmentDialogConsumer.java b/java_tools/configuration_definition/src/main/java/com/rusefi/output/FragmentDialogConsumer.java index f40e303834..f69e583df2 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/output/FragmentDialogConsumer.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/output/FragmentDialogConsumer.java @@ -14,6 +14,7 @@ public class FragmentDialogConsumer implements ConfigurationConsumer { private final StringBuilder indicatorPanel = new StringBuilder(); private final String fragmentName; private boolean hasIndicators; + private int graphLinesCounter; public FragmentDialogConsumer(String fragmentName) { this.fragmentName = fragmentName; @@ -39,7 +40,6 @@ public class FragmentDialogConsumer implements ConfigurationConsumer { return 0; if (configField.isBit()) { - if (!hasIndicators) { hasIndicators = true; indicatorPanel.append("indicatorPanel = " + getPanelName() + ", 2\n"); @@ -48,6 +48,7 @@ public class FragmentDialogConsumer implements ConfigurationConsumer { } + graphLinesCounter++; graphLines.append("\tgraphLine = " + configField.getName() + "\n"); @@ -63,9 +64,19 @@ public class FragmentDialogConsumer implements ConfigurationConsumer { return fragmentName + "IndicatorPanel"; } - public String getContent() { + public String menuLine() { + if (getContent().isEmpty()) + return ""; + return "\t\t\tsubMenu = " + getDialogName() + ", " + quote(fragmentName) + "\n"; + } - String dialogDeclaration = "dialog = " + fragmentName + "Dialog, " + quote(fragmentName) + "\n"; + public String getContent() { + if (graphLinesCounter > 40) { + // too many lines - really looks like that huge first legacy model, not having fancy stuff for it + return ""; + } + + String dialogDeclaration = "dialog = " + getDialogName() +", " + quote(fragmentName) + "\n"; String indicatorPanelUsageLine = (indicatorPanel.length() > 0) ? "\tpanel = " + getPanelName() + "\n" : ""; @@ -78,10 +89,15 @@ public class FragmentDialogConsumer implements ConfigurationConsumer { graphLines + "\n" + dialogDeclaration + indicatorPanelUsageLine + - "\tpanel = " + getGraphControlName() + "\n" + "\tpanel = " + getGraphControlName() + "\n\n" ; } + @NotNull + private String getDialogName() { + return fragmentName + "Dialog"; + } + @NotNull private String getGraphControlName() { return fragmentName + "Graph"; diff --git a/java_tools/configuration_definition/src/test/java/com/rusefi/test/FragmentDialogConsumerTest.java b/java_tools/configuration_definition/src/test/java/com/rusefi/test/FragmentDialogConsumerTest.java index ebf168b66f..f6a4246bdf 100644 --- a/java_tools/configuration_definition/src/test/java/com/rusefi/test/FragmentDialogConsumerTest.java +++ b/java_tools/configuration_definition/src/test/java/com/rusefi/test/FragmentDialogConsumerTest.java @@ -2,7 +2,6 @@ package com.rusefi.test; import com.rusefi.ReaderState; import com.rusefi.output.FragmentDialogConsumer; -import org.junit.Ignore; import org.junit.Test; import java.io.IOException; @@ -52,7 +51,8 @@ public class FragmentDialogConsumerTest { "\n" + "dialog = ac_stateDialog, \"ac_state\"\n" + "\tpanel = ac_stateIndicatorPanel\n" + - "\tpanel = ac_stateGraph\n", + "\tpanel = ac_stateGraph\n" + + "\n", fragmentDialogConsumer.getContent()); }