From 9a17376884c56d4f84e48ffac9b40d88de5bb23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nidecki?= Date: Fri, 26 Feb 2021 11:49:11 +0100 Subject: [PATCH] Fix in parsing digipited, ssid-less addresses --- lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp b/lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp index 82e8c65..b429a81 100644 --- a/lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp +++ b/lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp @@ -135,10 +135,16 @@ String decode_kiss(const String& kissFormattedFrame) { * @return */ String encode_address_ax25(String tnc2Address) { + bool hasBeenDigipited = tnc2Address.indexOf('*') != -1; + if (tnc2Address.indexOf('-') == -1){ + if (hasBeenDigipited){ + // ex. TCPIP* in tnc2Address + // so we skip last char + tnc2Address = tnc2Address.substring(0, tnc2Address.length()-1); + } tnc2Address += "-0"; } - bool hasBeenDigipited = tnc2Address.indexOf('*') != -1; int separatorIndex = tnc2Address.indexOf('-'); int ssid = tnc2Address.substring(separatorIndex + 1).toInt();