rusefi 2019-06-25 18:20:01 -04:00
parent 6b1edd9e29
commit 50bf018fe9
2 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#define VVT_NAME "VVT"
// we use this value in case of noise on trigger input lines
#define NOISY_RPM -1
#define UNREALISTIC_RPM 30000

View File

@ -181,6 +181,9 @@ float TriggerStateWithRunningStatistics::calculateInstantRpm(int *prevIndex, efi
*/
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[current_index]);
// todo: make this '90' depend on cylinder count or trigger shape?
if (cisnan(currentAngle)) {
return NOISY_RPM;
}
angle_t previousAngle = currentAngle - 90;
fixAngle(previousAngle, "prevAngle", CUSTOM_ERR_6560);
// todo: prevIndex should be pre-calculated