Merge tag 'v1.1f.20170131'
This commit is contained in:
@ -379,12 +379,20 @@
|
||||
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
|
||||
// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11.
|
||||
// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno).
|
||||
// NOTE: With no direction pin, the spindle clockwise M4 g-code command will be removed. M3 and M5 still work.
|
||||
// NOTE: Without a direction pin, M4 will not have a pin output to indicate a difference with M3.
|
||||
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
|
||||
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
|
||||
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
|
||||
// not ported #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.
|
||||
|
||||
// Alters the behavior of the spindle enable pin with the USE_SPINDLE_DIR_AS_ENABLE_PIN option . By default,
|
||||
// Grbl will not disable the enable pin if spindle speed is zero and M3/4 is active, but still sets the PWM
|
||||
// output to zero. This allows the users to know if the spindle is active and use it as an additional control
|
||||
// input. However, in some use cases, user may want the enable pin to disable with a zero spindle speed and
|
||||
// re-enable when spindle speed is greater than zero. This option does that.
|
||||
// NOTE: Requires USE_SPINDLE_DIR_AS_ENABLE_PIN to be enabled.
|
||||
// #define SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED // Default disabled. Uncomment to enable.
|
||||
|
||||
// With this enabled, Grbl sends back an echo of the line it has received, which has been pre-parsed (spaces
|
||||
// removed, capitalized letters, no comments) and is to be immediately executed by Grbl. Echoes will not be
|
||||
// sent upon a line buffer overflow, but should for all normal lines sent to Grbl. For example, if a user
|
||||
@ -597,6 +605,15 @@
|
||||
#define PARKING_PULLOUT_INCREMENT 5.0 // Spindle pull-out and plunge distance in mm. Incremental distance.
|
||||
// Must be positive value or equal to zero.
|
||||
|
||||
// Enables a special set of M-code commands that enables and disables the parking motion.
|
||||
// These are controlled by `M56`, `M56 P1`, or `M56 Px` to enable and `M56 P0` to disable.
|
||||
// The command is modal and will be set after a planner sync. Since it is g-code, it is
|
||||
// executed in sync with g-code commands. It is not a real-time command.
|
||||
// NOTE: PARKING_ENABLE is required. By default, M56 is active upon initialization. Use
|
||||
// DEACTIVATE_PARKING_UPON_INIT to set M56 P0 as the power-up default.
|
||||
// #define ENABLE_PARKING_OVERRIDE_CONTROL // Default disabled. Uncomment to enable
|
||||
// #define DEACTIVATE_PARKING_UPON_INIT // Default disabled. Uncomment to enable.
|
||||
|
||||
// This option will automatically disable the laser during a feed hold by invoking a spindle stop
|
||||
// override immediately after coming to a stop. However, this also means that the laser still may
|
||||
// be reenabled by disabling the spindle stop override, if needed. This is purely a safety feature
|
||||
|
@ -38,9 +38,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -80,9 +80,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 225.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 125.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 170.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 225.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 125.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 170.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 2800.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -125,9 +125,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -170,9 +170,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (250.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (250.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 290.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -214,9 +214,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 425.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 465.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 425.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 465.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -259,9 +259,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 290.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -304,9 +304,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 740.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 790.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 740.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 790.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -347,9 +347,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 190.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 180.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 150.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 190.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 180.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 150.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -386,9 +386,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 500.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 750.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 750.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -425,9 +425,9 @@
|
||||
#define DEFAULT_X_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
||||
#define DEFAULT_X_MAX_TRAVEL 1000.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 1000.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 1000.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 1000.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 1000.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 1000.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
|
45
grbl/gcode.c
45
grbl/gcode.c
@ -252,16 +252,11 @@ uint8_t gc_execute_line(char *line)
|
||||
default: gc_block.modal.program_flow = int_value; // Program end and reset
|
||||
}
|
||||
break;
|
||||
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
case 4:
|
||||
#endif
|
||||
case 3: case 5:
|
||||
case 3: case 4: case 5:
|
||||
word_bit = MODAL_GROUP_M7;
|
||||
switch(int_value) {
|
||||
case 3: gc_block.modal.spindle = SPINDLE_ENABLE_CW; break;
|
||||
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
case 4: gc_block.modal.spindle = SPINDLE_ENABLE_CCW; break;
|
||||
#endif
|
||||
case 4: gc_block.modal.spindle = SPINDLE_ENABLE_CCW; break;
|
||||
case 5: gc_block.modal.spindle = SPINDLE_DISABLE; break;
|
||||
}
|
||||
break;
|
||||
@ -279,6 +274,12 @@ uint8_t gc_execute_line(char *line)
|
||||
case 9: gc_block.modal.coolant = COOLANT_DISABLE; break;
|
||||
}
|
||||
break;
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
case 56:
|
||||
word_bit = MODAL_GROUP_M9;
|
||||
gc_block.modal.override = OVERRIDE_PARKING_MOTION;
|
||||
break;
|
||||
#endif
|
||||
default: FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); // [Unsupported M command]
|
||||
}
|
||||
|
||||
@ -395,7 +396,7 @@ uint8_t gc_execute_line(char *line)
|
||||
if (gc_block.modal.feed_rate == FEED_RATE_MODE_INVERSE_TIME) { // = G93
|
||||
// NOTE: G38 can also operate in inverse time, but is undefined as an error. Missing F word check added here.
|
||||
if (axis_command == AXIS_COMMAND_MOTION_MODE) {
|
||||
if ((gc_block.modal.motion != MOTION_MODE_NONE) || (gc_block.modal.motion != MOTION_MODE_SEEK)) {
|
||||
if ((gc_block.modal.motion != MOTION_MODE_NONE) && (gc_block.modal.motion != MOTION_MODE_SEEK)) {
|
||||
if (bit_isfalse(value_words,bit(WORD_F))) { FAIL(STATUS_GCODE_UNDEFINED_FEED_RATE); } // [F word missing]
|
||||
}
|
||||
}
|
||||
@ -434,7 +435,15 @@ uint8_t gc_execute_line(char *line)
|
||||
// [6. Change tool ]: N/A
|
||||
// [7. Spindle control ]: N/A
|
||||
// [8. Coolant control ]: N/A
|
||||
// [9. Enable/disable feed rate or spindle overrides ]: NOT SUPPORTED.
|
||||
// [9. Override control ]: Not supported except for a Grbl-only parking motion override control.
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
if (bit_istrue(command_words,bit(MODAL_GROUP_M9))) { // Already set as enabled in parser.
|
||||
if (bit_istrue(value_words,bit(WORD_P))) {
|
||||
if (gc_block.values.p == 0.0) { gc_block.modal.override = OVERRIDE_DISABLED; }
|
||||
bit_false(value_words,bit(WORD_P));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// [10. Dwell ]: P value missing. P is negative (done.) NOTE: See below.
|
||||
if (gc_block.non_modal_command == NON_MODAL_DWELL) {
|
||||
@ -949,7 +958,13 @@ uint8_t gc_execute_line(char *line)
|
||||
}
|
||||
pl_data->condition |= gc_state.modal.coolant; // Set condition flag for planner use.
|
||||
|
||||
// [9. Enable/disable feed rate or spindle overrides ]: NOT SUPPORTED. Always enabled.
|
||||
// [9. Override control ]: NOT SUPPORTED. Always enabled. Except for a Grbl-only parking control.
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
if (gc_state.modal.override != gc_block.modal.override) {
|
||||
gc_state.modal.override = gc_block.modal.override;
|
||||
mc_override_ctrl_update(gc_state.modal.override);
|
||||
}
|
||||
#endif
|
||||
|
||||
// [10. Dwell ]:
|
||||
if (gc_block.non_modal_command == NON_MODAL_DWELL) { mc_dwell(gc_block.values.p); }
|
||||
@ -1087,7 +1102,13 @@ uint8_t gc_execute_line(char *line)
|
||||
gc_state.modal.coord_select = 0; // G54
|
||||
gc_state.modal.spindle = SPINDLE_DISABLE;
|
||||
gc_state.modal.coolant = COOLANT_DISABLE;
|
||||
// gc_state.modal.override = OVERRIDE_DISABLE; // Not supported.
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
#ifdef DEACTIVATE_PARKING_UPON_INIT
|
||||
gc_state.modal.override = OVERRIDE_DISABLED;
|
||||
#else
|
||||
gc_state.modal.override = OVERRIDE_PARKING_MOTION;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RESTORE_OVERRIDES_AFTER_PROGRAM_END
|
||||
sys.f_override = DEFAULT_FEED_OVERRIDE;
|
||||
@ -1133,7 +1154,7 @@ uint8_t gc_execute_line(char *line)
|
||||
group 7 = {G41, G42} cutter radius compensation (G40 is supported)
|
||||
group 8 = {G43} tool length offset (G43.1/G49 are supported)
|
||||
group 8 = {M7*} enable mist coolant (* Compile-option)
|
||||
group 9 = {M48, M49} enable/disable feed and speed override switches
|
||||
group 9 = {M48, M49, M56*} enable/disable override switches (* Compile-option)
|
||||
group 10 = {G98, G99} return mode canned cycles
|
||||
group 13 = {G61.1, G64} path control mode (G61 is supported)
|
||||
*/
|
||||
|
15
grbl/gcode.h
15
grbl/gcode.h
@ -44,10 +44,7 @@
|
||||
#define MODAL_GROUP_M4 11 // [M0,M1,M2,M30] Stopping
|
||||
#define MODAL_GROUP_M7 12 // [M3,M4,M5] Spindle turning
|
||||
#define MODAL_GROUP_M8 13 // [M7,M8,M9] Coolant control
|
||||
|
||||
// #define OTHER_INPUT_F 14
|
||||
// #define OTHER_INPUT_S 15
|
||||
// #define OTHER_INPUT_T 16
|
||||
#define MODAL_GROUP_M9 14 // [M56] Override control
|
||||
|
||||
// Define command actions for within execution-type modal groups (motion, stopping, non-modal). Used
|
||||
// internally by the parser to know which command to execute.
|
||||
@ -126,6 +123,15 @@
|
||||
#define TOOL_LENGTH_OFFSET_CANCEL 0 // G49 (Default: Must be zero)
|
||||
#define TOOL_LENGTH_OFFSET_ENABLE_DYNAMIC 1 // G43.1
|
||||
|
||||
// Modal Group M9: Override control
|
||||
#ifdef DEACTIVATE_PARKING_UPON_INIT
|
||||
#define OVERRIDE_DISABLED 0 // (Default: Must be zero)
|
||||
#define OVERRIDE_PARKING_MOTION 1 // M56
|
||||
#else
|
||||
#define OVERRIDE_PARKING_MOTION 0 // M56 (Default: Must be zero)
|
||||
#define OVERRIDE_DISABLED 1 // Parking disabled.
|
||||
#endif
|
||||
|
||||
// Modal Group G12: Active work coordinate system
|
||||
// N/A: Stores coordinate system value (54-59) to change to.
|
||||
|
||||
@ -187,6 +193,7 @@ typedef struct {
|
||||
uint8_t program_flow; // {M0,M1,M2,M30}
|
||||
uint8_t coolant; // {M7,M8,M9}
|
||||
uint8_t spindle; // {M3,M4,M5}
|
||||
uint8_t override; // {M56}
|
||||
} gc_modal_t;
|
||||
|
||||
typedef struct {
|
||||
|
15
grbl/grbl.h
15
grbl/grbl.h
@ -22,8 +22,8 @@
|
||||
#define grbl_h
|
||||
|
||||
// Grbl versioning system
|
||||
#define GRBL_VERSION "1.1e"
|
||||
#define GRBL_VERSION_BUILD "20170114"
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#define GRBL_VERSION_BUILD "20170131"
|
||||
|
||||
// Define standard libraries used by Grbl.
|
||||
#include <avr/io.h>
|
||||
@ -79,12 +79,22 @@
|
||||
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
|
||||
#endif
|
||||
|
||||
#if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)
|
||||
#error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled"
|
||||
#endif
|
||||
|
||||
#if defined(PARKING_ENABLE)
|
||||
#if defined(HOMING_FORCE_SET_ORIGIN)
|
||||
#error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_PARKING_OVERRIDE_CONTROL)
|
||||
#if !defined(PARKING_ENABLE)
|
||||
#error "ENABLE_PARKING_OVERRIDE_CONTROL must be enabled with PARKING_ENABLE."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* restriction removed
|
||||
#if defined(SPINDLE_PWM_MIN_VALUE)
|
||||
#if !(SPINDLE_PWM_MIN_VALUE > 0)
|
||||
@ -105,6 +115,7 @@
|
||||
#if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
|
||||
#error "Override refresh must be greater than zero."
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
@ -30,10 +30,8 @@ extern DummyReg PCIE1;
|
||||
|
||||
// Declare system global variable structure
|
||||
system_t sys;
|
||||
|
||||
int32_t sys_position[N_AXIS]; // Real-time machine (aka home) position vector in steps.
|
||||
int32_t sys_probe_position[N_AXIS]; // Last probe position in machine coordinates and steps.
|
||||
|
||||
volatile uint8_t sys_probe_state; // Probing state value. Used to coordinate the probing cycle with stepper ISR.
|
||||
volatile uint8_t sys_rt_exec_state; // Global realtime executor bitflag variable for state management. See EXEC bitmasks.
|
||||
volatile uint8_t sys_rt_exec_alarm; // Global realtime executor bitflag variable for setting various alarms.
|
||||
|
@ -310,32 +310,43 @@ uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_
|
||||
else { return(GC_PROBE_FAIL_END); } // Failed to trigger probe within travel. With or without error.
|
||||
}
|
||||
|
||||
#ifdef PARKING_ENABLE
|
||||
// Plans and executes the single special motion case for parking. Independent of main planner buffer.
|
||||
// NOTE: Uses the always free planner ring buffer head to store motion parameters for execution.
|
||||
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data)
|
||||
{
|
||||
if (sys.abort) { return; } // Block during abort.
|
||||
#ifdef PARKING_ENABLE
|
||||
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data)
|
||||
{
|
||||
if (sys.abort) { return; } // Block during abort.
|
||||
|
||||
uint8_t plan_status = plan_buffer_line(parking_target, pl_data);
|
||||
uint8_t plan_status = plan_buffer_line(parking_target, pl_data);
|
||||
|
||||
if (plan_status) {
|
||||
bit_true(sys.step_control, STEP_CONTROL_EXECUTE_SYS_MOTION);
|
||||
bit_false(sys.step_control, STEP_CONTROL_END_MOTION); // Allow parking motion to execute, if feed hold is active.
|
||||
st_parking_setup_buffer(); // Setup step segment buffer for special parking motion case
|
||||
st_prep_buffer();
|
||||
st_wake_up();
|
||||
do {
|
||||
protocol_exec_rt_system();
|
||||
if (sys.abort) { return; }
|
||||
} while (sys.step_control & STEP_CONTROL_EXECUTE_SYS_MOTION);
|
||||
st_parking_restore_buffer(); // Restore step segment buffer to normal run state.
|
||||
} else {
|
||||
bit_false(sys.step_control, STEP_CONTROL_EXECUTE_SYS_MOTION);
|
||||
protocol_exec_rt_system();
|
||||
}
|
||||
|
||||
if (plan_status) {
|
||||
bit_true(sys.step_control, STEP_CONTROL_EXECUTE_SYS_MOTION);
|
||||
bit_false(sys.step_control, STEP_CONTROL_END_MOTION); // Allow parking motion to execute, if feed hold is active.
|
||||
st_parking_setup_buffer(); // Setup step segment buffer for special parking motion case
|
||||
st_prep_buffer();
|
||||
st_wake_up();
|
||||
do {
|
||||
protocol_exec_rt_system();
|
||||
if (sys.abort) { return; }
|
||||
} while (sys.step_control & STEP_CONTROL_EXECUTE_SYS_MOTION);
|
||||
st_parking_restore_buffer(); // Restore step segment buffer to normal run state.
|
||||
} else {
|
||||
bit_false(sys.step_control, STEP_CONTROL_EXECUTE_SYS_MOTION);
|
||||
protocol_exec_rt_system();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
void mc_override_ctrl_update(uint8_t override_state)
|
||||
{
|
||||
// Finish all queued commands before altering override control state
|
||||
protocol_buffer_synchronize();
|
||||
if (sys.abort) { return; }
|
||||
sys.override_ctrl = override_state;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Method to ready the system to reset by setting the realtime reset command and killing any
|
||||
|
@ -54,6 +54,9 @@ void mc_homing_cycle(uint8_t cycle_mask);
|
||||
// Perform tool length probe cycle. Requires probe switch.
|
||||
uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_flags);
|
||||
|
||||
// Handles updating the override control state.
|
||||
void mc_override_ctrl_update(uint8_t override_state);
|
||||
|
||||
// Plans and executes the single special motion case for parking. Independent of main planner buffer.
|
||||
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data);
|
||||
|
||||
|
@ -575,10 +575,16 @@ static void protocol_exec_rt_suspend()
|
||||
// Execute slow pull-out parking retract motion. Parking requires homing enabled, the
|
||||
// current location not exceeding the parking target location, and laser mode disabled.
|
||||
// NOTE: State is will remain DOOR, until the de-energizing and retract is complete.
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) &&
|
||||
(parking_target[PARKING_AXIS] < PARKING_TARGET) &&
|
||||
bit_isfalse(settings.flags,BITFLAG_LASER_MODE) &&
|
||||
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
|
||||
#else
|
||||
if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) &&
|
||||
(parking_target[PARKING_AXIS] < PARKING_TARGET) &&
|
||||
bit_isfalse(settings.flags,BITFLAG_LASER_MODE)) {
|
||||
|
||||
#endif
|
||||
// Retract spindle by pullout distance. Ensure retraction motion moves away from
|
||||
// the workpiece and waypoint motion doesn't exceed the parking target location.
|
||||
if (parking_target[PARKING_AXIS] < retract_waypoint) {
|
||||
@ -642,7 +648,12 @@ static void protocol_exec_rt_suspend()
|
||||
#ifdef PARKING_ENABLE
|
||||
// Execute fast restore motion to the pull-out position. Parking requires homing enabled.
|
||||
// NOTE: State is will remain DOOR, until the de-energizing and retract is complete.
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) &&
|
||||
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
|
||||
#else
|
||||
if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) {
|
||||
#endif
|
||||
// Check to ensure the motion doesn't move below pull-out position.
|
||||
if (parking_target[PARKING_AXIS] <= PARKING_TARGET) {
|
||||
parking_target[PARKING_AXIS] = retract_waypoint;
|
||||
@ -676,7 +687,12 @@ static void protocol_exec_rt_suspend()
|
||||
|
||||
#ifdef PARKING_ENABLE
|
||||
// Execute slow plunge motion from pull-out position to resume position.
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) &&
|
||||
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
|
||||
#else
|
||||
if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) {
|
||||
#endif
|
||||
// Block if safety door re-opened during prior restore actions.
|
||||
if (bit_isfalse(sys.suspend,SUSPEND_RESTART_RETRACT)) {
|
||||
// Regardless if the retract parking motion was a valid/safe motion or not, the
|
||||
|
@ -328,6 +328,13 @@ void report_gcode_modes()
|
||||
else { serial_write('9'); }
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
if (sys.override_ctrl == OVERRIDE_PARKING_MOTION) {
|
||||
report_util_gcode_modes_M();
|
||||
print_uint8_base10(56);
|
||||
}
|
||||
#endif
|
||||
|
||||
printPgmString(PSTR(" T"));
|
||||
print_uint8_base10(gc_state.tool);
|
||||
|
||||
@ -394,6 +401,18 @@ void report_build_info(char *line)
|
||||
#ifdef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES
|
||||
serial_write('A');
|
||||
#endif
|
||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
serial_write('D');
|
||||
#endif
|
||||
#ifdef SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED
|
||||
serial_write('0');
|
||||
#endif
|
||||
#ifdef ENABLE_SOFTWARE_DEBOUNCE
|
||||
serial_write('S');
|
||||
#endif
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
serial_write('R');
|
||||
#endif
|
||||
#ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL // NOTE: Shown when disabled.
|
||||
serial_write('*');
|
||||
#endif
|
||||
@ -412,9 +431,16 @@ void report_build_info(char *line)
|
||||
#ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled.
|
||||
serial_write('W');
|
||||
#endif
|
||||
#ifndef HOMING_INIT_LOCK
|
||||
serial_write('L');
|
||||
#endif
|
||||
|
||||
// NOTE: Compiled values, like override increments/max/min values, may be added at some point later.
|
||||
// These will likely have a comma delimiter to separate them.
|
||||
|
||||
serial_write(',');
|
||||
print_uint8_base10(BLOCK_BUFFER_SIZE-1);
|
||||
serial_write(',');
|
||||
print_uint32_base10(RX_BUFFER_SIZE);
|
||||
|
||||
report_util_feedback_line_feed();
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,8 @@ void spindle_stop()
|
||||
}
|
||||
spindle_set_speed(spindle_compute_pwm_value(rpm));
|
||||
#endif
|
||||
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) || !defined(VARIABLE_SPINDLE)
|
||||
#if (defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && \
|
||||
!defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)) || !defined(VARIABLE_SPINDLE)
|
||||
// NOTE: Without variable spindle, the enable bit should just turn on or off, regardless
|
||||
// if the spindle speed value is zero, as its ignored anyhow.
|
||||
/* not ported
|
||||
|
@ -44,11 +44,17 @@
|
||||
// NOTE: AMASS cutoff frequency multiplied by ISR overdrive factor must not exceed maximum step frequency.
|
||||
// NOTE: Current settings are set to overdrive the ISR to no more than 16kHz, balancing CPU overhead
|
||||
// and timer accuracy. Do not alter these settings unless you know what you are doing.
|
||||
#define MAX_AMASS_LEVEL 3
|
||||
// AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.
|
||||
#define AMASS_LEVEL1 (F_CPU/8000) // Over-drives ISR (x2). Defined as F_CPU/(Cutoff frequency in Hz)
|
||||
#define AMASS_LEVEL2 (F_CPU/4000) // Over-drives ISR (x4)
|
||||
#define AMASS_LEVEL3 (F_CPU/2000) // Over-drives ISR (x8)
|
||||
#ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
||||
#define MAX_AMASS_LEVEL 3
|
||||
// AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.
|
||||
#define AMASS_LEVEL1 (F_CPU/8000) // Over-drives ISR (x2). Defined as F_CPU/(Cutoff frequency in Hz)
|
||||
#define AMASS_LEVEL2 (F_CPU/4000) // Over-drives ISR (x4)
|
||||
#define AMASS_LEVEL3 (F_CPU/2000) // Over-drives ISR (x8)
|
||||
|
||||
#if MAX_AMASS_LEVEL <= 0
|
||||
error "AMASS must have 1 or more levels to operate correctly."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Stores the planner block Bresenham algorithm execution data for the segments in the segment
|
||||
@ -646,8 +652,8 @@ void st_prep_buffer()
|
||||
st_prep_block->direction_bits = pl_block->direction_bits;
|
||||
uint8_t idx;
|
||||
#ifndef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
||||
for (idx=0; idx<N_AXIS; idx++) { st_prep_block->steps[idx] = pl_block->steps[idx]; }
|
||||
st_prep_block->step_event_count = pl_block->step_event_count;
|
||||
for (idx=0; idx<N_AXIS; idx++) { st_prep_block->steps[idx] = (pl_block->steps[idx] << 1); }
|
||||
st_prep_block->step_event_count = (pl_block->step_event_count << 1);
|
||||
#else
|
||||
// With AMASS enabled, simply bit-shift multiply all Bresenham data by the max AMASS
|
||||
// level, such that we never divide beyond the original data anywhere in the algorithm.
|
||||
|
@ -137,6 +137,9 @@ typedef struct {
|
||||
uint8_t spindle_stop_ovr; // Tracks spindle stop override states
|
||||
uint8_t report_ovr_counter; // Tracks when to add override data to status reports.
|
||||
uint8_t report_wco_counter; // Tracks when to add work coordinate offset data to status reports.
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
uint8_t override_ctrl; // Tracks override control states.
|
||||
#endif
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
float spindle_speed;
|
||||
#endif
|
||||
@ -155,7 +158,7 @@ extern volatile uint8_t sys_rt_exec_accessory_override; // Global realtime execu
|
||||
|
||||
#ifdef DEBUG
|
||||
#define EXEC_DEBUG_REPORT bit(0)
|
||||
volatile uint8_t sys_rt_exec_debug;
|
||||
extern volatile uint8_t sys_rt_exec_debug;
|
||||
#endif
|
||||
|
||||
// Initialize the serial protocol
|
||||
|
Reference in New Issue
Block a user