REO progress

a couple of bugfixes
This commit is contained in:
rusefi 2020-06-22 20:58:52 -04:00
parent 5268a00866
commit 6e27b8b988
3 changed files with 31 additions and 12 deletions

View File

@ -42,7 +42,10 @@ public class Msq {
public ConfigurationImage asImage(IniFileModel instance) { public ConfigurationImage asImage(IniFileModel instance) {
ConfigurationImage ci = new ConfigurationImage(Fields.TOTAL_CONFIG_SIZE); ConfigurationImage ci = new ConfigurationImage(Fields.TOTAL_CONFIG_SIZE);
for (Constant constant : findPage().constant) { Page page = findPage();
if (page == null)
return ci;
for (Constant constant : page.constant) {
if (constant.getName().startsWith("UNALLOCATED_SPACE")) { if (constant.getName().startsWith("UNALLOCATED_SPACE")) {
continue; continue;
} }
@ -65,7 +68,12 @@ public class Msq {
public void loadConstant(IniFileModel ini, String key, ConfigurationImage image) { public void loadConstant(IniFileModel ini, String key, ConfigurationImage image) {
IniField field = ini.allIniFields.get(key); IniField field = ini.allIniFields.get(key);
String value = field.getValue(image); String value = field.getValue(image);
findPage().constant.add(new Constant(field.getName(), field.getUnits(), value)); Page page = findPage();
if (page == null) {
System.out.println("Msq: No page");
return;
}
page.constant.add(new Constant(field.getName(), field.getUnits(), value));
} }
@XmlElement @XmlElement
@ -79,7 +87,12 @@ public class Msq {
} }
public Page findPage() { public Page findPage() {
return page.get(1); for (Page p : page) {
if (p.getSize() == Fields.TOTAL_CONFIG_SIZE) {
return p;
}
}
return null;
} }
@XmlElement @XmlElement

View File

@ -116,13 +116,13 @@ public class PluginEntry implements TsPluginBody {
Constant engineCode = fileSystemValues.get("enginecode"); Constant engineCode = fileSystemValues.get("enginecode");
Constant vehicleName = fileSystemValues.get("VEHICLENAME"); Constant vehicleName = fileSystemValues.get("VEHICLENAME");
String warning = ""; String warning = "";
if (isEmpty(engineMake.getValue())) { if (isEmpty(engineMake)) {
warning += " engine make"; warning += " engine make";
} }
if (isEmpty(engineCode.getValue())) { if (isEmpty(engineCode)) {
warning += " engine code"; warning += " engine code";
} }
if (isEmpty(vehicleName.getValue())) { if (isEmpty(vehicleName)) {
warning += " vehicle name"; warning += " vehicle name";
} }
if (warning.isEmpty()) { if (warning.isEmpty()) {
@ -139,12 +139,18 @@ public class PluginEntry implements TsPluginBody {
currentConfiguration = configurationName; currentConfiguration = configurationName;
} }
private boolean isEmpty(Constant constant) {
if (constant == null)
return true;
return isEmpty(constant.getValue());
}
private void updateUploadEnabled() { private void updateUploadEnabled() {
upload.setEnabled(tuneIsOk && projectIsOk); upload.setEnabled(tuneIsOk && projectIsOk);
} }
private boolean isEmpty(String engineCode) { private boolean isEmpty(String value) {
return engineCode == null || engineCode.trim().length() == 0; return value == null || value.trim().length() == 0;
} }
@Override @Override

View File

@ -172,10 +172,10 @@ public class Updater {
content.removeAll(); content.removeAll();
content.add(instance.getContent()); content.add(instance.getContent());
AutoupdateUtil.trueLayout(content.getParent()); AutoupdateUtil.trueLayout(content.getParent());
JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(content); Window windowAncestor = SwingUtilities.getWindowAncestor(content);
AutoupdateUtil.trueLayout(topFrame); AutoupdateUtil.trueLayout(windowAncestor);
topFrame.pack(); windowAncestor.pack();
AutoupdateUtil.trueLayout(topFrame); AutoupdateUtil.trueLayout(windowAncestor);
} }
public JPanel getContent() { public JPanel getContent() {