fixed bug in serial printout related to TinyOS-mode

This commit is contained in:
joxe 2010-10-07 13:09:28 +00:00
parent a5aa083fa4
commit f78fd63fd7

View file

@ -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++;