From f6a18d97b6cb554c8051a940cee69af0c60f70fa Mon Sep 17 00:00:00 2001 From: rusEfi Date: Fri, 7 Nov 2014 11:03:10 -0600 Subject: [PATCH] auto-sync --- firmware/controllers/algo/ec2.h | 9 ++++--- firmware/controllers/math/engine_math.cpp | 20 +++++++------- java_console/ui/src/com/irnems/Launcher.java | 2 +- .../ui/src/com/rusefi/VersionChecker.java | 27 ++++++++++++++----- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/firmware/controllers/algo/ec2.h b/firmware/controllers/algo/ec2.h index 00196145c7..09dea02b85 100644 --- a/firmware/controllers/algo/ec2.h +++ b/firmware/controllers/algo/ec2.h @@ -19,6 +19,12 @@ class FuelSchedule { public: ActuatorEventList events; + + void addFuelEvents(engine_configuration_s const *e, trigger_shape_s *s, + injection_mode_e mode); + void registerInjectionEvent(engine_configuration_s const *e, trigger_shape_s *s, + io_pin_e pin, float angle); + }; /** @@ -47,9 +53,6 @@ public: void initializeIgnitionActions(float advance, float dwellAngle, engine_configuration_s *engineConfiguration, engine_configuration2_s *engineConfiguration2, IgnitionEventList *list); -void addFuelEvents(engine_configuration_s const *e, - trigger_shape_s * ts, - FuelSchedule *fs, injection_mode_e mode); void setDefaultNonPersistentConfiguration(engine_configuration2_s *engineConfiguration2); void printConfiguration(engine_configuration_s *engineConfiguration, engine_configuration2_s *engineConfiguration2); diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index 39e6818d74..1e53c36c12 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -171,8 +171,9 @@ void initializeIgnitionActions(float advance, float dwellAngle, engine_configura } } -static void registerInjectionEvent(engine_configuration_s const *e, trigger_shape_s *s, ActuatorEventList *list, +void FuelSchedule::registerInjectionEvent(engine_configuration_s const *e, trigger_shape_s *s, io_pin_e pin, float angle) { + ActuatorEventList *list = &events; if (!isPinAssigned(pin)) { // todo: extact method for this index math @@ -182,10 +183,9 @@ static void registerInjectionEvent(engine_configuration_s const *e, trigger_shap registerActuatorEventExt(e, s, list->getNextActuatorEvent(), injectonSignals.add(pin), angle); } -void addFuelEvents(engine_configuration_s const *e, trigger_shape_s *s, - FuelSchedule *fs, +void FuelSchedule::addFuelEvents(engine_configuration_s const *e, trigger_shape_s *s, injection_mode_e mode) { - ActuatorEventList *list = &fs->events; + ActuatorEventList *list = &events; ; list->resetEventList(); @@ -196,7 +196,7 @@ void addFuelEvents(engine_configuration_s const *e, trigger_shape_s *s, for (int i = 0; i < e->cylindersCount; i++) { io_pin_e pin = (io_pin_e) ((int) INJECTOR_1_OUTPUT + getCylinderId(e->firingOrder, i) - 1); float angle = baseAngle + i * 720.0 / e->cylindersCount; - registerInjectionEvent(e, s, list, pin, angle); + registerInjectionEvent(e, s, pin, angle); } break; case IM_SIMULTANEOUS: @@ -205,7 +205,7 @@ void addFuelEvents(engine_configuration_s const *e, trigger_shape_s *s, for (int j = 0; j < e->cylindersCount; j++) { io_pin_e pin = (io_pin_e) ((int) INJECTOR_1_OUTPUT + j); - registerInjectionEvent(e, s, list, pin, angle); + registerInjectionEvent(e, s, pin, angle); } } break; @@ -214,13 +214,13 @@ void addFuelEvents(engine_configuration_s const *e, trigger_shape_s *s, int index = i % (e->cylindersCount / 2); io_pin_e pin = (io_pin_e) ((int) INJECTOR_1_OUTPUT + index); float angle = baseAngle + i * 720.0 / e->cylindersCount; - registerInjectionEvent(e, s, list, pin, angle); + registerInjectionEvent(e, s, pin, angle); /** * also fire the 2nd half of the injectors so that we can implement a batch mode on individual wires */ pin = (io_pin_e) ((int) INJECTOR_1_OUTPUT + index + (e->cylindersCount / 2)); - registerInjectionEvent(e, s, list, pin, angle); + registerInjectionEvent(e, s, pin, angle); } break; default: @@ -356,9 +356,9 @@ engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2; trigger_shape_s * ts = &engineConfiguration2->triggerShape; injectonSignals.clear(); - addFuelEvents(engineConfiguration, ts, &engineConfiguration2->crankingInjectionEvents, + engineConfiguration2->crankingInjectionEvents.addFuelEvents(engineConfiguration, ts, engineConfiguration->crankingInjectionMode); - addFuelEvents(engineConfiguration, ts, &engineConfiguration2->injectionEvents, + engineConfiguration2->injectionEvents.addFuelEvents(engineConfiguration, ts, engineConfiguration->injectionMode); } diff --git a/java_console/ui/src/com/irnems/Launcher.java b/java_console/ui/src/com/irnems/Launcher.java index 56b491b81d..27a5622995 100644 --- a/java_console/ui/src/com/irnems/Launcher.java +++ b/java_console/ui/src/com/irnems/Launcher.java @@ -19,7 +19,7 @@ import javax.swing.*; * @see WavePanel */ public class Launcher extends FrameHelper { - public static final int CONSOLE_VERSION = 20141105; + public static final int CONSOLE_VERSION = 20141107; public static final boolean SHOW_STIMULATOR = true; private final String port; diff --git a/java_console/ui/src/com/rusefi/VersionChecker.java b/java_console/ui/src/com/rusefi/VersionChecker.java index 20dc4db43c..090022f337 100644 --- a/java_console/ui/src/com/rusefi/VersionChecker.java +++ b/java_console/ui/src/com/rusefi/VersionChecker.java @@ -2,6 +2,7 @@ package com.rusefi; import com.irnems.FileLog; import com.rusefi.io.tcp.TcpConnector; +import com.rusefi.ui.widgets.URLLabel; import javax.swing.*; import java.awt.*; @@ -28,7 +29,7 @@ public class VersionChecker { private static final VersionChecker instance = new VersionChecker(); - private final Map map = new HashMap<>(); + private final Map map = new HashMap<>(); private int previousReportedVersion; private VersionChecker() { @@ -59,14 +60,22 @@ public class VersionChecker { while ((line = s.readLine()) != null) { String[] pair = line.split("="); if (pair.length == 2) - map.put(pair[0], TcpConnector.parseIntWithReason(pair[1], "VC value")); + map.put(pair[0], pair[1]); } - final Integer javaVersion = map.get(JAVA_CONSOLE_TAG); + final Integer javaVersion = TcpConnector.parseIntWithReason(map.get(JAVA_CONSOLE_TAG), "VC value"); System.out.println("Server recommends java_console version " + javaVersion + " or newer"); showUpdateWarningIfNeeded("dev console", javaVersion, CONSOLE_VERSION); System.out.println("Server recommends firmware " + map.get(FIRMWARE_TAG) + " or newer"); + + String criticalUrl = map.get("critical_url"); + if (criticalUrl != null && !criticalUrl.trim().isEmpty()) { + JPanel panel = new JPanel(new BorderLayout()); + panel.add(new JLabel("WARNING! CRITICAL ISSUE! Are you sure you want to run rusEfi?"), BorderLayout.NORTH); + panel.add(new URLLabel(criticalUrl, criticalUrl), BorderLayout.CENTER); + JOptionPane.showMessageDialog(getPaneParent(), panel); + } } private static void showUpdateWarningIfNeeded(final String componentName, final Integer latestVersion, final int currentVersion) { @@ -75,25 +84,29 @@ public class VersionChecker { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - Component parent = JFrame.getFrames()[0]; String message = "It's time to update " + componentName + "!\r\n" + "Your version: " + currentVersion + "\r\n" + "Latest version: " + latestVersion; - JOptionPane.showMessageDialog(parent, message, "Update", JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog(getPaneParent(), message, "Update", JOptionPane.WARNING_MESSAGE); } }); } + private static Component getPaneParent() { + return JFrame.getFrames()[0]; + } + public static VersionChecker getInstance() { return instance; } public void onFirmwareVersion(String firmwareString) { - Integer latestVersion = map.get(FIRMWARE_TAG); - if (latestVersion == null) { + String suggestedFirmware = map.get(FIRMWARE_TAG); + if (suggestedFirmware == null) { // no version file yet? nothing to bother about return; } + int latestVersion = TcpConnector.parseIntWithReason(suggestedFirmware, "VC value"); String[] tokens = firmwareString.split("[@\\s]"); int version; try {