From f485ccc000172571427b24cb51060197f996ccbd Mon Sep 17 00:00:00 2001 From: rusEfi Date: Fri, 28 Jun 2019 23:33:48 -0400 Subject: [PATCH] reducing code duplication & reboot to rusEfi console --- firmware/controllers/injector_central.cpp | 7 +++++-- firmware/rusefi.cpp | 2 +- firmware/rusefi.h | 1 + java_console/ui/src/com/rusefi/BenchTestPane.java | 8 +++++++- java_console/ui/src/com/rusefi/Launcher.java | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/firmware/controllers/injector_central.cpp b/firmware/controllers/injector_central.cpp index 0cd0fef03d..af3d2bc6d3 100644 --- a/firmware/controllers/injector_central.cpp +++ b/firmware/controllers/injector_central.cpp @@ -37,6 +37,9 @@ #include "idle_thread.h" #include "periodic_controller.h" #include "tps.h" +#if EFI_PROD_CODE +#include "rusefi.h" +#endif /* EFI_PROD_CODE */ EXTERN_ENGINE ; @@ -299,8 +302,8 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) { scheduleStopEngine(); } else if (subsystem == 0xbb) { #if EFI_PROD_CODE - NVIC_SystemReset(); -#endif + rebootNow(); +#endif /* EFI_PROD_CODE */ } } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 47a5fff249..7e5fd9e087 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -145,7 +145,7 @@ EXTERN_ENGINE ; // todo: move this into a hw-specific file -static void rebootNow(void) { +void rebootNow(void) { NVIC_SystemReset(); } diff --git a/firmware/rusefi.h b/firmware/rusefi.h index 6cdd0297c6..15c80b0510 100644 --- a/firmware/rusefi.h +++ b/firmware/rusefi.h @@ -9,5 +9,6 @@ #define RUSEFI_H_ void runRusEfi(void); +void rebootNow(void); #endif /* RUSEFI_H_ */ diff --git a/java_console/ui/src/com/rusefi/BenchTestPane.java b/java_console/ui/src/com/rusefi/BenchTestPane.java index cec8ae23ba..e11e918d51 100644 --- a/java_console/ui/src/com/rusefi/BenchTestPane.java +++ b/java_console/ui/src/com/rusefi/BenchTestPane.java @@ -9,7 +9,7 @@ import java.awt.*; import static com.rusefi.CommandControl.TEST; public class BenchTestPane { - private final JPanel content = new JPanel(new GridLayout(2, 4)); + private final JPanel content = new JPanel(new GridLayout(2, 5)); public BenchTestPane() { content.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); @@ -21,6 +21,12 @@ public class BenchTestPane { content.add(createMILTest()); content.add(createIdleTest()); content.add(createDizzyTest()); + content.add(new CommandControl("Reboot", "", "Reboot") { + @Override + protected String getCommand() { + return "reboot"; + } + }.getContent()); content.add(new MessagesView().messagesScroll); } diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index e69cc08fed..423576f160 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -46,7 +46,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see EngineSnifferPanel */ public class Launcher { - public static final int CONSOLE_VERSION = 20190625; + public static final int CONSOLE_VERSION = 20190628; public static final boolean SHOW_STIMULATOR = false; public static final String INPUT_FILES_PATH = ".."; private static final String TAB_INDEX = "main_tab";