Improvements to the high speed loggers. Fixes #285
This commit is contained in:
parent
316982ffcd
commit
8cb7876406
|
@ -3546,10 +3546,12 @@ cmdtestspk450dc = "E\x03\x0C"
|
|||
;dataReadCommand = "r\\x00\\xf4\\x00\\x00\\x04\\x00" ; standard TS command format
|
||||
startCommand = "H"
|
||||
stopCommand = "h"
|
||||
dataReadCommand = "T" ; Basic TS command format
|
||||
;dataReadCommand = "T" ; Basic TS command format
|
||||
dataReadCommand = "T\$tsCanId\x01\xFC\x00\x01\xFC" ; Basic TS command format. Note that this is shared with the composite logger. Firmware detects which log is currently running
|
||||
dataReadTimeout = 5000 ; time in ms
|
||||
continuousRead = true
|
||||
dataReadyCondition = { toothLog1Ready == 1 }
|
||||
;dataLength = 256 ; in bytes, including headers, footers and data (not used)
|
||||
dataLength = 508; in bytes, including headers, footers and data (not used). 4 bytes * 127 entries
|
||||
;dataLength = 128 ; in bytes, including headers, footers and data (not used)
|
||||
|
||||
;recordDef = headerLen. footerLen, recordLen
|
||||
|
@ -3561,10 +3563,12 @@ cmdtestspk450dc = "E\x03\x0C"
|
|||
loggerDef = compositeLogger, "Composite Logger", composite
|
||||
startCommand = "J"
|
||||
stopCommand = "j"
|
||||
dataReadCommand = "T" ; Basic TS command format. Note that this is shared with the composite logger. Firmware detects which log is currently running
|
||||
dataReadTimeout = 5000 ; time in ms
|
||||
;dataReadCommand = "T" ; Basic TS command format. Note that this is shared with the composite logger. Firmware detects which log is currently running
|
||||
dataReadCommand = "T\$tsCanId\x00\x00\x00\x02\x7B" ; Basic TS command format. Note that this is shared with the composite logger. Firmware detects which log is currently running
|
||||
dataReadTimeout = 50000 ; time in ms
|
||||
dataReadyCondition = { toothLog1Ready == 1 }
|
||||
;dataLength = 256 ; in bytes, including headers, footers and data (not used)
|
||||
continuousRead = true
|
||||
dataLength = 635 ; in bytes, including headers, footers and data (not used). 5 bytes * 127 fields
|
||||
;dataLength = 320 ; in bytes, including headers, footers and data (not used)
|
||||
|
||||
;recordDef = headerLen. footerLen, recordLen
|
||||
|
|
|
@ -108,6 +108,7 @@ void command()
|
|||
case 'H': //Start the tooth logger
|
||||
currentStatus.toothLogEnabled = true;
|
||||
currentStatus.compositeLogEnabled = false; //Safety first (Should never be required)
|
||||
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY);
|
||||
toothHistoryIndex = 0;
|
||||
toothHistorySerialIndex = 0;
|
||||
|
||||
|
@ -135,6 +136,7 @@ void command()
|
|||
case 'J': //Start the composite logger
|
||||
currentStatus.compositeLogEnabled = true;
|
||||
currentStatus.toothLogEnabled = false; //Safety first (Should never be required)
|
||||
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY);
|
||||
toothHistoryIndex = 0;
|
||||
toothHistorySerialIndex = 0;
|
||||
compositeLastToothTime = 0;
|
||||
|
@ -273,8 +275,27 @@ void command()
|
|||
break;
|
||||
|
||||
case 'T': //Send 256 tooth log entries to Tuner Studios tooth logger
|
||||
if(currentStatus.toothLogEnabled == true) { sendToothLog(); } //Sends tooth log values as ints
|
||||
else if (currentStatus.compositeLogEnabled == true) { sendCompositeLog(); }
|
||||
//6 bytes required:
|
||||
//2 - Page identifier
|
||||
//2 - offset
|
||||
//2 - Length
|
||||
cmdPending = true;
|
||||
if(Serial.available() >= 6)
|
||||
{
|
||||
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
|
||||
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
|
||||
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
|
||||
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
|
||||
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
|
||||
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
|
||||
|
||||
if(currentStatus.toothLogEnabled == true) { sendToothLog(); } //Sends tooth log values as ints
|
||||
else if (currentStatus.compositeLogEnabled == true) { sendCompositeLog(); }
|
||||
|
||||
cmdPending = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1740,7 +1761,15 @@ void sendToothLog()
|
|||
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY);
|
||||
cmdPending = false;
|
||||
}
|
||||
else { cmdPending = true; } //Mark this request as being incomplete.
|
||||
else
|
||||
{
|
||||
//TunerStudio has timed out, send a LOG of all 0s
|
||||
for(int x = 0; x < (4*TOOTH_LOG_SIZE); x++)
|
||||
{
|
||||
Serial.write(0);
|
||||
}
|
||||
cmdPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
void sendCompositeLog()
|
||||
|
@ -1768,6 +1797,9 @@ void sendCompositeLog()
|
|||
else { toothHistorySerialIndex++; }
|
||||
}
|
||||
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY);
|
||||
toothHistoryIndex = 0;
|
||||
toothHistorySerialIndex = 0;
|
||||
compositeLastToothTime = 0;
|
||||
cmdPending = false;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -33,6 +33,7 @@ toothLastToothTime - The time (In uS) that the last primary tooth was 'seen'
|
|||
*/
|
||||
static inline void addToothLogEntry(unsigned long toothTime, bool whichTooth)
|
||||
{
|
||||
if(BIT_CHECK(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY)) { return; }
|
||||
//High speed tooth logging history
|
||||
if( (currentStatus.toothLogEnabled == true) || (currentStatus.compositeLogEnabled == true) )
|
||||
{
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
#define VALID_MAP_MAX 1022 //The largest ADC value that is valid for the MAP sensor
|
||||
#define VALID_MAP_MIN 2 //The smallest ADC value that is valid for the MAP sensor
|
||||
|
||||
#define TOOTH_LOG_SIZE 64
|
||||
#define TOOTH_LOG_SIZE 127
|
||||
#define TOOTH_LOG_BUFFER 128 //256
|
||||
|
||||
#define COMPOSITE_LOG_PRI 0
|
||||
|
|
|
@ -124,7 +124,8 @@ void loop()
|
|||
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_ASE); //Same as above except for ASE status
|
||||
//This is a safety check. If for some reason the interrupts have got screwed up (Leading to 0rpm), this resets them.
|
||||
//It can possibly be run much less frequently.
|
||||
initialiseTriggers();
|
||||
//This should only be run if the high speed logger are off because it will change the trigger interrupts back to defaults rather than the logger versions
|
||||
if( (currentStatus.toothLogEnabled == false) && (currentStatus.compositeLogEnabled == false) ) { initialiseTriggers(); }
|
||||
|
||||
VVT_PIN_LOW();
|
||||
DISABLE_VVT_TIMER();
|
||||
|
|
Loading…
Reference in New Issue