From 217ea1f283a602c5c185279a4bd2997b9f2c9831 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Mon, 24 Jan 2022 21:10:22 -0500 Subject: [PATCH] Live Data: removing .cpp from buttons --- .../java/com/rusefi/ldmp/StateDictionary.java | 29 ++++++++++--------- .../main/java/com/rusefi/ui/LiveDataPane.java | 4 ++- .../livedata/LiveDataConventionTest.java | 3 +- .../com/rusefi/livedata/LiveDataView.java | 4 ++- .../rusefi/ui/livedata/LiveDataColorTest.java | 3 +- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/java_console/io/src/main/java/com/rusefi/ldmp/StateDictionary.java b/java_console/io/src/main/java/com/rusefi/ldmp/StateDictionary.java index a754614eb3..b48bb3b892 100644 --- a/java_console/io/src/main/java/com/rusefi/ldmp/StateDictionary.java +++ b/java_console/io/src/main/java/com/rusefi/ldmp/StateDictionary.java @@ -23,20 +23,20 @@ public enum StateDictionary { // LDS_CJ125_PID //register(live_data_e.LDS_IDLE, IdleState.VALUES); // todo: code generate this! - register(live_data_e.LDS_engine_state, EngineState.VALUES, "engine.cpp"); // 3 - register(live_data_e.LDS_trigger_central, TriggerCentral.VALUES, "trigger_central.cpp"); - register(live_data_e.LDS_trigger_state, TriggerState.VALUES, "trigger_decoder.cpp"); // 11 - register(live_data_e.LDS_ac_control, AcControl.VALUES, "ac_control.cpp"); // 12 - register(live_data_e.LDS_fan_control, FuelPump.VALUES, "fan_control.cpp"); - register(live_data_e.LDS_injector_model, InjectorModel.VALUES, "injector_model.cpp"); - register(live_data_e.LDS_idle_state, IdleState.VALUES, "idle_thread.cpp"); - register(live_data_e.LDS_fuel_pump, FuelPump.VALUES, "fuel_pump.cpp"); - register(live_data_e.LDS_wall_fuel_state, WallFuelState.VALUES, "wall_fuel.cpp"); - register(live_data_e.LDS_tps_accel_state, TpsAccelState.VALUES, "accel_enrichment.cpp"); - register(live_data_e.LDS_main_relay, MainRelay.VALUES, "main_relay.cpp"); - register(live_data_e.LDS_boost_control, BoostControl.VALUES, "boost_control.cpp"); - register(live_data_e.LDS_launch_control_state, LaunchControl.VALUES, "launch_control.cpp"); - register(live_data_e.LDS_high_pressure_fuel_pump, HighPressureFuelPump.VALUES, "high_pressure_fuel_pump.cpp"); + register(live_data_e.LDS_engine_state, EngineState.VALUES, "engine"); // 3 + register(live_data_e.LDS_trigger_central, TriggerCentral.VALUES, "trigger_central"); + register(live_data_e.LDS_trigger_state, TriggerState.VALUES, "trigger_decoder"); // 11 + register(live_data_e.LDS_ac_control, AcControl.VALUES, "ac_control"); // 12 + register(live_data_e.LDS_fan_control, FuelPump.VALUES, "fan_control"); + register(live_data_e.LDS_injector_model, InjectorModel.VALUES, "injector_model"); + register(live_data_e.LDS_idle_state, IdleState.VALUES, "idle_thread"); + register(live_data_e.LDS_fuel_pump, FuelPump.VALUES, "fuel_pump"); + register(live_data_e.LDS_wall_fuel_state, WallFuelState.VALUES, "wall_fuel"); + register(live_data_e.LDS_tps_accel_state, TpsAccelState.VALUES, "accel_enrichment"); + register(live_data_e.LDS_main_relay, MainRelay.VALUES, "main_relay"); + register(live_data_e.LDS_boost_control, BoostControl.VALUES, "boost_control"); + register(live_data_e.LDS_launch_control_state, LaunchControl.VALUES, "launch_control"); + register(live_data_e.LDS_high_pressure_fuel_pump, HighPressureFuelPump.VALUES, "high_pressure_fuel_pump"); if (map.size() != live_data_e.values().length) { Set missing = new HashSet<>(Arrays.asList(live_data_e.values())); missing.removeAll(map.keySet()); @@ -49,6 +49,7 @@ public enum StateDictionary { fileNames.put(ldsIndex, fileName); } + @NotNull public String getFileName(live_data_e ldsIndex) { String result = fileNames.get(ldsIndex); if (result == null) { diff --git a/java_console/ui/src/main/java/com/rusefi/ui/LiveDataPane.java b/java_console/ui/src/main/java/com/rusefi/ui/LiveDataPane.java index 06258247ee..1b177e2934 100644 --- a/java_console/ui/src/main/java/com/rusefi/ui/LiveDataPane.java +++ b/java_console/ui/src/main/java/com/rusefi/ui/LiveDataPane.java @@ -22,6 +22,8 @@ import java.awt.event.ActionListener; * @see LiveDataParserPanel */ public class LiveDataPane { + public static final String CPP_SUFFIX = ".cpp"; + /** * this is the panel we expose to the outside world */ @@ -38,7 +40,7 @@ public class LiveDataPane { JPanel leftList = new JPanel(new VerticalFlowLayout()); for (live_data_e view : live_data_e.values()) { - String fileName = StateDictionary.INSTANCE.getFileName(view); + String fileName = StateDictionary.INSTANCE.getFileName(view) + CPP_SUFFIX; Field[] values = StateDictionary.INSTANCE.getFields(view); JPanel liveDataParserContent = LiveDataParserPanel.createLiveDataParserPanel(uiContext, view, values, fileName).getContent(); diff --git a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataConventionTest.java b/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataConventionTest.java index 3fdb7dfb28..bfc5f73ab7 100644 --- a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataConventionTest.java +++ b/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataConventionTest.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.net.URISyntaxException; import static com.rusefi.livedata.LiveDataParserPanel.getParseTree; +import static com.rusefi.ui.LiveDataPane.CPP_SUFFIX; import static org.junit.Assert.assertTrue; public class LiveDataConventionTest { @@ -21,7 +22,7 @@ public class LiveDataConventionTest { @Ignore public void assertLiveDataConvention() throws IOException, URISyntaxException { for (live_data_e view : live_data_e.values()) { - String fileName = StateDictionary.INSTANCE.getFileName(view); + String fileName = StateDictionary.INSTANCE.getFileName(view) + CPP_SUFFIX; Field[] values = StateDictionary.INSTANCE.getFields(view); assertFile(fileName, values); } diff --git a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataView.java b/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataView.java index 0aa1c6611a..67019f48eb 100644 --- a/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataView.java +++ b/java_console/ui/src/test/java/com/rusefi/livedata/LiveDataView.java @@ -5,6 +5,8 @@ import com.rusefi.config.generated.*; import com.rusefi.enums.live_data_e; import com.rusefi.ldmp.StateDictionary; +import static com.rusefi.ui.LiveDataPane.CPP_SUFFIX; + /** * todo: kill this legacy class? * @see StateDictionary @@ -28,7 +30,7 @@ public enum LiveDataView { LiveDataView(live_data_e liveDataE, Field[] values) { this.liveDataE = liveDataE; this.values = values; - this.fileName = StateDictionary.INSTANCE.getFileName(liveDataE); + this.fileName = StateDictionary.INSTANCE.getFileName(liveDataE) + CPP_SUFFIX; } public live_data_e getLiveDataE() { diff --git a/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataColorTest.java b/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataColorTest.java index 9f88817fca..0d22ecf57a 100644 --- a/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataColorTest.java +++ b/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataColorTest.java @@ -12,6 +12,7 @@ import java.io.IOException; import java.net.URISyntaxException; import static com.rusefi.livedata.LiveDataParserPanel.getContentOrNull; +import static com.rusefi.ui.LiveDataPane.CPP_SUFFIX; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -20,7 +21,7 @@ public class LiveDataColorTest { public void testAllFiles() throws IOException, URISyntaxException { int counter = 0; for (live_data_e view : live_data_e.values()) { - String fileName = StateDictionary.INSTANCE.getFileName(view); + String fileName = StateDictionary.INSTANCE.getFileName(view) + CPP_SUFFIX; try { testSpecificFile(fileName);