Better Windows build-in DFU #3338

This commit is contained in:
rusefillc 2021-10-23 12:04:27 -04:00
parent 25d66ca053
commit 6d5ea798f8
3 changed files with 19 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import java.net.URL;
import java.util.concurrent.atomic.AtomicReference;
public class rusEFIVersion {
public static final int CONSOLE_VERSION = 20211022;
public static final int CONSOLE_VERSION = 20211023;
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
public static long classBuildTimeMillis() {

View File

@ -102,11 +102,17 @@ public class DfuFlasher {
if (stdout.toString().contains("Download verified successfully")) {
// looks like sometimes we are not catching the last line of the response? 'Upgrade' happens before 'Verify'
wnd.appendMsg("SUCCESS!");
wnd.appendMsg("Please power cycle device to exit DFU mode");
} else if (stdout.toString().contains("Target device not found")) {
wnd.appendMsg("ERROR: Device not connected or STM32 Bootloader driver not installed?");
wnd.appendMsg("ERROR: Please try installing drivers using 'Install Drivers' button on rusEFI splash screen");
wnd.appendMsg("ERROR: Alternatively please install drivers manually from 'drivers/silent_st_drivers/DFU_Driver' folder");
wnd.setErrorState(true);
} else {
wnd.appendMsg(stdout.length() + " / " + errorResponse.length());
wnd.appendMsg("ERROR: does not look like DFU has worked!");
wnd.setErrorState(true);
}
wnd.appendMsg("Please power cycle device to exit DFU mode");
}
private static void timeForDfuSwitch(StatusWindow wnd) {

View File

@ -13,6 +13,8 @@ import java.awt.*;
* 3/7/2015
*/
public class StatusWindow implements StatusConsumer {
private static final Color LIGHT_RED = new Color(255, 102, 102);
private static final Color LIGHT_GREEN = new Color(102, 255 ,102);
// todo: extract driver from console bundle? find a separate driver bundle?
private final JTextArea logTextArea = new JTextArea();
private final JPanel content = new JPanel(new BorderLayout());
@ -41,6 +43,14 @@ public class StatusWindow implements StatusConsumer {
return content;
}
public void setErrorState(boolean isErrorState) {
if (isErrorState) {
logTextArea.setBackground(LIGHT_RED);
} else {
logTextArea.setBackground(LIGHT_GREEN);
}
}
public JFrame getFrame() {
return frameHelper.getFrame();
}