mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-03-22 22:26:18 +00:00
📝 GCode => G-Code
This commit is contained in:
parent
5bd39ba73f
commit
4744997c16
11 changed files with 21 additions and 21 deletions
|
@ -75,7 +75,7 @@ static __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb, usart
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not every MarlinSerial port should handle emergency parsing.
|
// Not every MarlinSerial port should handle emergency parsing.
|
||||||
// It would not make sense to parse GCode from TMC responses, for example.
|
// It would not make sense to parse G-Code from TMC responses, for example.
|
||||||
constexpr bool serial_handles_emergency(int port) {
|
constexpr bool serial_handles_emergency(int port) {
|
||||||
return (false
|
return (false
|
||||||
#ifdef SERIAL_PORT
|
#ifdef SERIAL_PORT
|
||||||
|
|
|
@ -536,7 +536,7 @@ void GcodeSuite::G28() {
|
||||||
/**
|
/**
|
||||||
* Preserve DXC mode across a G28 for IDEX printers in DXC_DUPLICATION_MODE.
|
* Preserve DXC mode across a G28 for IDEX printers in DXC_DUPLICATION_MODE.
|
||||||
* This is important because it lets a user use the LCD Panel to set an IDEX Duplication mode, and
|
* This is important because it lets a user use the LCD Panel to set an IDEX Duplication mode, and
|
||||||
* then print a standard GCode file that contains a single print that does a G28 and has no other
|
* then print a standard G-Code file that contains a single print that does a G28 and has no other
|
||||||
* IDEX specific commands in it.
|
* IDEX specific commands in it.
|
||||||
*/
|
*/
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
|
|
|
@ -44,7 +44,7 @@ void protected_pin_err() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M42: Change pin status via GCode
|
* M42: Change pin status via G-Code
|
||||||
*
|
*
|
||||||
* P<pin> Pin number (LED if omitted)
|
* P<pin> Pin number (LED if omitted)
|
||||||
* For LPC1768 specify pin P1_02 as M42 P102,
|
* For LPC1768 specify pin P1_02 as M42 P102,
|
||||||
|
|
|
@ -76,7 +76,7 @@ void GcodeSuite::M164() {
|
||||||
* I[factor] Mix factor for extruder stepper 6
|
* I[factor] Mix factor for extruder stepper 6
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M165() {
|
void GcodeSuite::M165() {
|
||||||
// Get mixing parameters from the GCode
|
// Get mixing parameters from the G-Code
|
||||||
// The total "must" be 1.0 (but it will be normalized)
|
// The total "must" be 1.0 (but it will be normalized)
|
||||||
// If no mix factors are given, the old mix is preserved
|
// If no mix factors are given, the old mix is preserved
|
||||||
const char mixing_codes[] = { LIST_N(MIXING_STEPPERS, 'A', 'B', 'C', 'D', 'H', 'I') };
|
const char mixing_codes[] = { LIST_N(MIXING_STEPPERS, 'A', 'B', 'C', 'D', 'H', 'I') };
|
||||||
|
|
|
@ -153,7 +153,7 @@ int8_t GcodeSuite::get_target_e_stepper_from_command(const int8_t dval/*=-1*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set XYZ...E destination and feedrate from the current GCode command
|
* Set XYZ...E destination and feedrate from the current G-Code command
|
||||||
*
|
*
|
||||||
* - Set destination from included axis codes
|
* - Set destination from included axis codes
|
||||||
* - Set to current for missing axis codes
|
* - Set to current for missing axis codes
|
||||||
|
@ -459,7 +459,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||||
case 800: parser.debug(); break; // G800: GCode Parser Test for G
|
case 800: parser.debug(); break; // G800: G-Code Parser Test for G
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default: parser.unknown_command_warning(); break;
|
default: parser.unknown_command_warning(); break;
|
||||||
|
@ -1035,7 +1035,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||||
case 800: parser.debug(); break; // M800: GCode Parser Test for M
|
case 800: parser.debug(); break; // M800: G-Code Parser Test for M
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(GCODE_REPEAT_MARKERS)
|
#if ENABLED(GCODE_REPEAT_MARKERS)
|
||||||
|
|
|
@ -462,7 +462,7 @@ public:
|
||||||
*/
|
*/
|
||||||
enum MarlinBusyState : char {
|
enum MarlinBusyState : char {
|
||||||
NOT_BUSY, // Not in a handler
|
NOT_BUSY, // Not in a handler
|
||||||
IN_HANDLER, // Processing a GCode
|
IN_HANDLER, // Processing a G-Code
|
||||||
IN_PROCESS, // Known to be blocking command input (as in G29)
|
IN_PROCESS, // Known to be blocking command input (as in G29)
|
||||||
PAUSED_FOR_USER, // Blocking pending any input
|
PAUSED_FOR_USER, // Blocking pending any input
|
||||||
PAUSED_FOR_INPUT // Blocking pending text input (concept)
|
PAUSED_FOR_INPUT // Blocking pending text input (concept)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parser.cpp - Parser for a GCode line, providing a parameter interface.
|
* parser.cpp - Parser for a G-Code line, providing a parameter interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
@ -66,7 +66,7 @@ uint16_t GCodeParser::codenum;
|
||||||
char *GCodeParser::command_args; // start of parameters
|
char *GCodeParser::command_args; // start of parameters
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create a global instance of the GCode parser singleton
|
// Create a global instance of the G-Code parser singleton
|
||||||
GCodeParser parser;
|
GCodeParser parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,7 @@ void GCodeParser::reset() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate the command line state (command_letter, codenum, subcode, and string_arg)
|
* Populate the command line state (command_letter, codenum, subcode, and string_arg)
|
||||||
* by parsing a single line of GCode. 58 bytes of SRAM are used to speed up seen/value.
|
* by parsing a single line of G-Code. 58 bytes of SRAM are used to speed up seen/value.
|
||||||
*/
|
*/
|
||||||
void GCodeParser::parse(char *p) {
|
void GCodeParser::parse(char *p) {
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ void GCodeParser::parse(char *p) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FASTER_GCODE_PARSER)
|
#if ENABLED(FASTER_GCODE_PARSER)
|
||||||
// Arguments MUST be uppercase for fast GCode parsing
|
// Arguments MUST be uppercase for fast G-Code parsing
|
||||||
#define PARAM_OK(P) WITHIN((P), 'A', 'Z')
|
#define PARAM_OK(P) WITHIN((P), 'A', 'Z')
|
||||||
#else
|
#else
|
||||||
#define PARAM_OK(P) true
|
#define PARAM_OK(P) true
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parser.h - Parser for a GCode line, providing a parameter interface.
|
* parser.h - Parser for a G-Code line, providing a parameter interface.
|
||||||
* Codes like M149 control the way the GCode parser behaves,
|
* Codes like M149 control the way the G-Code parser behaves,
|
||||||
* so settings for these codes are located in this class.
|
* so settings for these codes are located in this class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GCode parser
|
* G-Code parser
|
||||||
*
|
*
|
||||||
* - Parse a single G-code line for its letter, code, subcode, and parameters
|
* - Parse a single G-code line for its letter, code, subcode, and parameters
|
||||||
* - FASTER_GCODE_PARSER:
|
* - FASTER_GCODE_PARSER:
|
||||||
|
@ -68,7 +68,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Global states for GCode-level units features
|
// Global states for G-Code-level units features
|
||||||
|
|
||||||
static bool volumetric_enabled;
|
static bool volumetric_enabled;
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ public:
|
||||||
FORCE_INLINE static char* unescape_string(char* &src) { return src; }
|
FORCE_INLINE static char* unescape_string(char* &src) { return src; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Populate all fields by parsing a single line of GCode
|
// Populate all fields by parsing a single line of G-Code
|
||||||
// This uses 54 bytes of SRAM to speed up seen/value
|
// This uses 54 bytes of SRAM to speed up seen/value
|
||||||
static void parse(char * p);
|
static void parse(char * p);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
*/
|
*/
|
||||||
struct SerialState {
|
struct SerialState {
|
||||||
/**
|
/**
|
||||||
* GCode line number handling. Hosts may include line numbers when sending
|
* G-Code line number handling. Hosts may include line numbers when sending
|
||||||
* commands to Marlin, and lines will be checked for sequentiality.
|
* commands to Marlin, and lines will be checked for sequentiality.
|
||||||
* M110 N<int> sets the current line number.
|
* M110 N<int> sets the current line number.
|
||||||
*/
|
*/
|
||||||
|
@ -48,7 +48,7 @@ public:
|
||||||
static SerialState serial_state[NUM_SERIAL]; //!< Serial states for each serial port
|
static SerialState serial_state[NUM_SERIAL]; //!< Serial states for each serial port
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GCode Command Queue
|
* G-Code Command Queue
|
||||||
* A simple (circular) ring buffer of BUFSIZE command strings.
|
* A simple (circular) ring buffer of BUFSIZE command strings.
|
||||||
*
|
*
|
||||||
* Commands are copied into this buffer by the command injectors
|
* Commands are copied into this buffer by the command injectors
|
||||||
|
|
|
@ -4201,7 +4201,7 @@ void JyersDWIN::popupHandler(const PopupID popupid, const bool option/*=false*/)
|
||||||
case Popup_PIDWait: drawPopup(F("PID Autotune"), F("in process"), F("Please wait until done."), Proc_Wait, ICON_BLTouch); break;
|
case Popup_PIDWait: drawPopup(F("PID Autotune"), F("in process"), F("Please wait until done."), Proc_Wait, ICON_BLTouch); break;
|
||||||
case Popup_MPCWait: drawPopup(F("MPC Autotune"), F("in process"), F("Please wait until done."), Proc_Wait, ICON_BLTouch); break;
|
case Popup_MPCWait: drawPopup(F("MPC Autotune"), F("in process"), F("Please wait until done."), Proc_Wait, ICON_BLTouch); break;
|
||||||
case Popup_Resuming: drawPopup(F("Resuming Print"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break;
|
case Popup_Resuming: drawPopup(F("Resuming Print"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break;
|
||||||
case Popup_Custom: drawPopup(F("Running Custom GCode"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break;
|
case Popup_Custom: drawPopup(F("Running Custom G-Code"), F("Please wait until done."), F(""), Proc_Wait, ICON_BLTouch); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ Here's a basic flowchart of Marlin command processing:
|
||||||
| Host | | SerialState RingBuffer | | |
|
| Host | | SerialState RingBuffer | | |
|
||||||
| | Marlin | NUM_SERIAL BUF_SIZE | | Marlin |
|
| | Marlin | NUM_SERIAL BUF_SIZE | | Marlin |
|
||||||
+--+---+ R/TX_BUFFER_SIZE | +---+ +------------------+ | | |
|
+--+---+ R/TX_BUFFER_SIZE | +---+ +------------------+ | | |
|
||||||
| +------------+ | | | | | | | GCode |
|
| +------------+ | | | | | | | G-Code |
|
||||||
| | | | | | | MAX_CMD_SIZE +-+-----> processor |
|
| | | | | | | MAX_CMD_SIZE +-+-----> processor |
|
||||||
| | Platform | | | | On EOL | +--------------+ | r_pos | |
|
| | Platform | | | | On EOL | +--------------+ | r_pos | |
|
||||||
+-------------> serial's +-----------> +--------> | G-code | | | +-----------+
|
+-------------> serial's +-----------> +--------> | G-code | | | +-----------+
|
||||||
|
|
Loading…
Add table
Reference in a new issue