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

View File

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

View File

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