Fix crc again, for real this time (#1948)

* re enable

* changelog

* fix

* fix test

* put some tests back
This commit is contained in:
Matthew Kennedy 2020-11-15 13:59:02 -08:00 committed by GitHub
parent 26ee7c4ec0
commit 5b0a178605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 8 deletions

View File

@ -37,6 +37,9 @@ All notable user-facing or behavior-altering changes will be documented in this
- Improved TLE8888 driver on microRusEfi
- Improved setting ECU presets/defaults from TunerStudio
### Fixed
- Improved TunerStudio protocol reliability - should see fewer CRC errors now
## October 2020 Release - "Sausage Pizza Day"
### Added

View File

@ -678,13 +678,14 @@ static void handleGetText(ts_channel_s *tsChannel) {
}
static void handleExecuteCommand(ts_channel_s *tsChannel, char *data, int incomingPacketSize) {
sr5WriteCrcPacket(tsChannel, TS_RESPONSE_COMMAND_OK, nullptr, 0);
data[incomingPacketSize] = 0;
char *trimmed = efiTrim(data);
#if EFI_SIMULATOR
logMsg("execute [%s]\r\n", trimmed);
#endif
(console_line_callback)(trimmed);
sr5WriteCrcPacket(tsChannel, TS_RESPONSE_COMMAND_OK, nullptr, 0);
}
/**

View File

@ -311,17 +311,13 @@ void sr5WriteCrcPacket(ts_channel_s *tsChannel, uint8_t responseCode, const uint
return;
}
#endif /* TS_CAN_DEVICE */
/*
if (size <= BLOCKING_FACTOR + 7) {
// small packets use small packet optimization
sr5WriteCrcPacketSmall(tsChannel, responseCode, buf, size);
} else {
*/
sr5WriteCrcPacketLarge(tsChannel, responseCode, buf, size);
/*
}
*/
sr5FlushData(tsChannel);
}

View File

@ -30,14 +30,17 @@ static void assertCrcPacket() {
TEST(binary, testWriteCrc) {
static ts_channel_s test;
// Let it pick which impl (small vs large) to use
sr5TestWriteDataIndex = 0;
sr5WriteCrcPacket(nullptr, CODE, (const uint8_t * )PAYLOAD, SIZE);
sr5WriteCrcPacket(&test, CODE, (const uint8_t * )PAYLOAD, SIZE);
assertCrcPacket();
// Force the large impl
sr5TestWriteDataIndex = 0;
sr5WriteCrcPacketLarge(nullptr, CODE, (const uint8_t * )PAYLOAD, SIZE);
sr5WriteCrcPacketLarge(&test, CODE, (const uint8_t * )PAYLOAD, SIZE);
assertCrcPacket();
// Force the small impl
sr5TestWriteDataIndex = 0;
sr5WriteCrcPacketSmall(&test, CODE, (const uint8_t * )PAYLOAD, SIZE);
assertCrcPacket();