Skip to content

Commit

Permalink
Manually parse the code word
Browse files Browse the repository at this point in the history
  • Loading branch information
p3p committed Oct 29, 2018
1 parent b2bb007 commit 2e726df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void GCodeParser::parse(char *p) {
#endif

// Only use string_arg for these M codes
if (letter == 'M') switch (codenum) { case 23: case 30: case 117: case 118: case 928: string_arg = p; return; default: break; }
if (letter == 'M') switch (codenum) { case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return; default: break; }

#if ENABLED(DEBUG_GCODE_PARSER)
const bool debug = codenum == 800;
Expand Down
16 changes: 12 additions & 4 deletions Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,25 @@ void GcodeSuite::M28() {
#endif
;

bool binary_mode = false;
char *p = parser.string_arg;
if (p[0] == 'B' && p[1] == '0') {
binary_mode = true;
p += 2;
while (*p == ' ') ++p;
}

// Binary transfer mode
if (parser.byteval('B')) {
if (binary_mode) {
SERIAL_ECHO_START_P(port);
SERIAL_ECHO_P(port, " preparing to receive: ");
SERIAL_ECHOLN_P(port, parser.string_arg);
card.openFile(parser.string_arg, false);
SERIAL_ECHOLN_P(port, p);
card.openFile(p, false);
card.transfer_mode = 1;
card.transfer_port = port;
}
else
card.openFile(parser.string_arg, false);
card.openFile(p, false);
}

/**
Expand Down

0 comments on commit 2e726df

Please sign in to comment.