Correctly handle 2 stroke basic distributor setups. Fixes #1192
This commit is contained in:
parent
7f6b0c0cb9
commit
8138651740
|
@ -1011,7 +1011,11 @@ void triggerSetup_BasicDistributor(void)
|
|||
{
|
||||
triggerActualTeeth = configPage2.nCylinders;
|
||||
if(triggerActualTeeth == 0) { triggerActualTeeth = 1; }
|
||||
triggerToothAngle = 720U / triggerActualTeeth; //The number of degrees that passes from tooth to tooth
|
||||
|
||||
//The number of degrees that passes from tooth to tooth. Depends on number of cylinders and whether 4 or 2 stroke
|
||||
if(configPage2.strokes == FOUR_STROKE) { triggerToothAngle = 720U / triggerActualTeeth; }
|
||||
else { triggerToothAngle = 360U / triggerActualTeeth; }
|
||||
|
||||
triggerFilterTime = MICROS_PER_MIN / MAX_RPM / configPage2.nCylinders; // Minimum time required between teeth
|
||||
triggerFilterTime = triggerFilterTime / 2; //Safety margin
|
||||
triggerFilterTime = 0;
|
||||
|
@ -1085,11 +1089,14 @@ void triggerSec_BasicDistributor(void) { return; } //Not required
|
|||
uint16_t getRPM_BasicDistributor(void)
|
||||
{
|
||||
uint16_t tempRPM;
|
||||
uint8_t distributorSpeed = CAM_SPEED; //Default to cam speed
|
||||
if(configPage2.strokes == TWO_STROKE) { distributorSpeed = CRANK_SPEED; } //For 2 stroke distributors, the tooth rate is based on crank speed, not 'cam'
|
||||
|
||||
if( currentStatus.RPM < currentStatus.crankRPM || currentStatus.RPM < 1500)
|
||||
{
|
||||
tempRPM = crankingGetRPM(triggerActualTeeth, CAM_SPEED);
|
||||
tempRPM = crankingGetRPM(triggerActualTeeth, distributorSpeed);
|
||||
}
|
||||
else { tempRPM = stdGetRPM(CAM_SPEED); }
|
||||
else { tempRPM = stdGetRPM(distributorSpeed); }
|
||||
|
||||
MAX_STALL_TIME = revolutionTime << 1; //Set the stall time to be twice the current RPM. This is a safe figure as there should be no single revolution where this changes more than this
|
||||
if(triggerActualTeeth == 1) { MAX_STALL_TIME = revolutionTime << 1; } //Special case for 1 cylinder engines that only get 1 pulse every 720 degrees
|
||||
|
|
Loading…
Reference in New Issue