Skip to content

Commit

Permalink
Add M118 Gcode support
Browse files Browse the repository at this point in the history
  • Loading branch information
RoboMagus authored Jan 24, 2023
1 parent 7b163cf commit 1415c12
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3936,6 +3936,7 @@ extern uint8_t st_backlash_y;
//!@n M114 - Output current position to serial port
//!@n M115 - Capabilities string
//!@n M117 - display message
//!@n M118 - Serial print
//!@n M119 - Output Endstop status to serial port
//!@n M123 - Tachometer value
//!@n M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
Expand Down Expand Up @@ -6512,6 +6513,31 @@ SERIAL_PROTOCOLPGM("\n\n");
}
break;

/*!
### M118 - Serial print <a href="https://reprap.org/wiki/G-code#M118:_Echo_message_on_host">M118: Serial print</a>
*/
case 118: {
bool hasE, hasA = false;
char *p = strchr_pointer;

for (uint8_t i = 2; i--;) {
// A1, E1, and Pn are always parsed out
if (!((p[0] == 'A' || p[0] == 'E') && p[1] == '1')) break;
switch (p[0]) {
case 'A': hasA = true; break;
case 'E': hasE = true; break;
}
p += 2;
while (*p == ' ') ++p;
}

if (hasE) SERIAL_ECHO_START;
if (hasA) SERIAL_ECHO("//");

SERIAL_ECHOLN(strchr_pointer + strchr_pos);
}
break;

#ifdef M120_M121_ENABLED
/*!
### M120 - Enable endstops <a href="https://reprap.org/wiki/G-code#M120:_Enable_endstop_detection">M120: Enable endstop detection</a>
Expand Down

0 comments on commit 1415c12

Please sign in to comment.