"wrong bundle" warning text sometimes not visible #3267

This commit is contained in:
rusefi 2021-09-26 15:58:18 -04:00
parent cc381d111a
commit 2e12371e91
1 changed files with 14 additions and 10 deletions

View File

@ -32,16 +32,20 @@ public class DfuHelper {
if (!bundleName.equalsIgnoreCase(s.getBundle())) {
String message = String.format("You have \"%s\" controller does not look right to program it with \"%s\"", s.getBundle(), bundleName);
FileLog.MAIN.logLine(message);
JOptionPane.showMessageDialog(parent, message);
// in case of mismatched bundle type we are supposed do close connection
// and properly handle the case of user hitting "Update Firmware" again
// closing connection is a mess on Windows so it's simpler to just exit
new Thread(() -> {
// let's have a delay and separate thread to address
// "wrong bundle" warning text sometimes not visible #3267
sleep(5 * SECOND);
System.exit(-5);
}).start();
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(parent, message);
// in case of mismatched bundle type we are supposed do close connection
// and properly handle the case of user hitting "Update Firmware" again
// closing connection is a mess on Windows so it's simpler to just exit
new Thread(() -> {
// let's have a delay and separate thread to address
// "wrong bundle" warning text sometimes not visible #3267
sleep(5 * SECOND);
System.exit(-5);
}).start();
});
return false;
}
}