Moved comment and block delete handling into protocol.c from gcode.c. Fixes bug when comment and block delete are not isolated. Blank lines ignored.

Comments, block delete characters, and blank lines are no longer passed
to the gcode parser and should free up some memory by ignoring these
characters. Gcode parser now expects clean gcode only. There was a bug
if there were block deletes or comments not in the first character (i.e.
spindle on/off for proofing geode without turning it on, or a NXX
followed by a comment). This should fix it by bypassing the problem.
Left a commented line for easily turning on and off block deletes for a
later feature, if desired.
This commit is contained in:
Sonny J
2011-08-15 19:28:14 -06:00
parent 971e50aa9a
commit 896a6b9199
2 changed files with 37 additions and 16 deletions

View File

@@ -117,7 +117,8 @@ static double theta(double x, double y)
#endif
// Executes one line of 0-terminated G-Code. The line is assumed to contain only uppercase
// characters and signed floating point values (no whitespace).
// characters and signed floating point values (no whitespace). Comments and block delete
// characters have been removed.
uint8_t gc_execute_line(char *line) {
uint8_t char_counter = 0;
char letter;
@@ -139,10 +140,6 @@ uint8_t gc_execute_line(char *line) {
gc.status_code = STATUS_OK;
// Disregard comments and block delete
if (line[0] == '(') { return(gc.status_code); }
if (line[0] == '/') { char_counter++; } // ignore block delete
// Pass 1: Commands
while(next_statement(&letter, &value, line, &char_counter)) {
int_value = trunc(value);