From 50c11cf778346d7479acfbe5028f66c6a36807fa Mon Sep 17 00:00:00 2001 From: rusefillc Date: Tue, 1 Oct 2024 00:35:21 -0400 Subject: [PATCH] console does not work for custom FW #6961 --- .../com/rusefi/binaryprotocol/BinaryProtocol.java | 6 +++++- .../src/main/java/com/rusefi/core/rusEFIVersion.java | 2 +- .../ui/src/main/java/com/rusefi/ui/OnlineTab.java | 2 +- .../ui/src/main/java/com/rusefi/ui/UIContext.java | 6 ------ .../main/java/com/rusefi/ui/console/MainFrame.java | 2 +- .../main/java/com/rusefi/ui/console/SettingsTab.java | 11 ++++++----- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java index e72d963218..bc06535c53 100644 --- a/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -70,6 +70,10 @@ public class BinaryProtocol { public static boolean DISABLE_LOCAL_CONFIGURATION_CACHE; public static IniFileProvider iniFileProvider = new RealIniFileProvider(); + public IniFileModel getIniFile() { + return iniFile; + } + public static String findCommand(byte command) { switch (command) { case Integration.TS_PAGE_COMMAND: @@ -377,7 +381,7 @@ public class BinaryProtocol { if (ConnectionAndMeta.saveSettingsToFile()) { ConfigurationImageFile.saveToFile(image, CONFIGURATION_RUSEFI_BINARY); } - Msq tune = MsqFactory.valueOf(image, IniFileModelImpl.getInstance()); + Msq tune = MsqFactory.valueOf(image, iniFile); tune.writeXmlFile(CONFIGURATION_RUSEFI_XML); } catch (Exception e) { System.err.println("Ignoring " + e); diff --git a/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java b/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java index 64cea355f3..2c3c8ddae9 100644 --- a/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java +++ b/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java @@ -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 = 20240930; + int CONSOLE_VERSION = 20241001; AtomicReference firmwareVersion = new AtomicReference<>("N/A"); static long classBuildTimeMillis() { diff --git a/java_console/ui/src/main/java/com/rusefi/ui/OnlineTab.java b/java_console/ui/src/main/java/com/rusefi/ui/OnlineTab.java index 1b4ee4aea2..590d0a3a0f 100644 --- a/java_console/ui/src/main/java/com/rusefi/ui/OnlineTab.java +++ b/java_console/ui/src/main/java/com/rusefi/ui/OnlineTab.java @@ -25,7 +25,7 @@ public class OnlineTab { upload.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { - Msq tune = MsqFactory.valueOf(uiContext.getLinkManager().getCurrentStreamState().getControllerConfiguration(), uiContext.getIni()); + Msq tune = MsqFactory.valueOf(uiContext.getLinkManager().getCurrentStreamState().getControllerConfiguration(), null); Online.uploadTune(tune, content, null); } }); diff --git a/java_console/ui/src/main/java/com/rusefi/ui/UIContext.java b/java_console/ui/src/main/java/com/rusefi/ui/UIContext.java index 95f544bf23..5621566f36 100644 --- a/java_console/ui/src/main/java/com/rusefi/ui/UIContext.java +++ b/java_console/ui/src/main/java/com/rusefi/ui/UIContext.java @@ -1,7 +1,5 @@ package com.rusefi.ui; -import com.opensr5.ini.IniFileModel; -import com.opensr5.ini.IniFileModelImpl; import com.rusefi.SensorSnifferCentral; import com.rusefi.io.CommandQueue; import com.rusefi.io.LinkManager; @@ -24,8 +22,4 @@ public class UIContext { public CommandQueue getCommandQueue() { return linkManager.getCommandQueue(); } - - public IniFileModel getIni() { - return IniFileModelImpl.getInstance(); - } } diff --git a/java_console/ui/src/main/java/com/rusefi/ui/console/MainFrame.java b/java_console/ui/src/main/java/com/rusefi/ui/console/MainFrame.java index 468cfa4a4f..ca4f7f135c 100644 --- a/java_console/ui/src/main/java/com/rusefi/ui/console/MainFrame.java +++ b/java_console/ui/src/main/java/com/rusefi/ui/console/MainFrame.java @@ -92,7 +92,7 @@ public class MainFrame { ConnectionWatchdog.init(linkManager); SwingUtilities.invokeLater(() -> { - tabbedPane.settingsTab.showContent(); + tabbedPane.settingsTab.showContent(linkManager); tabbedPane.logsManager.showContent(); /** * todo: we are definitely not handling reconnect properly, no code to shut down old instance of server diff --git a/java_console/ui/src/main/java/com/rusefi/ui/console/SettingsTab.java b/java_console/ui/src/main/java/com/rusefi/ui/console/SettingsTab.java index 7761292613..8b32cca352 100644 --- a/java_console/ui/src/main/java/com/rusefi/ui/console/SettingsTab.java +++ b/java_console/ui/src/main/java/com/rusefi/ui/console/SettingsTab.java @@ -1,12 +1,11 @@ package com.rusefi.ui.console; import com.opensr5.ini.DialogModel; -import com.opensr5.ini.IniFileModel; import com.rusefi.config.Field; import com.rusefi.config.FieldType; import com.rusefi.config.FieldsMap; -import com.rusefi.config.generated.Fields; import com.rusefi.config.generated.Integration; +import com.rusefi.io.LinkManager; import com.rusefi.ui.RecentCommands; import com.rusefi.ui.UIContext; import com.rusefi.ui.config.*; @@ -32,6 +31,7 @@ public class SettingsTab { private final JButton dialog = new JButton(); private final JPanel dialogBody = new JPanel(); private final UIContext uiContext; + private LinkManager linkManager; public SettingsTab(UIContext uiContext) { this.uiContext = uiContext; @@ -42,8 +42,9 @@ public class SettingsTab { return content; } - public void showContent() { - final Map dialogs = uiContext.getIni().getDialogs(); + public void showContent(LinkManager linkManager) { + this.linkManager = linkManager; + final Map dialogs = linkManager.getBinaryProtocol().getIniFile().getDialogs(); if (dialogs.isEmpty()) { content.removeAll(); content.add(new JLabel("Meta data not found: " + RUSEFI_INI_PREFIX + "*" + RUSEFI_INI_SUFFIX)); @@ -135,7 +136,7 @@ public class SettingsTab { dialog.setText(name); dialogBody.removeAll(); - DialogModel m = uiContext.getIni().getDialogs().get(name); + DialogModel m = linkManager.getBinaryProtocol().getIniFile().getDialogs().get(name); dialogBody.setLayout(new GridLayout(m.getFields().size(), 1));