From bd34f5479a3402f5e3963c2039a10da25a50646e Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 10 Mar 2020 19:12:37 -0400 Subject: [PATCH] In case of incompatible firmware and console we have a vague error message fix #1180 --- firmware/console/binary/tunerstudio.cpp | 4 ++-- firmware/controllers/engine_controller.cpp | 2 +- firmware/integration/rusefi_config.txt | 14 +++++++++----- .../src/com/rusefi/config/generated/Fields.java | 6 +++--- java_console/ui/src/com/rusefi/Launcher.java | 3 ++- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index ae2676164e..f1404271ea 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -305,7 +305,7 @@ static void handleGetStructContent(ts_channel_s *tsChannel, int structId, int si // Returns true if an overrun would occur. static bool validateOffsetCount(size_t offset, size_t count, ts_channel_s *tsChannel) { if (offset + count > getTunerStudioPageSize()) { - scheduleMsg(&tsLogger, "TS: ERROR invalid offset %d count %d", offset, count); + scheduleMsg(&tsLogger, "TS: Project mismatch? Too much data requested %d/%d", offset, count); tunerStudioError("ERROR: out of range"); sendErrorCode(tsChannel); return true; @@ -631,7 +631,7 @@ void handleQueryCommand(ts_channel_s *tsChannel, ts_response_format_e mode) { */ void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count) { if (offset + count > sizeof(TunerStudioOutputChannels)) { - scheduleMsg(&tsLogger, "TS: ERROR invalid offset %d count %d", offset, count); + scheduleMsg(&tsLogger, "TS: Version Mismatch? Too much data requested %d+%d", offset, count); sendErrorCode(tsChannel); return; } diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 6d3fbfdc9d..768af7b50f 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -849,6 +849,6 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 201200309; + return 201200310; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 1bfeebbfc7..6cf39c0c29 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -23,12 +23,19 @@ ! type name;comment -#define TS_SIGNATURE "rusEFI v1.08" +#define TS_SIGNATURE "rusEFI v1.2020.3" + +! +! this is here so that rusEfi console can access it, too +! [IMPORTANT] every time TS_OUTPUT_SIZE is changed make sure to increment TS_SIGNATURE above +! +#define TS_OUTPUT_SIZE 240 + ! ! this is used to confirm that firmware and TunerStudio are using the same rusefi.ini version ! so not forget to change fileVersion in rusefi.ini ! todo: is this not needed in light of TS_SIGNATURE? -#define TS_FILE_VERSION 20191221 +#define TS_FILE_VERSION 20200310 ! all the sub-structures are going to be nested within the primary structure, that's @@ -67,9 +74,6 @@ struct_no_prefix engine_configuration_s #define ETB_BIAS_CURVE_LENGTH 8 -! this is here so that rusEfi console can access it, too -#define TS_OUTPUT_SIZE 240 - #define MAP_ANGLE_SIZE 8 #define MAP_WINDOW_SIZE 8 diff --git a/java_console/models/src/com/rusefi/config/generated/Fields.java b/java_console/models/src/com/rusefi/config/generated/Fields.java index a55117f556..6abbef8599 100644 --- a/java_console/models/src/com/rusefi/config/generated/Fields.java +++ b/java_console/models/src/com/rusefi/config/generated/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Mon Mar 09 19:26:17 EDT 2020 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Tue Mar 10 18:46:05 EDT 2020 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -1344,9 +1344,9 @@ public class Fields { public static final int triggerSimulatorPins1_offset = 736; public static final int triggerSimulatorPins2_offset = 737; public static final int triggerSimulatorPins3_offset = 738; - public static final int TS_FILE_VERSION = 20191221; + public static final int TS_FILE_VERSION = 20200310; public static final int TS_OUTPUT_SIZE = 240; - public static final String TS_SIGNATURE = "rusEFI v1.08"; + public static final String TS_SIGNATURE = "rusEFI v1.2020.3"; public static final int tunerStudioSerialSpeed_offset = 728; public static final int twoWireBatchIgnition_offset = 1476; public static final int twoWireBatchInjection_offset = 1476; diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index e05727a48a..4fc27551b7 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -49,7 +49,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see EngineSnifferPanel */ public class Launcher { - public static final int CONSOLE_VERSION = 20200308; + public static final int CONSOLE_VERSION = 20200310; public static final String INI_FILE_PATH = System.getProperty("ini_file_path", ".."); public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", ".."); public static final String TOOLS_PATH = System.getProperty("tools_path", "."); @@ -415,6 +415,7 @@ public class Launcher { wrongVersionListener = new SensorCentral.SensorListener() { @Override public void onSensorUpdate(double value) { + // todo: we need to migrate to TS_SIGNATURE validation!!! if (value != Fields.TS_FILE_VERSION) { String message = "This copy of rusEfi console is not compatible with this version of firmware\r\n" + "Console compatible with " + Fields.TS_FILE_VERSION + " while firmware compatible with " +