only:Improve toolset for default tune canned tune generation #4871
This commit is contained in:
parent
f4a24e2fc6
commit
85f4b0c4d5
|
@ -14,6 +14,7 @@ import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.rusefi.ConfigFieldImpl.unquote;
|
import static com.rusefi.ConfigFieldImpl.unquote;
|
||||||
import static com.rusefi.tools.tune.WriteSimulatorConfiguration.INI_FILE_FOR_SIMULATOR;
|
import static com.rusefi.tools.tune.WriteSimulatorConfiguration.INI_FILE_FOR_SIMULATOR;
|
||||||
|
@ -60,7 +61,7 @@ public class TuneCanTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static StringBuilder getTunePatch2(Msq customOldTune, Msq lessOldDefaultTune, IniFileModel ini) throws IOException {
|
public static StringBuilder getTunePatch2(Msq defaultTune, Msq customTune, IniFileModel ini) throws IOException {
|
||||||
List<String> options = Files.readAllLines(Paths.get(RootHolder.ROOT + "../" + ConfigDefinition.CONFIG_PATH));
|
List<String> options = Files.readAllLines(Paths.get(RootHolder.ROOT + "../" + ConfigDefinition.CONFIG_PATH));
|
||||||
String[] totalArgs = options.toArray(new String[0]);
|
String[] totalArgs = options.toArray(new String[0]);
|
||||||
|
|
||||||
|
@ -70,12 +71,18 @@ public class TuneCanTool {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (DialogModel.Field f : ini.fieldsInUiOrder) {
|
for (DialogModel.Field f : ini.fieldsInUiOrder) {
|
||||||
String name = f.getKey();
|
String name = f.getKey();
|
||||||
Constant customValue = customOldTune.getConstantsAsMap().get(name);
|
Constant customValue = customTune.getConstantsAsMap().get(name);
|
||||||
Constant defaultValue = lessOldDefaultTune.getConstantsAsMap().get(name);
|
Constant defaultValue = defaultTune.getConstantsAsMap().get(name);
|
||||||
if (defaultValue == null) {
|
if (defaultValue == null) {
|
||||||
// no longer present
|
// no longer present
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Objects.requireNonNull(defaultValue.getValue(), "d value");
|
||||||
|
if (customValue == null) {
|
||||||
|
System.out.println("Skipping " + name + " TODO");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Objects.requireNonNull(customValue.getValue(), "c value");
|
||||||
|
|
||||||
boolean isSameValue = simplerSpaces(defaultValue.getValue()).equals(simplerSpaces(customValue.getValue()));
|
boolean isSameValue = simplerSpaces(defaultValue.getValue()).equals(simplerSpaces(customValue.getValue()));
|
||||||
if (!isSameValue) {
|
if (!isSameValue) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class LoadOlderTuneTest {
|
||||||
|
|
||||||
RootHolder.ROOT = "../../firmware/";
|
RootHolder.ROOT = "../../firmware/";
|
||||||
|
|
||||||
StringBuilder sb = TuneCanTool.getTunePatch2(customOldTune, lessOldDefaultTune, ini);
|
StringBuilder sb = TuneCanTool.getTunePatch2(lessOldDefaultTune, customOldTune, ini);
|
||||||
|
|
||||||
assertEquals("\tengineConfiguration->ignitionMode = IM_ONE_COIL;\n" +
|
assertEquals("\tengineConfiguration->ignitionMode = IM_ONE_COIL;\n" +
|
||||||
"\tengineConfiguration->cylindersCount = 4;\n" +
|
"\tengineConfiguration->cylindersCount = 4;\n" +
|
||||||
|
|
Loading…
Reference in New Issue