tuneCrc16 - we use it to match logs to tunes

This commit is contained in:
rusefi 2020-06-04 20:43:52 -04:00
parent 747ec8cf4a
commit d1a30f362c
7 changed files with 17 additions and 5 deletions

View File

@ -162,6 +162,9 @@ typedef struct {
uint32_t timeSeconds; // 112
uint32_t engineMode; // 116
uint32_t firmwareVersion; // 120
// todo: this not needed in light of TS_SIGNATURE but rusEFI console still uses it. Need to migrate
// rusEFI console from TS_FILE_VERSION to TS_SIGNATURE :(
uint32_t tsConfigVersion; // 124
// These two fields indicate to TS that we'd like to set a particular field to a particular value
@ -216,7 +219,7 @@ typedef struct {
scaled_voltage rawIat; // 236
scaled_voltage rawOilPressure; // 238
int16_t tuneCrc16;
int16_t tuneCrc16; // 240
uint8_t unusedAtTheEnd[2]; // we have some unused bytes to allow compatible TS changes
// Temporary - will remove soon

View File

@ -253,6 +253,11 @@ void Engine::preCalculate(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// we take 2 bytes of crc32, no idea if it's right to call it crc16 or not
// we have a hack here - we rely on the fact that engineMake is the first of three relevant fields
tsOutputChannels.engineMakeCodeNameCrc16 = crc32(engineConfiguration->engineMake, 3 * VEHICLE_INFO_SIZE);
// 'warning_message' has very annoying complications but unfortunately I find 'warning_message' to be useful enough :(
// a proper solution could be to move 'warning_message' to a separate TS page
tsOutputChannels.tuneCrc16 = crc32(engineConfiguration, sizeof(engine_configuration_s)) +
crc32(engine->config->afterstartCoolantBins, sizeof(persistent_config_s) - afterstartCoolantBins_offset);
#endif /* EFI_TUNER_STUDIO */
}

View File

@ -171,6 +171,7 @@ extern LoggingWithStorage sharedLogger;
* online tuning of most values in the maps does not count as configuration change, but 'Burn' command does
*
* this method is NOT currently invoked on ECU start - actual user input has to happen!
* See preCalculate which is invoked BOTH on start and configuration change
*/
void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
ENGINE(globalConfigurationVersion++);

View File

@ -717,6 +717,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20200602;
return 20200604;
}
#endif /* EFI_UNIT_TEST */

View File

@ -91,9 +91,8 @@ public enum Sensor {
FIRMWARE_VERSION("FW version", SensorCategory.OPERATIONS, FieldType.INT, 120),
TS_CONFIG_VERSION(".ini version", SensorCategory.OPERATIONS, FieldType.INT, 124),
engineMakeCodeNameCrc16("engine crc16", SensorCategory.STATUS, FieldType.INT16, 134, 0, 5),
// Errors
totalTriggerErrorCounter("trigger total error counter", SensorCategory.STATUS, FieldType.INT, 128, 0, 5),
orderingErrorCounter("trigger order error counter", SensorCategory.STATUS, FieldType.INT, 132, 0, 5),
errorCodeCounter("error counter", SensorCategory.STATUS, FieldType.INT, 136, 0, 5),
lastErrorCode("last error", SensorCategory.STATUS, FieldType.INT, 138, 0, 5),
@ -111,6 +110,8 @@ public enum Sensor {
debugIntField4("debug i4", SensorCategory.DEBUG, FieldType.INT16, 196, 0, 5),
debugIntField5("debug i5", SensorCategory.DEBUG, FieldType.INT16, 198, 0, 5),
tuneCrc16("tune crc16", SensorCategory.STATUS, FieldType.INT16, 240, 0, 5),
// Synthetic (console only) channels
ETB_CONTROL_QUALITY("ETB metric", SensorCategory.SNIFFING, "", 100),
;

View File

@ -3,6 +3,6 @@ package com.rusefi;
import java.util.concurrent.atomic.AtomicReference;
public class rusEFIVersion {
public static final int CONSOLE_VERSION = 20200601;
public static final int CONSOLE_VERSION = 20200604;
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
}

View File

@ -84,6 +84,8 @@ public class SensorLogger {
Sensor.errorCodeCounter,
Sensor.lastErrorCode,
Sensor.engineMakeCodeNameCrc16,
Sensor.tuneCrc16,
};
private static long fileStartTime;