Live Data: removing .cpp from buttons

This commit is contained in:
rusefillc 2022-01-24 21:10:22 -05:00
parent c59cde8be1
commit 217ea1f283
5 changed files with 25 additions and 18 deletions

View File

@ -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<live_data_e> 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) {

View File

@ -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();

View File

@ -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);
}

View File

@ -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() {

View File

@ -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);