parent
e11b9f1030
commit
6302a6645e
|
@ -10,7 +10,7 @@ public interface rusEFIVersion {
|
|||
* *** BE CAREFUL WE HAVE SEPARATE AUTOUPDATE_VERSION also managed manually ***
|
||||
* @see com.rusefi.autoupdate.Autoupdate#AUTOUPDATE_VERSION
|
||||
*/
|
||||
int CONSOLE_VERSION = 20241028;
|
||||
int CONSOLE_VERSION = 20241031;
|
||||
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||
|
||||
static long classBuildTimeMillis() {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import com.rusefi.SerialPortScanner;
|
||||
import com.rusefi.core.rusEFIVersion;
|
||||
import com.rusefi.io.UpdateOperationCallbacks;
|
||||
import com.rusefi.maintenance.jobs.AsyncJobExecutor;
|
||||
import com.rusefi.maintenance.jobs.DfuManualJob;
|
||||
import com.rusefi.maintenance.jobs.OpenBltManualJob;
|
||||
import com.rusefi.ui.StatusWindow;
|
||||
import com.rusefi.ui.widgets.ToolButtons;
|
||||
|
@ -10,6 +13,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.rusefi.SerialPortScanner.SerialPortType.OpenBlt;
|
||||
|
@ -19,9 +23,38 @@ public class MassUpdater {
|
|||
private final Set<String> knownBlts = new HashSet<>();
|
||||
|
||||
public MassUpdater() {
|
||||
mainStatus.showFrame("Mass Updater");
|
||||
mainStatus.showFrame("Mass Updater " + rusEFIVersion.CONSOLE_VERSION);
|
||||
|
||||
final AtomicBoolean previousDfuState = new AtomicBoolean();
|
||||
AtomicBoolean isUsingDfu = new AtomicBoolean(); // it seems like DFU detection is not 100% reliable? a work-around to avoid double-DFU
|
||||
|
||||
SerialPortScanner.INSTANCE.addListener(currentHardware -> {
|
||||
|
||||
if (!isUsingDfu.get() && currentHardware.isDfuFound() != previousDfuState.get()) {
|
||||
mainStatus.append(currentHardware.isDfuFound() ? "I see a DFU device!" : "No DFU...");
|
||||
if (currentHardware.isDfuFound()) {
|
||||
isUsingDfu.set(true);
|
||||
UpdateOperationCallbacks releaseSemaphore = new UpdateOperationCallbacks() {
|
||||
@Override
|
||||
public void log(String message, boolean breakLineOnTextArea, boolean sendToLogger) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void done() {
|
||||
isUsingDfu.set(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
isUsingDfu.set(false);
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeLater(() -> AsyncJobExecutor.INSTANCE.executeJob(new DfuManualJob(), releaseSemaphore));
|
||||
}
|
||||
previousDfuState.set(currentHardware.isDfuFound());
|
||||
}
|
||||
|
||||
List<SerialPortScanner.PortResult> currentBltList = currentHardware.getKnownPorts().stream().filter(portResult -> portResult.type == OpenBlt).collect(Collectors.toList());
|
||||
Set<String> currentSet = currentBltList.stream().map(portResult -> portResult.port).collect(Collectors.toSet());
|
||||
for (Iterator<String> it = knownBlts.iterator(); it.hasNext(); ) {
|
||||
|
|
|
@ -47,6 +47,7 @@ public enum SerialPortScanner {
|
|||
OpenBlt("OpenBLT Bootloader", 10),
|
||||
CAN("CAN", 30),
|
||||
Unknown("Unknown", 100),
|
||||
// note that somewhere down we have DFU detection but not handled using this enum
|
||||
;
|
||||
|
||||
public final String friendlyString;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.rusefi.maintenance.jobs;
|
||||
|
||||
import com.rusefi.Launcher;
|
||||
import com.rusefi.io.DoubleCallbacks;
|
||||
import com.rusefi.io.UpdateOperationCallbacks;
|
||||
import com.rusefi.maintenance.ExecHelper;
|
||||
import com.rusefi.maintenance.UpdateStatusWindow;
|
||||
|
@ -11,8 +12,13 @@ public enum AsyncJobExecutor {
|
|||
INSTANCE;
|
||||
|
||||
public void executeJob(final AsyncJob job) {
|
||||
executeJob(job, UpdateOperationCallbacks.DUMMY);
|
||||
}
|
||||
|
||||
public void executeJob(final AsyncJob job, UpdateOperationCallbacks secondary) {
|
||||
final UpdateOperationCallbacks callbacks = new UpdateStatusWindow(appendBundleName(job.getName() + " " + Launcher.CONSOLE_VERSION));
|
||||
final Runnable jobWithSuspendedPortScanning = () -> job.doJob(callbacks);
|
||||
final UpdateOperationCallbacks doubleCallbacks = new DoubleCallbacks(callbacks, secondary);
|
||||
final Runnable jobWithSuspendedPortScanning = () -> job.doJob(doubleCallbacks);
|
||||
ExecHelper.submitAction(jobWithSuspendedPortScanning, "mx");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue