In case of incompatible firmware and console we have a vague error message fix #1180

This commit is contained in:
rusefi 2020-03-10 19:12:37 -04:00
parent 010de27f0b
commit bd34f5479a
5 changed files with 17 additions and 12 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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

View File

@ -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;

View File

@ -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 " +