mirror of https://github.com/rusefi/rusefi.git
kine: read packets as packets #5171
i need a vacation or else only:hellen-honda-k
This commit is contained in:
parent
251ff785e6
commit
4add0450e3
|
@ -6,7 +6,7 @@
|
|||
size_t readWhileGives(ByteSource source, uint8_t *buffer, int bufferSize) {
|
||||
size_t totalBytes = 0;
|
||||
while (totalBytes < bufferSize) {
|
||||
int readThisTime = source(&buffer[totalBytes], bufferSize - totalBytes);
|
||||
size_t readThisTime = source(&buffer[totalBytes], bufferSize - totalBytes);
|
||||
if (readThisTime == 0) {
|
||||
// looks like idle gap
|
||||
break;
|
||||
|
@ -36,7 +36,7 @@ void kLineThread(void*) {
|
|||
ByteSource serialSource = [] (uint8_t * buffer, int maxSize) {
|
||||
return chnReadTimeout(klDriver,buffer, maxSize, KLINE_READ_TIMEOUT);
|
||||
};
|
||||
int len = readWhileGives(serialSource, bufferIn, sizeof(serialSource));
|
||||
size_t len = readWhileGives(serialSource, bufferIn, sizeof(bufferIn));
|
||||
|
||||
// to begin with just write byte to console
|
||||
if (len > 0) {
|
||||
|
|
|
@ -24,13 +24,11 @@ static inline uint8_t crc_next(uint8_t crc, uint8_t data)
|
|||
return crc;
|
||||
}
|
||||
|
||||
static inline uint8_t crc_final(uint8_t crc)
|
||||
{
|
||||
static inline uint8_t crc_final(uint8_t crc) {
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
uint8_t crc_hondak_calc(const uint8_t *data, size_t len)
|
||||
{
|
||||
uint8_t crc_hondak_calc(const uint8_t *data, size_t len) {
|
||||
uint8_t crc = crc_init();
|
||||
|
||||
if (len) do {
|
||||
|
|
Loading…
Reference in New Issue