From f78fd63fd74c25be6da5dce21232dfccfa2c693f Mon Sep 17 00:00:00 2001 From: joxe Date: Thu, 7 Oct 2010 13:09:28 +0000 Subject: [PATCH] fixed bug in serial printout related to TinyOS-mode --- tools/cooja/java/se/sics/cooja/dialogs/SerialUI.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/dialogs/SerialUI.java b/tools/cooja/java/se/sics/cooja/dialogs/SerialUI.java index 460410584..e6d7143f3 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/SerialUI.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/SerialUI.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: SerialUI.java,v 1.6 2010/06/11 14:12:09 fros4943 Exp $ + * $Id: SerialUI.java,v 1.7 2010/10/07 13:09:28 joxe Exp $ */ package se.sics.cooja.dialogs; @@ -280,7 +280,6 @@ public abstract class SerialUI extends Log implements SerialPort { private int tosChars = 0; boolean tosMode = false; - private int[] tosData = new int[255]; private int tosPos = 0; private int tosLen = 0; @@ -292,6 +291,7 @@ public abstract class SerialUI extends Log implements SerialPort { slipCounter++; } if (tosMode) { + int tmpData = data; /* needs to add checks to CRC */ // System.out.println("Received: " + Integer.toString(data, 16) + " = " + (char) data + " tosPos: " + tosPos); if (data == 0x7e) { @@ -315,11 +315,10 @@ public abstract class SerialUI extends Log implements SerialPort { } if (tosPos > 9 && tosPos < 10 + tosLen) { if (data < 32) { - data = 32; + tmpData = 32; } - newMessage.append((char) data); + newMessage.append((char) tmpData); } - tosData[tosPos++] = data; } else { if (data == 0x7e) { tosChars++;