only:handling lack of .srec file
This commit is contained in:
parent
62b821bbec
commit
af6f0ba092
|
@ -9,7 +9,7 @@ public interface rusEFIVersion {
|
|||
/**
|
||||
* @see com.rusefi.autoupdate.Autoupdate#VERSION
|
||||
*/
|
||||
int CONSOLE_VERSION = 20240716;
|
||||
int CONSOLE_VERSION = 20240728;
|
||||
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||
|
||||
static long classBuildTimeMillis() {
|
||||
|
|
|
@ -230,16 +230,23 @@ public class StartupFrame {
|
|||
|
||||
public static @NotNull JLabel binaryModificationControl() {
|
||||
long binaryModificationTimestamp = MaintenanceUtil.getBinaryModificationTimestamp();
|
||||
String fileTimestampText = binaryModificationTimestamp == 0 ? "firmware file not found" : ("Files " + new Date(binaryModificationTimestamp).toString());
|
||||
JLabel jLabel = new JLabel(fileTimestampText);
|
||||
jLabel.setToolTipText("Click to copy");
|
||||
jLabel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard()
|
||||
.setContents(new StringSelection(fileTimestampText), null);
|
||||
}
|
||||
});
|
||||
JLabel jLabel;
|
||||
if (binaryModificationTimestamp == 0) {
|
||||
jLabel = new JLabel("firmware file not found");
|
||||
jLabel.setForeground(Color.red);
|
||||
} else {
|
||||
String fileTimestampText = "Files " + new Date(binaryModificationTimestamp);
|
||||
jLabel = new JLabel(fileTimestampText);
|
||||
jLabel.setToolTipText("Click to copy");
|
||||
jLabel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard()
|
||||
.setContents(new StringSelection(fileTimestampText), null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return jLabel;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.io.IOException;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public final class OpenbltJni {
|
||||
public interface OpenbltCallbacks
|
||||
|
@ -48,6 +48,7 @@ public final class OpenbltJni {
|
|||
}
|
||||
|
||||
public static void flashSerial(String filename, String serialPort, OpenbltCallbacks callbacks) {
|
||||
Objects.requireNonNull(filename);
|
||||
// On non-Windows, prepend "/dev/" to the serial port name if it's missing
|
||||
if (!OS_NAME.contains("win") && !serialPort.startsWith("/dev/")) {
|
||||
serialPort = "/dev/" + serialPort;
|
||||
|
|
|
@ -310,15 +310,20 @@ public class ProgramSelector {
|
|||
|
||||
OpenbltJni.OpenbltCallbacks cb = makeOpenbltCallbacks(callbacks);
|
||||
|
||||
String fileName = FindFileHelper.findSrecFile();
|
||||
if (fileName == null) {
|
||||
callbacks.logLine(".srec image file not found");
|
||||
callbacks.error();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String fileName = FindFileHelper.findSrecFile();
|
||||
callbacks.logLine("flashSerial " + fileName);
|
||||
OpenbltJni.flashSerial(fileName, port, cb);
|
||||
|
||||
callbacks.logLine("Update completed successfully!");
|
||||
callbacks.done();
|
||||
} catch (Throwable e) {
|
||||
callbacks.logLine("Error: " + e.toString());
|
||||
callbacks.logLine("Error: " + e);
|
||||
callbacks.error();
|
||||
} finally {
|
||||
OpenbltJni.stop(cb);
|
||||
|
|
Loading…
Reference in New Issue