more on wipeString

This commit is contained in:
rusefi 2020-07-05 14:09:43 -04:00
parent 9f3106db39
commit 42541da76c
3 changed files with 10 additions and 0 deletions

View File

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

View File

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

View File

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