RAM efficiency of VR crank trigger shapes #2182

Audi OEM 5-cyl trigger pattern aka "Tri-Tach" https://rusefi.com/forum/viewtopic.php?f=5&t=1912

fixing build?
This commit is contained in:
rusefillc 2021-01-04 22:13:59 -05:00
parent c1b98505fd
commit fea596e867
2 changed files with 4 additions and 2 deletions

View File

@ -214,7 +214,7 @@ void TriggerStateWithRunningStatistics::movePreSynchTimestamps(DECLARE_ENGINE_PA
float TriggerStateWithRunningStatistics::calculateInstantRpm(TriggerFormDetails *triggerFormDetails,
int *prevIndexOut, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
int current_index = currentCycle.current_index; // local copy so that noone changes the value on us
assertIsInBounds(current_index, timeOfLastEvent, "calc timeOfLastEvent");
assertIsInBoundsWithResult(current_index, timeOfLastEvent, "calc timeOfLastEvent", 0);
timeOfLastEvent[current_index] = nowNt;
/**
* Here we calculate RPM based on last 90 degrees
@ -251,7 +251,7 @@ float TriggerStateWithRunningStatistics::calculateInstantRpm(TriggerFormDetails
return prevInstantRpmValue;
float instantRpm = (60000000.0 / 360 * US_TO_NT_MULTIPLIER) * angleDiff / time;
assertIsInBounds(current_index, instantRpmValue, "instantRpmValue");
assertIsInBoundsWithResult(current_index, instantRpmValue, "instantRpmValue", 0);
instantRpmValue[current_index] = instantRpm;
// This fixes early RPM instability based on incomplete data

View File

@ -107,6 +107,8 @@ constexpr size_t size(const T(&)[N]) {
#define assertIsInBounds(length, array, msg) efiAssertVoid(OBD_PCM_Processor_Fault, (length) >= 0 && (length) < efi::size(array), msg)
#define assertIsInBoundsWithResult(length, array, msg, failedResult) efiAssert(OBD_PCM_Processor_Fault, (length) >= 0 && (length) < efi::size(array), msg, failedResult)
/**
* Copies an array from src to dest. The lengths of the arrays must match.
*/