diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index 730d8391dd..cd82b062c1 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -271,7 +271,14 @@ static void onlineApplyWorkingCopyBytes(uint32_t offset, int count) { memcpy(((char*) &persistentState.persistentConfiguration) + offset, ((char*) &configWorkingCopy) + offset, count); #endif /* EFI_NO_CONFIG_WORKING_COPY */ + } + // todo: ECU does not burn while engine is running yet tune CRC + // tune CRC is calculated based on the latest online part (FSIO formulas are in online region of the tune) + // open question what's the best strategy to balance coding efforts, performance matters and tune crc functionality + // open question what is the runtime cost of wiping 2K of bytes on each IO communication, could be that 2K of byte memset + // is negligable comparing with the IO costs? + // wipeStrings(PASS_ENGINE_PARAMETER_SIGNATURE); } static const void * getStructAddr(int structId) { diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 620b81e322..baa11736bb 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -169,6 +169,8 @@ extern LoggingWithStorage sharedLogger; static void wipeString(char *string, int size) { // we have to reset bytes after \0 symbol in order to calculate correct tune CRC from MSQ file for (int i = strlen(string) + 1; i < size; i++) { + // todo: open question if it's worth replacing for loop with a memset. would a memset be much faster? + // do we care about performance here? string[i] = 0; } } diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index c9c3173124..550948181d 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -47,6 +47,7 @@ void setDefaultBasePins(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setDefaultSdCardParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE); void onBurnRequest(DECLARE_ENGINE_PARAMETER_SIGNATURE); +void wipeStrings(DECLARE_ENGINE_PARAMETER_SIGNATURE); void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE); void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE);