better API

This commit is contained in:
rusefillc 2022-11-27 09:49:36 -05:00
parent 77c02f07df
commit ee84738774
3 changed files with 11 additions and 14 deletions

View File

@ -83,7 +83,7 @@ public class DfuFlasher {
if (signature.get() == null) {
wnd.append("*** ERROR *** rusEFI has not responded on selected " + port + "\n" +
"Maybe try automatic serial port detection?");
wnd.setErrorState(true);
wnd.setErrorState();
return null;
}
boolean isSignatureValidatedLocal = DfuHelper.sendDfuRebootCommand(parent, signature.get(), stream, wnd);
@ -100,7 +100,7 @@ public class DfuFlasher {
}).getSerialPort();
if (port == null) {
wnd.append("*** ERROR *** rusEFI serial port not detected");
wnd.setErrorState(true);
wnd.setErrorState();
return null;
} else {
wnd.append("Detected rusEFI on " + port + "\n");
@ -136,7 +136,7 @@ public class DfuFlasher {
boolean driverIsHappy = detectSTM32BootloaderDriverState(wnd);
if (!driverIsHappy) {
wnd.append("*** DRIVER ERROR? *** Did you have a chance to try 'Install Drivers' button on top of rusEFI console start screen?");
wnd.setErrorState(true);
wnd.setErrorState();
return;
}
@ -148,7 +148,7 @@ public class DfuFlasher {
DFU_BINARY, wnd, stdout);
} catch (FileNotFoundException e) {
wnd.append("ERROR: " + e);
wnd.setErrorState(true);
wnd.setErrorState();
return;
}
if (stdout.toString().contains("Download verified successfully")) {
@ -161,12 +161,12 @@ public class DfuFlasher {
wnd.append("ERROR: Please try installing drivers using 'Install Drivers' button on rusEFI splash screen");
wnd.append("ERROR: Alternatively please install drivers using Device Manager pointing at 'drivers/silent_st_drivers/DFU_Driver' folder");
appendDeviceReport(wnd);
wnd.setErrorState(true);
wnd.setErrorState();
} else {
wnd.append(stdout.length() + " / " + errorResponse.length());
appendWindowsVersion(wnd);
appendDeviceReport(wnd);
wnd.setErrorState(true);
wnd.setErrorState();
}
}

View File

@ -80,7 +80,7 @@ public class FirmwareFlasher {
sa.stop();
wnd.setStatus(DONE);
} else {
wnd.setErrorState(true);
wnd.setErrorState();
wnd.append("!!! FIRMWARE FLASH: DOES NOT LOOK RIGHT !!!");
}
}

View File

@ -54,13 +54,10 @@ public class StatusWindow implements StatusConsumer {
return content;
}
public void setErrorState(boolean isErrorState) {
if (isErrorState) {
logTextArea.setBackground(LIGHT_RED);
copyContentToClipboard();
} else {
logTextArea.setBackground(LIGHT_GREEN);
}
public void setErrorState() {
logTextArea.setBackground(LIGHT_RED);
copyContentToClipboard();
}
public JFrame getFrame() {