Add sync loss counter to log (And apply to other patterns)

This commit is contained in:
Josh Stewart 2018-07-24 10:44:47 +10:00
parent b5a8ef2221
commit 2287c9086c
5 changed files with 31 additions and 12 deletions

View File

@ -2432,7 +2432,7 @@ cmdtestspk450dc = "E\x03\x0C"
; you change it.
ochGetCommand = "r\$tsCanId\x30%2o%2c"
ochBlockSize = 89
ochBlockSize = 90
secl = scalar, U08, 0, "sec", 1.000, 0.000
status1 = scalar, U08, 1, "bits", 1.000, 0.000
@ -2524,12 +2524,13 @@ cmdtestspk450dc = "E\x03\x0C"
nitrousOn = bits, U08, 81, [1:1]
unused81_2-4 = bits, U08, 81, [2:4]
nSquirts = bits, U08, 81, [5:7]
flexBoostCor = scalar, S16, 82, "kPa", 1.000, 0.000
nChannels = scalar, U08, 84, "bits", 1.000, 0.000
flexBoostCor = scalar, S16, 82, "kPa", 1.000, 0.000
nChannels = scalar, U08, 84, "bits", 1.000, 0.000
nIgnChannels = bits, U08, 84, [0:3]
nFuelChannels = bits, U08, 84, [4:7]
fuelLoad = scalar, S16, 85, { bitStringValue( algorithmUnits , algorithm ) }, 1.000, 0.000
ignLoad = scalar, S16, 87, { bitStringValue( algorithmUnits , ignAlgorithm ) }, 1.000, 0.000
fuelLoad = scalar, S16, 85, { bitStringValue( algorithmUnits , algorithm ) }, 1.000, 0.000
ignLoad = scalar, S16, 87, { bitStringValue( algorithmUnits , ignAlgorithm ) }, 1.000, 0.000
syncLossCounter = scalar, U08, 89, "", 1.000, 0.000
#if CELSIUS
@ -2631,6 +2632,7 @@ cmdtestspk450dc = "E\x03\x0C"
entry = idleLoad, "IAC value", int, "%d"
entry = baro, "Baro Pressure",int, "%d"
entry = nitrousOn, "Nitrous On", int, "%d", { n2o_enable > 0 }
entry = syncLossCounter, "Sync Loss #", int, "%d"
#if CAN_COMMANDS
entry = canin_gauge0, "CanIn CH0", int, "%d"

View File

@ -12,7 +12,7 @@
#define canbusPage 9//Config Page 9
#define warmupPage 10 //Config Page 10
#define SERIAL_PACKET_SIZE 89 //Must match ochBlockSize in ini file
#define SERIAL_PACKET_SIZE 90 //Must match ochBlockSize in ini file
byte currentPage = 1;//Not the same as the speeduino config page numbers
bool isMap = true;

View File

@ -503,6 +503,7 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum)
fullStatus[86] = highByte(currentStatus.fuelLoad);
fullStatus[87] = lowByte(currentStatus.ignLoad);
fullStatus[88] = highByte(currentStatus.ignLoad);
fullStatus[89] = currentStatus.syncLossCounter;
for(byte x=0; x<packetLength; x++)
{

View File

@ -164,7 +164,12 @@ void triggerPri_missingTooth()
if ( (curGap > targetGap) || (toothCurrentCount > triggerActualTeeth) )
{
if(toothCurrentCount < (triggerActualTeeth) && (currentStatus.hasSync == true) ) { currentStatus.hasSync = false; } //This occurs when we're at tooth #1, but haven't seen all the other teeth. This indicates a signal issue so we flag lost sync so this will attempt to resync on the next revolution.
if(toothCurrentCount < (triggerActualTeeth) && (currentStatus.hasSync == true) )
{
//This occurs when we're at tooth #1, but haven't seen all the other teeth. This indicates a signal issue so we flag lost sync so this will attempt to resync on the next revolution.
currentStatus.hasSync = false;
currentStatus.syncLossCounter++;
}
//This is to handle a special case on startup where sync can be obtained and the system immediately thinks the revs have jumped:
//else if (currentStatus.hasSync == false && toothCurrentCount < checkSyncToothCount ) { triggerFilterTime = 0; }
else
@ -384,7 +389,11 @@ void triggerSec_DualWheel()
currentStatus.hasSync = true;
}
else if (configPage4.useResync == 1) { toothCurrentCount = configPage4.triggerTeeth; }
else
{
if (toothCurrentCount != configPage4.triggerTeeth) { currentStatus.syncLossCounter++; } //Indicates likely sync loss
if (configPage4.useResync == 1) { toothCurrentCount = configPage4.triggerTeeth; }
}
revolutionOne = 1; //Sequential revolution reset
} //Trigger filter
@ -997,7 +1006,12 @@ void triggerSec_4G63()
if( (currentStatus.RPM < currentStatus.crankRPM) || 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
if(toothCurrentCount != 4)
{
// This should never be true, except when there's noise
currentStatus.hasSync = false;
currentStatus.syncLossCounter++;
}
else { toothCurrentCount = 4; } //Why? Just why?
}
else { toothCurrentCount = 4; } //If the crank trigger is currently HIGH, it means we're on tooth #1
@ -2051,7 +2065,7 @@ void triggerSec_Nissan360()
toothCurrentCount = 274; //End of fourth window is after 90+90+90+4 primary teeth
currentStatus.hasSync = true;
}
else { currentStatus.hasSync = false; } //This should really never happen
else { currentStatus.hasSync = false; currentStatus.syncLossCounter++; } //This should really never happen
}
else if(configPage2.nCylinders == 6)
{
@ -2231,6 +2245,7 @@ void triggerPri_Subaru67()
default:
//Almost certainly due to noise or cranking stop/start
currentStatus.hasSync = false;
currentStatus.syncLossCounter++;
secondaryToothCount = 0;
break;
@ -2534,6 +2549,7 @@ void triggerPri_Harley()
}
else
{
if (currentStatus.hasSync == true) { currentStatus.syncLossCounter++; }
currentStatus.hasSync = false;
toothCurrentCount = 0;
} //Primary trigger high

View File

@ -323,6 +323,7 @@ void setup()
currentStatus.runSecs = 0;
currentStatus.secl = 0;
currentStatus.startRevolutions = 0;
currentStatus.syncLossCounter = 0;
currentStatus.flatShiftingHard = false;
currentStatus.launchingHard = false;
currentStatus.crankRPM = ((unsigned int)configPage4.crankRPM * 10); //Crank RPM limit (Saves us calculating this over and over again. It's updated once per second in timers.ino)
@ -934,8 +935,7 @@ void loop()
{
//HardCut rev limit for 2-step launch control.
currentStatus.launchingHard = true;
BIT_SET(currentStatus.spark,
BIT_SPARK_HLAUNCH);
BIT_SET(currentStatus.spark, BIT_SPARK_HLAUNCH);
}
else { currentStatus.launchingHard = false; BIT_CLEAR(currentStatus.spark, BIT_SPARK_HLAUNCH); }