From 08baecee8a05edf44bdbb26294a180c6487473b3 Mon Sep 17 00:00:00 2001 From: Piotr Wilkon Date: Mon, 4 Sep 2023 11:32:41 +0200 Subject: [PATCH] tnc2 converter bug fix --- CHANGELOG.md | 1 + Src/common.c | 11 ++++++++--- Src/kiss.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b01bc09..7ef9c5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * none ## Bug fixes * RX buffer pointers bug fix +* AX.25 to TNC2 converter bug with non-UI frames ## Other * New KISS handling method to support long and multiple frames ## Known bugs diff --git a/Src/common.c b/Src/common.c index f350127..0849224 100644 --- a/Src/common.c +++ b/Src/common.c @@ -146,11 +146,16 @@ static void sendTNC2ToUart(Uart *uart, uint8_t *from, uint16_t len) } - UartSendByte(uart, ':'); //separator + UartSendByte(uart, ':'); //separator - nextPathEl += 2; //skip Control and PID + if((from[nextPathEl] & 0b11101111) == 0b00000011) //check if UI packet + { + nextPathEl += 2; //skip Control and PID - UartSendString(uart, &(from[nextPathEl]), len - nextPathEl); //send information field + UartSendString(uart, &(from[nextPathEl]), len - nextPathEl); //send information field + } + else + UartSendString(uart, "", 0); UartSendByte(uart, 0); //terminate with NULL } diff --git a/Src/kiss.c b/Src/kiss.c index 95d5967..18955c6 100644 --- a/Src/kiss.c +++ b/Src/kiss.c @@ -51,7 +51,7 @@ void KissParse(Uart *port, uint8_t data) { if(data == 0xC0) //frame end marker { - if(port->kissBufferHead < 17) //command+source+destination+PID+Control=17 + if(port->kissBufferHead < 16) //command+source+destination+Control=16 { port->kissBufferHead = 0; return;