logging of live data structs was: data points #3614
YES! we now expose fragments
This commit is contained in:
parent
b718d059ac
commit
f0a055345e
|
@ -49,7 +49,15 @@ void TunerStudio::cmdOutputChannels(TsChannelBase* tsChannel, uint16_t offset, u
|
|||
updateTunerStudioState();
|
||||
tsChannel->assertPacketSize(count, false);
|
||||
// this method is invoked too often to print any debug information
|
||||
tsChannel->writeCrcPacketSmall(TS_RESPONSE_OK, reinterpret_cast<const uint8_t*>(&engine->outputChannels) + offset, count);
|
||||
uint8_t * scratchBuffer = (uint8_t *)tsChannel->scratchBuffer;
|
||||
/**
|
||||
* collect data from all models
|
||||
*/
|
||||
copyRange(scratchBuffer + 3,
|
||||
getFragments(), getFragmentsCount(),
|
||||
offset, count);
|
||||
|
||||
tsChannel->crcAndWriteBuffer(TS_RESPONSE_OK, count);
|
||||
}
|
||||
|
||||
#endif // EFI_TUNER_STUDIO
|
||||
|
|
|
@ -19,11 +19,11 @@ size_t TsChannelBase::read(uint8_t* buffer, size_t size) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void TsChannelBase::writeCrcPacketSmall(uint8_t responseCode, const uint8_t* buf, size_t size) {
|
||||
void TsChannelBase::copyAndWriteSmallCrcPacket(uint8_t responseCode, const uint8_t* buf, size_t size) {
|
||||
auto scratchBuffer = this->scratchBuffer;
|
||||
|
||||
// don't transmit too large a buffer
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, size <= BLOCKING_FACTOR + 7, "writeCrcPacketSmall tried to transmit too large a packet")
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, size <= BLOCKING_FACTOR + 7, "copyAndWriteSmallCrcPacket tried to transmit too large a packet")
|
||||
|
||||
// If transmitting data, copy it in to place in the scratch buffer
|
||||
// We want to prevent the data changing itself (higher priority threads could write
|
||||
|
@ -33,6 +33,11 @@ void TsChannelBase::writeCrcPacketSmall(uint8_t responseCode, const uint8_t* buf
|
|||
memcpy(scratchBuffer + 3, buf, size);
|
||||
}
|
||||
|
||||
crcAndWriteBuffer(responseCode, size);
|
||||
}
|
||||
|
||||
void TsChannelBase::crcAndWriteBuffer(uint8_t responseCode, size_t size) {
|
||||
auto scratchBuffer = this->scratchBuffer;
|
||||
// Index 0/1 = packet size (big endian)
|
||||
*(uint16_t*)scratchBuffer = SWAP_UINT16(size + 1);
|
||||
// Index 2 = response code
|
||||
|
@ -103,7 +108,7 @@ void TsChannelBase::writeCrcPacket(uint8_t responseCode, const uint8_t* buf, siz
|
|||
writeCrcPacketLarge(responseCode, buf, size);
|
||||
} else {
|
||||
// for small packets we use a buffer for CRC calculation
|
||||
writeCrcPacketSmall(responseCode, buf, size);
|
||||
copyAndWriteSmallCrcPacket(responseCode, buf, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,8 @@ public:
|
|||
const char *name;
|
||||
|
||||
void assertPacketSize(size_t size, bool allowLongPackets);
|
||||
void writeCrcPacketSmall(uint8_t responseCode, const uint8_t* buf, size_t size);
|
||||
void crcAndWriteBuffer(uint8_t responseCode, size_t size);
|
||||
void copyAndWriteSmallCrcPacket(uint8_t responseCode, const uint8_t* buf, size_t size);
|
||||
|
||||
private:
|
||||
void writeCrcPacketLarge(uint8_t responseCode, const uint8_t* buf, size_t size);
|
||||
|
|
Loading…
Reference in New Issue