firmware version to light UI

This commit is contained in:
rusefi 2020-06-16 22:26:19 -04:00
parent f6bae09ee7
commit dac2d7c054
2 changed files with 35 additions and 7 deletions

View File

@ -241,7 +241,7 @@ public class Autoupdate {
return file.length() == completeFileSize && file.lastModified() == lastModified;
}
private static String readBundleFullName() {
public static String readBundleFullName() {
try {
BufferedReader r = new BufferedReader(new FileReader(BUNDLE_NAME_FILE));
String fullName = r.readLine();

View File

@ -2,12 +2,16 @@ package com.rusefi.ui.light;
import com.rusefi.*;
import com.rusefi.autodetect.PortDetector;
import com.rusefi.autoupdate.Autoupdate;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
import com.rusefi.io.ConnectionStateListener;
import com.rusefi.io.ConnectionStatusLogic;
import com.rusefi.io.ConnectionWatchdog;
import com.rusefi.io.LinkManager;
import com.rusefi.sensor_logs.SensorLogger;
import com.rusefi.ui.util.FrameHelper;
import org.putgemin.VerticalFlowLayout;
import javax.swing.*;
import java.awt.*;
@ -34,13 +38,26 @@ public class LightweightGUI {
topPanel.add(new InternetStatus().getContent());
content.add(topPanel, BorderLayout.NORTH);
content.add(new JLabel(StartupFrame.LINK_TEXT), BorderLayout.CENTER);
JPanel leftPanel = new JPanel(new VerticalFlowLayout());
leftPanel.add(new JLabel(Autoupdate.readBundleFullName()));
JLabel firmwareVersion = new JLabel();
SensorCentral.getInstance().addListener(Sensor.FIRMWARE_VERSION, new SensorCentral.SensorListener() {
@Override
public void onSensorUpdate(double value) {
firmwareVersion.setText(Integer.toString((int) value));
}
});
leftPanel.add(firmwareVersion);
content.add(topPanel, BorderLayout.NORTH);
content.add(leftPanel, BorderLayout.WEST);
content.add(createLogoUrlPanel(), BorderLayout.EAST);
JLabel logo = createLogoLabel();
if (logo != null) {
content.add(logo, BorderLayout.EAST);
}
frameHelper.showFrame(content, true);
}
@ -64,7 +81,18 @@ public class LightweightGUI {
});
}
});
}
private static JPanel createLogoUrlPanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JLabel(StartupFrame.LINK_TEXT), BorderLayout.SOUTH);
JLabel logo = createLogoLabel();
if (logo != null) {
panel.add(logo, BorderLayout.CENTER);
}
return panel;
}
private void setConnectedUI(boolean isConnected) {