Browse Source

Add G-code "backspace" support

Scott Lahteine 4 years ago
parent
commit
ca5a8ea827
1 changed files with 9 additions and 3 deletions
  1. 9
    3
      Marlin/src/gcode/queue.cpp

+ 9
- 3
Marlin/src/gcode/queue.cpp View File

@@ -387,9 +387,15 @@ inline void process_stream_char(const char c, uint8_t &sis, char (&buff)[MAX_CMD
387 387
     }
388 388
   #endif
389 389
 
390
-  buff[ind++] = c;
391
-  if (ind >= MAX_CMD_SIZE - 1)
392
-    sis = PS_EOL;               // Skip the rest on overflow
390
+  // Backspace erases previous characters
391
+  if (c == 0x08) {
392
+    if (ind) buff[--ind] = '\0';
393
+  }
394
+  else {
395
+    buff[ind++] = c;
396
+    if (ind >= MAX_CMD_SIZE - 1)
397
+      sis = PS_EOL;             // Skip the rest on overflow
398
+  }
393 399
 }
394 400
 
395 401
 /**

Loading…
Cancel
Save