Starting improvements on the 4g63 pattern
This commit is contained in:
parent
b71c59947e
commit
13e3b1f37b
|
@ -708,7 +708,7 @@ void triggerPri_4G63()
|
||||||
|
|
||||||
if (currentStatus.hasSync == true)
|
if (currentStatus.hasSync == true)
|
||||||
{
|
{
|
||||||
if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) && configPage2.ignCranklock)
|
if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) && configPage2.ignCranklock && (currentStatus.startRevolutions >= configPage2.StgCycles))
|
||||||
{
|
{
|
||||||
if( toothCurrentCount == 1 ) { endCoil1Charge(); }
|
if( toothCurrentCount == 1 ) { endCoil1Charge(); }
|
||||||
else if( toothCurrentCount == 3 ) { endCoil2Charge(); }
|
else if( toothCurrentCount == 3 ) { endCoil2Charge(); }
|
||||||
|
@ -784,7 +784,7 @@ void triggerSec_4G63()
|
||||||
|
|
||||||
curTime2 = micros();
|
curTime2 = micros();
|
||||||
curGap2 = curTime2 - toothLastSecToothTime;
|
curGap2 = curTime2 - toothLastSecToothTime;
|
||||||
if ( (curGap2 >= triggerSecFilterTime) || (currentStatus.startRevolutions == 0) )
|
if ( (curGap2 >= triggerSecFilterTime) )//|| (currentStatus.startRevolutions == 0) )
|
||||||
{
|
{
|
||||||
toothLastSecToothTime = curTime2;
|
toothLastSecToothTime = curTime2;
|
||||||
|
|
||||||
|
@ -797,6 +797,7 @@ void triggerSec_4G63()
|
||||||
|
|
||||||
if(BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) || (currentStatus.hasSync == false) )
|
if(BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) || (currentStatus.hasSync == false) )
|
||||||
{
|
{
|
||||||
|
|
||||||
triggerFilterTime = 1500; //If this is removed, can have trouble getting sync again after the engine is turned off (but ECU not reset).
|
triggerFilterTime = 1500; //If this is removed, can have trouble getting sync again after the engine is turned off (but ECU not reset).
|
||||||
if(READ_PRI_TRIGGER() == true)// && (crankState == digitalRead(pinTrigger)))
|
if(READ_PRI_TRIGGER() == true)// && (crankState == digitalRead(pinTrigger)))
|
||||||
{
|
{
|
||||||
|
@ -810,7 +811,15 @@ void triggerSec_4G63()
|
||||||
triggerSecFilterTime_duration = (micros() - secondaryLastToothTime1) >> 1;
|
triggerSecFilterTime_duration = (micros() - secondaryLastToothTime1) >> 1;
|
||||||
if(READ_PRI_TRIGGER() == true)// && (crankState == digitalRead(pinTrigger)))
|
if(READ_PRI_TRIGGER() == true)// && (crankState == digitalRead(pinTrigger)))
|
||||||
{
|
{
|
||||||
toothCurrentCount = 4; //If the crank trigger is currently HIGH, it means we're on tooth #1
|
if( (currentStatus.RPM < currentStatus.crankRPM) && (currentStatus.hasSync == true) )
|
||||||
|
{
|
||||||
|
|
||||||
|
//Whilst we're cranking and have sync, we need to watch for noise pulses.
|
||||||
|
if(toothCurrentCount != 4) { currentStatus.hasSync = false; } // This should never be true, except when there's noise
|
||||||
|
else { toothCurrentCount = 4; }
|
||||||
|
}
|
||||||
|
else { toothCurrentCount = 4; } //If the crank trigger is currently HIGH, it means we're on tooth #1
|
||||||
|
|
||||||
}
|
}
|
||||||
} // Use resync
|
} // Use resync
|
||||||
} //Trigger filter
|
} //Trigger filter
|
||||||
|
@ -838,7 +847,7 @@ uint16_t getRPM_4G63()
|
||||||
toothTime = toothTime * 36;
|
toothTime = toothTime * 36;
|
||||||
tempRPM = ((unsigned long)tempToothAngle * 6000000UL) / toothTime;
|
tempRPM = ((unsigned long)tempToothAngle * 6000000UL) / toothTime;
|
||||||
revolutionTime = (10UL * toothTime) / tempToothAngle;
|
revolutionTime = (10UL * toothTime) / tempToothAngle;
|
||||||
MAX_STALL_TIME = revolutionTime << 3;
|
//MAX_STALL_TIME = revolutionTime << 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -695,6 +695,7 @@ void loop()
|
||||||
currentStatus.PW1 = 0;
|
currentStatus.PW1 = 0;
|
||||||
currentStatus.VE = 0;
|
currentStatus.VE = 0;
|
||||||
toothLastToothTime = 0;
|
toothLastToothTime = 0;
|
||||||
|
toothLastSecToothTime = 0;
|
||||||
//toothLastMinusOneToothTime = 0;
|
//toothLastMinusOneToothTime = 0;
|
||||||
currentStatus.hasSync = false;
|
currentStatus.hasSync = false;
|
||||||
currentStatus.runSecs = 0; //Reset the counter for number of seconds running.
|
currentStatus.runSecs = 0; //Reset the counter for number of seconds running.
|
||||||
|
|
Loading…
Reference in New Issue