protocol: support \r\n from serial output

master
S.J.R. van Schaik 7 years ago
parent 6e6f61d04b
commit 6e5bf54598
  1. 8
      protocol/tbm.go

@ -75,7 +75,9 @@ func deserialise(in io.Reader, init []byte) (*Result, []byte, error) {
for i := 0; i < n2; i++ {
// '\r' is really '\n'
if data[i] == '\r' {
data[i] = '\n'
data = append(data[:i], data[i+1:]...)
n2--
continue
}
if data[i] == 0x4 {
@ -83,15 +85,13 @@ func deserialise(in io.Reader, init []byte) (*Result, []byte, error) {
want_output = false
output = data[:i]
data = data[i+1:]
/*
// The TBM gives us our own commands back
for j := 0; j < len(output); j++ {
if output[j] == '\r' {
if output[j] == '\n' {
output = output[j+1:]
break
}
}
*/
break
} else {
errorcode = data[:i]

Loading…
Cancel
Save