Made line number reporting optional via config.h

This commit is contained in:
Robert Grzesek 2014-02-06 15:19:30 -08:00
parent 6fdb35a7da
commit cd71a90ce8
4 changed files with 15 additions and 3 deletions

View File

@ -28,6 +28,10 @@
#ifndef config_h #ifndef config_h
#define config_h #define config_h
// Allows GRBL to tranck and report gcode line numbers. Enabling this means that the planning buffer
// goes from 18 or 16 to make room for the additional line number data in the plan_block_t struct
#define USE_LINE_NUMBERS
// Default settings. Used when resetting EEPROM. Change to desired name in defaults.h // Default settings. Used when resetting EEPROM. Change to desired name in defaults.h
#define DEFAULTS_SHERLINE_5400 #define DEFAULTS_SHERLINE_5400

View File

@ -280,8 +280,9 @@ void plan_buffer_line(float *target, float feed_rate, uint8_t invert_feed_rate,
block->millimeters = 0; block->millimeters = 0;
block->direction_bits = 0; block->direction_bits = 0;
block->acceleration = SOME_LARGE_VALUE; // Scaled down to maximum acceleration later block->acceleration = SOME_LARGE_VALUE; // Scaled down to maximum acceleration later
#ifdef USE_LINE_NUMBERS
block->line_number = line_number; block->line_number = line_number;
#endif
// Compute and store initial move distance data. // Compute and store initial move distance data.
// TODO: After this for-loop, we don't touch the stepper algorithm data. Might be a good idea // TODO: After this for-loop, we don't touch the stepper algorithm data. Might be a good idea
// to try to keep these types of things completely separate from the planner for portability. // to try to keep these types of things completely separate from the planner for portability.

View File

@ -26,7 +26,11 @@
// The number of linear motions that can be in the plan at any give time // The number of linear motions that can be in the plan at any give time
#ifndef BLOCK_BUFFER_SIZE #ifndef BLOCK_BUFFER_SIZE
#ifdef USE_LINE_NUMBERS
#define BLOCK_BUFFER_SIZE 16 #define BLOCK_BUFFER_SIZE 16
#else
#define BLOCK_BUFFER_SIZE 18
#endif
#endif #endif
// This struct stores a linear movement of a g-code block motion with its critical "nominal" values // This struct stores a linear movement of a g-code block motion with its critical "nominal" values
@ -47,7 +51,9 @@ typedef struct {
float acceleration; // Axis-limit adjusted line acceleration in (mm/min^2) float acceleration; // Axis-limit adjusted line acceleration in (mm/min^2)
float millimeters; // The remaining distance for this block to be executed in (mm) float millimeters; // The remaining distance for this block to be executed in (mm)
// uint8_t max_override; // Maximum override value based on axis speed limits // uint8_t max_override; // Maximum override value based on axis speed limits
#ifdef USE_LINE_NUMBERS
uint32_t line_number; uint32_t line_number;
#endif
} plan_block_t; } plan_block_t;

View File

@ -350,6 +350,7 @@ void report_realtime_status()
if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); } if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); }
} }
#ifdef USE_LINE_NUMBERS
// Report current line number // Report current line number
printPgmString(PSTR(",")); printPgmString(PSTR(","));
printPgmString(PSTR("Ln:")); printPgmString(PSTR("Ln:"));
@ -359,7 +360,7 @@ void report_realtime_status()
ln = pb->line_number; ln = pb->line_number;
} }
printInteger(ln); printInteger(ln);
#endif
printPgmString(PSTR(">\r\n")); printPgmString(PSTR(">\r\n"));
} }