Simplify G-code debug option
This commit is contained in:
parent
59b5800e58
commit
d5ad51821c
@ -211,13 +211,7 @@ void GCodeParser::parse(char *p) {
|
||||
#endif
|
||||
|
||||
#if ENABLED(FASTER_GCODE_PARSER)
|
||||
{
|
||||
set(code, has_num ? p : NULL // Set parameter exists and pointer (NULL for no number)
|
||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||
, debug
|
||||
#endif
|
||||
);
|
||||
}
|
||||
set(code, has_num ? p : NULL); // Set parameter exists and pointer (NULL for no number)
|
||||
#endif
|
||||
}
|
||||
else if (!string_arg) { // Not A-Z? First time, keep as the string_arg
|
||||
|
@ -116,17 +116,13 @@ public:
|
||||
}
|
||||
|
||||
// Set the flag and pointer for a parameter
|
||||
static void set(const char c, char * const ptr
|
||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||
, const bool debug=false
|
||||
#endif
|
||||
) {
|
||||
static void set(const char c, char * const ptr) {
|
||||
const uint8_t ind = LETTER_BIT(c);
|
||||
if (ind >= COUNT(param)) return; // Only A-Z
|
||||
SBI(codebits, ind); // parameter exists
|
||||
param[ind] = ptr ? ptr - command_ptr : 0; // parameter offset or 0
|
||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||
if (debug) {
|
||||
if (codenum == 800) {
|
||||
const uint16_t * const adr = (uint16_t*)&codebits;
|
||||
SERIAL_ECHOPAIR("Set bit ", (int)ind);
|
||||
SERIAL_ECHOPAIR(" of codebits (", hex_address((void*)adr[1]));
|
||||
@ -143,6 +139,11 @@ public:
|
||||
if (ind >= COUNT(param)) return false; // Only A-Z
|
||||
const bool b = TEST(codebits, ind);
|
||||
if (b) {
|
||||
#if ENABLED(DEBUG_GCODE_PARSER)
|
||||
if (codenum == 800) {
|
||||
SERIAL_CHAR('\''); SERIAL_CHAR(c); SERIAL_ECHOLNPGM("' is seen");
|
||||
}
|
||||
#endif
|
||||
char * const ptr = command_ptr + param[ind];
|
||||
value_ptr = param[ind] && valid_float(ptr) ? ptr : (char*)NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user