updates to support display cam tooth position
added code to display which teeth the cam tooth arrives on as VVT1 & 2 and as Aux0 and Aux1.
This commit is contained in:
parent
038782a6da
commit
d2ace89ea7
|
@ -4435,6 +4435,9 @@ void triggerSetEndTeeth_NGC()
|
|||
/** Renix 44-2-2 and 66-2-2-2 decoder.
|
||||
* Renix trigger wheel doesn't decode into 360 degrees nicely (360/44 = 8.18 degrees or 360/66 = 5.454545). Speeduino can't handle any teeth that have a decimal point.
|
||||
* Solution is to count teeth, every 11 teeth = a proper angle. For 66 tooth decoder its 60 degrees per 11 teeth, for 44 tooth decoder its 90 degrees per 11 teeth.
|
||||
* This means the system sees 4 teeth on the 44 tooth wheel and 6 teeth on the 66 tooth wheel.
|
||||
* Double missing tooth in the pattern is actually a large tooth and a large gap. If the trigger is set to rising you'll see the start of the large tooth
|
||||
* then the gap. If its not set to rising the code won't work due to seeing two gaps
|
||||
*
|
||||
* @defgroup dec_renix Renix decoder
|
||||
* @{
|
||||
|
@ -4480,6 +4483,8 @@ void triggerPri_Renix()
|
|||
toothSystemCount++;
|
||||
validTrigger = true;
|
||||
|
||||
// Serial3.print(" S:"); // Serial3.print(toothSystemCount);
|
||||
|
||||
if( renixSystemLastToothTime != 0 && renixSystemLastMinusOneToothTime != 0)
|
||||
{ targetGap = (2 * (renixSystemLastToothTime - renixSystemLastMinusOneToothTime));} // in real world the physical 2 tooth gap is bigger than 2 teeth - more like 2.5
|
||||
else
|
||||
|
@ -4487,13 +4492,16 @@ void triggerPri_Renix()
|
|||
|
||||
if( curGap >= targetGap )
|
||||
{
|
||||
/* add two teeth to account for the gap we've just seen */
|
||||
/* add two teeth to account for the gap we've just seen */
|
||||
toothSystemCount++;
|
||||
// Serial3.print(" GAP:"); // Serial3.print(toothSystemCount);
|
||||
toothSystemCount++;
|
||||
// Serial3.print(" GAP:"); // Serial3.print(toothSystemCount);
|
||||
|
||||
if( toothSystemCount != 12) // if not 12 (the first tooth after the gap) then we've lost sync
|
||||
{
|
||||
// lost sync
|
||||
// Serial3.print(" LOST SYNC 1"); // Serial3.println("");
|
||||
currentStatus.hasSync = false;
|
||||
currentStatus.syncLossCounter++;
|
||||
toothSystemCount = 1; // first tooth after gap is always 1
|
||||
|
@ -4512,6 +4520,10 @@ void triggerPri_Renix()
|
|||
if( toothSystemCount == 12)
|
||||
{
|
||||
toothCurrentCount++;
|
||||
// Serial3.println("");
|
||||
// Serial3.print(" Tooth"); // Serial3.print(toothCurrentCount);
|
||||
// Serial3.println("");
|
||||
|
||||
if( (configPage4.TrigPattern == DECODER_RENIX66 && toothCurrentCount == 7) || // 6 Pretend teeth on the 66 tooth wheel, if get to severn rotate round back to first tooth
|
||||
(configPage4.TrigPattern == DECODER_RENIX44 && toothCurrentCount == 5 ) ) // 4 Pretend teeth on the 44 tooth wheel, if get to five rotate round back to first tooth
|
||||
{
|
||||
|
@ -4521,6 +4533,9 @@ void triggerPri_Renix()
|
|||
currentStatus.startRevolutions++; //Counter
|
||||
revolutionOne = !revolutionOne;
|
||||
toothCurrentCount = 1;
|
||||
// Serial3.println("");
|
||||
// Serial3.print("** ROTATE **");
|
||||
// Serial3.println("");
|
||||
}
|
||||
|
||||
toothSystemCount = 1;
|
||||
|
@ -4566,39 +4581,58 @@ void triggerSec_Renix()
|
|||
secondaryToothCount++;
|
||||
toothLastSecToothTime = curTime2;
|
||||
|
||||
// for debug only
|
||||
currentStatus.vvt1Angle = 2 * toothCurrentCount;
|
||||
currentStatus.vvt2Angle = 2 * toothSystemCount;
|
||||
currentStatus.canin[0] = toothCurrentCount;
|
||||
currentStatus.canin[1] = toothSystemCount;
|
||||
|
||||
if (configPage4.TrigPattern == DECODER_RENIX44)
|
||||
{
|
||||
if( toothCurrentCount == 4 && toothSystemCount == 9)
|
||||
if( toothCurrentCount == 4 && toothSystemCount == 2)
|
||||
{
|
||||
revolutionOne = 0;
|
||||
currentStatus.startRevolutions++; //Counter
|
||||
currentStatus.hasSync = true;
|
||||
// Serial3.println("");
|
||||
// Serial3.print(" -- CAM -- Cur:"); // Serial3.print(toothCurrentCount); // Serial3.print(" Sys:"); // Serial3.print(toothSystemCount);
|
||||
// Serial3.println("");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Serial3.println(" CAM FAIL");
|
||||
// Serial3.print(" -- CAM -- Cur:"); // Serial3.print(toothCurrentCount); // Serial3.print(" Sys:"); // Serial3.print(toothSystemCount);
|
||||
// Serial3.println(" CAM FAIL");
|
||||
currentStatus.hasSync = false;
|
||||
currentStatus.syncLossCounter++;
|
||||
revolutionOne = 0;
|
||||
}
|
||||
toothCurrentCount= 4;
|
||||
toothSystemCount = 9;
|
||||
toothSystemCount = 2;
|
||||
}
|
||||
else if (configPage4.TrigPattern == DECODER_RENIX66)
|
||||
{
|
||||
if( toothCurrentCount == 6 && toothSystemCount == 9)
|
||||
if( toothCurrentCount == 6 && toothSystemCount == 2)
|
||||
{
|
||||
// Serial3.println("");
|
||||
// Serial3.print(" -- CAM -- Cur:"); // Serial3.print(toothCurrentCount); // Serial3.print(" Sys:"); // Serial3.print(toothSystemCount);
|
||||
// Serial3.println("");
|
||||
revolutionOne = 0;
|
||||
currentStatus.startRevolutions++; //Counter
|
||||
currentStatus.hasSync = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Serial3.println(" CAM FAIL");
|
||||
// Serial3.print(" -- CAM -- Cur:"); // Serial3.print(toothCurrentCount); // Serial3.print(" Sys:"); // Serial3.print(toothSystemCount);
|
||||
// Serial3.println(" CAM FAIL");
|
||||
currentStatus.hasSync = false;
|
||||
currentStatus.syncLossCounter++;
|
||||
revolutionOne = 0;
|
||||
|
||||
}
|
||||
toothCurrentCount= 6;
|
||||
toothSystemCount = 9;
|
||||
toothSystemCount = 2;
|
||||
}
|
||||
} //Trigger filter
|
||||
|
||||
|
|
Loading…
Reference in New Issue