only: console usability: auto-select OPENBLT_MANUAL

This commit is contained in:
rusefillc 2024-06-03 12:29:36 -04:00
parent 968370e3b5
commit 44c7fa1888
1 changed files with 8 additions and 0 deletions

View File

@ -19,8 +19,11 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.rusefi.core.ui.FrameHelper.appendBundleName;
import static com.rusefi.core.preferences.storage.PersistentConfiguration.getConfig;
@ -301,6 +304,11 @@ public class ProgramSelector {
updateModeComboBox.addItem(OPENBLT_AUTO);
updateModeComboBox.addItem(OPENBLT_SWITCH);
updateModeComboBox.addItem(OPENBLT_MANUAL);
List<SerialPortScanner.PortResult> listOfBootloaders = currentHardware.getKnownPorts().stream().filter(portResult -> portResult.type == SerialPortScanner.SerialPortType.OpenBlt).collect(Collectors.toList());
if (!listOfBootloaders.isEmpty()) {
updateModeComboBox.setSelectedItem(OPENBLT_MANUAL);
}
}
trueLayout(updateModeComboBox);