WIP - ready to debug

This commit is contained in:
Attila Body 2019-10-31 14:01:38 +01:00
parent 663d68baf1
commit 9670e6d397
14 changed files with 893 additions and 52 deletions

View file

@ -86,7 +86,8 @@ static inline void BuildHeader(struct usart_buffer *buffer, uint8_t serial, uint
buffer->packet.header.hash = hash;
}
static inline uint8_t CheckHeader(USARTPACKET *packet) {
static inline uint8_t CheckHeader(USARTPACKET *packet)
{
return packet->header.startByte == STARTMARKER && (packet->header.startByte ^ packet->header.serial ^ packet->header.payloadLength) == packet->header.hash;
}
@ -166,7 +167,7 @@ void RxCrcComputedCallback(void *callbackParm, uint32_t calculatedCrc, uint8_t s
struct usart_buffer *ub = (struct usart_buffer*) callbackParm;
if(!success)
ub->error = 1;
else if(*(uint32_t*) (ub->packet.payload + RoundUpTo4(ub->packet.header.payloadLength + 1)))
else if(*(uint32_t*) (ub->packet.payload + RoundUpTo4(ub->packet.header.payloadLength + 1)) == calculatedCrc)
ub->busy = 1;
else {
ub->error = ub->busy = 1;