Bayley Wang
/
foc-ed_in_the_bot_compact
robot
Diff: callbacks.cpp
- Revision:
- 212:1e370ffcb73d
- Parent:
- 191:66861311bdcd
- Child:
- 214:c70a6e86417f
diff -r 3193c31cb1b7 -r 1e370ffcb73d callbacks.cpp --- a/callbacks.cpp Sat Apr 28 21:33:05 2018 +0000 +++ b/callbacks.cpp Sun Apr 29 03:16:14 2018 +0000 @@ -11,14 +11,15 @@ void rxCallback() { while (io.pc->readable()) { char c = io.pc->getc(); - if (c != 127 && c != '\r' && c != '\t') { + if (c != 127 && c != 8 && c != '\r' && c != '\t') { linebuf[index] = c; index++; io.pc->putc(c); - } else if (c == 127) { + } else if (c == 127 || c == 8) { if (index > 0) { index--; - io.pc->putc(c); + //BS (8) should delete previous char + io.pc->putc(127); } } else if (c == '\r') { linebuf[index] = 0;