Addition to above processInjOpen/Closed procedures:
Discard Too-Long Pulses.
Code:
#define injEdgeIdx 10 //v0.82
#define injectorMaxTimeIdx 11 //discard any pulses longer than this value
#define parmsLength (sizeof(parms)/sizeof(unsigned long)) //array size
char * parmLabels[]={
"Contrast","VSS Pulses/Mile", "MicroSec/Gallon", "Pulses/2 revs","Timeout MicroSec",
"Tank Gal * 1000", "InjectorDelay uS","Weight (lbs)","Scratchpad(odo?)","VSS Delay ms",
"InjTrg 0=Dn 1=Up", "Max Inj Pulse us" };
unsigned volatile long maxInjOn=0;
// use for debugging, display it on a Custom screen. See what kind of pulse length we can expect during normal driving. Then, set injectorMaxTimeIdx accordingly.
void processInjClosed (void) //v0.82
{
tmpInstInjOn = elapsedMicroseconds(injHiStart);
if (tmpInstInjOn > parms[injectorMaxTimeIdx] || tmpInstInjOn < injectorSettleTime)
tmpInstInjOn = 0; // now weed out too-big & too-small pulses
else tmpInstInjOn -= injectorSettleTime;
if (tmpInstInjOn > maxInjOn) maxInjOn = tmpInstInjOn; //debugging info, to find max injector length
}
void processInjClosed (void) //v0.75
{
tmpInstInjOn = elapsedMicroseconds(injHiStart);
if (tmpInstInjOn > parms[injectorMaxTimeIdx] || tmpInstInjOn < parms[injectorSettleTimeIdx])
tmpInstInjOn = 0; // now weed out too-big & too-small pulses
else tmpInstInjOn -= parms[injectorSettleTimeIdx];
if (tmpInstInjOn > maxInjOn) maxInjOn = tmpInstInjOn; //debugging info, to find max injector length
}