minor usability: reducing "set date" spam

This commit is contained in:
rusefi 2021-10-10 21:57:23 -04:00
parent c4b61d1024
commit fd6bedc965
3 changed files with 5 additions and 9 deletions

View File

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

View File

@ -198,7 +198,7 @@ public class RecentCommands {
getConfig().getRoot().setProperty(KEY, pack()); getConfig().getRoot().setProperty(KEY, pack());
} }
private static boolean isBoringCommand(String command) { public static boolean isBoringCommand(String command) {
return command.startsWith(getSetCommand(CMD_DATE)); return command.startsWith(getSetCommand(CMD_DATE));
} }

View File

@ -29,6 +29,7 @@ import java.util.function.Function;
/** /**
* Date: 3/20/13 * Date: 3/20/13
* Andrey Belomutskiy, (c) 2013-2020 * Andrey Belomutskiy, (c) 2013-2020
* @see com.rusefi.CommandControl for hard-coded commands
*/ */
public class AnyCommand { public class AnyCommand {
private final static ThreadFactory THREAD_FACTORY = new NamedThreadFactory("AnyCommand"); private final static ThreadFactory THREAD_FACTORY = new NamedThreadFactory("AnyCommand");
@ -53,16 +54,11 @@ public class AnyCommand {
content.add(text); content.add(text);
JButton go = new JButton("Go"); JButton go = new JButton("Go");
go.setContentAreaFilled(false); go.setContentAreaFilled(false);
go.addActionListener(new ActionListener() { go.addActionListener(e -> send());
@Override
public void actionPerformed(ActionEvent e) {
send();
}
});
content.add(go); content.add(go);
uiContext.getCommandQueue().addListener(command -> { uiContext.getCommandQueue().addListener(command -> {
if (listenToCommands && !reentrant) if (listenToCommands && !reentrant && RecentCommands.isBoringCommand(command))
text.setText(command); text.setText(command);
}); });