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) {
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")) {
continue;
}
@ -65,7 +68,12 @@ public class Msq {
public void loadConstant(IniFileModel ini, String key, ConfigurationImage image) {
IniField field = ini.allIniFields.get(key);
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
@ -79,7 +87,12 @@ public class Msq {
}
public Page findPage() {
return page.get(1);
for (Page p : page) {
if (p.getSize() == Fields.TOTAL_CONFIG_SIZE) {
return p;
}
}
return null;
}
@XmlElement

View File

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

View File

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