mtu kiss: adjusted checks to include header and crc
@@ -99,7 +99,7 @@ void csp_kiss_rx(csp_iface_t * interface, uint8_t * buf, int len, void * pxTaskW
unsigned char inputbyte = *buf++;
/* If packet was too long */
- if (driver->rx_length > interface->mtu) {
+ if (driver->rx_length > interface->mtu + 8) {
csp_log_warn("KISS RX overflow");
interface->rx_error++;
driver->rx_mode = KISS_MODE_NOT_STARTED;
@@ -120,9 +120,9 @@ void csp_kiss_rx(csp_iface_t * interface, uint8_t * buf, int len, void * pxTaskW
/* Try to allocate new buffer */
if (driver->rx_packet == NULL) {
if (pxTaskWoken == NULL) {
- driver->rx_packet = csp_buffer_get(interface->mtu);
+ driver->rx_packet = csp_buffer_get(interface->mtu + 4);
} else {
- driver->rx_packet = csp_buffer_get_isr(interface->mtu);
+ driver->rx_packet = csp_buffer_get_isr(interface->mtu + 4);
}
}
