Allow send of partial tooth and composite logs at low rpm/resolution

This commit is contained in:
Josh Stewart 2023-04-26 16:35:39 +10:00
parent d1399a0f33
commit 9ff33f0384
2 changed files with 92 additions and 87 deletions

View File

@ -5492,7 +5492,7 @@ cmdVSSratio6 = "E\x99\x06"
stopCommand = "j"
;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
dataReadTimeout = 5000 ; time in ms
dataReadyCondition = { toothLog1Ready == 1 }
continuousRead = true
dataLength = 127 ; Number of records to show on a single screen. Should match TOOTH_LOG_SIZE in the code

View File

@ -466,7 +466,7 @@ void serialReceive(void)
legacySerialCommand();
return;
}
else if( ((highByte >= 'A') && (highByte <= 'z')) || (highByte == '?') && (BIT_CHECK(currentStatus.status4, BIT_STATUS4_ALLOW_LEGACY_COMMS)) )
else if( (((highByte >= 'A') && (highByte <= 'z')) || (highByte == '?')) && (BIT_CHECK(currentStatus.status4, BIT_STATUS4_ALLOW_LEGACY_COMMS)) )
{
//Handle legacy cases here
legacySerialCommand();
@ -1027,8 +1027,16 @@ void processSerialCommand(void)
void sendToothLog(void)
{
//We need TOOTH_LOG_SIZE number of records to send to TunerStudio. If there aren't that many in the buffer then we just return and wait for the next call
if (BIT_CHECK(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY)) //Sanity check. Flagging system means this should always be true
if (BIT_CHECK(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY) == false) //Sanity check. Flagging system means this should always be true
{
//If the buffer is not yet full but TS has timed out, pad the rest of the buffer with 0s
while(toothHistoryIndex < TOOTH_LOG_SIZE)
{
toothHistory[toothHistoryIndex] = 0;
toothHistoryIndex++;
}
}
uint32_t CRC32_val = 0;
if(logItemsTransmitted == 0)
{
@ -1067,17 +1075,20 @@ void sendToothLog(void)
//Send the CRC
(void)serialWrite(CRC32_val);
}
else
{
sendReturnCodeMsg(SERIAL_RC_BUSY_ERR);
serialStatusFlag = SERIAL_INACTIVE;
}
}
void sendCompositeLog(void)
{
if ( (BIT_CHECK(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY)) || (serialStatusFlag == SERIAL_TRANSMIT_COMPOSITE_INPROGRESS) ) //Sanity check. Flagging system means this should always be true
if ( BIT_CHECK(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY) == false ) //Sanity check. Flagging system means this should always be true
{
//If the buffer is not yet full but TS has timed out, pad the rest of the buffer with 0s
while(toothHistoryIndex < TOOTH_LOG_SIZE)
{
toothHistory[toothHistoryIndex] = toothHistory[toothHistoryIndex-1]; //Composite logger needs a realistic time value to display correctly. Copy the last value
compositeLogHistory[toothHistoryIndex] = 0;
toothHistoryIndex++;
}
}
uint32_t CRC32_val = 0;
if(logItemsTransmitted == 0)
{
@ -1120,12 +1131,6 @@ void sendCompositeLog(void)
//Send the CRC
(void)serialWrite(CRC32_val);
}
else
{
sendReturnCodeMsg(SERIAL_RC_BUSY_ERR);
serialStatusFlag = SERIAL_INACTIVE;
}
}
#if defined(CORE_AVR)
#pragma GCC pop_options