Fixed unintended laser mode pausing. Updated documentation. Min SS OVR lowered to 10%.
- [laser] Tested a working version and pushed the wrong one for the last! 20161203 was pausing upon every spindle speed change. That’s not right. Fixed so nearly all motions are passed through and does not stop. - Minimum spindle speed override lower from 50% to 10%. Lasers could use the lower speeds. - Fixed a very minor bug related to G80 error checking. Allowed no error with non-modal motions with axis words. Not correct and fixed. - Fixed a compile error when disabling VARIABLE_SPINDLE - [doc] Updated some obsolete documentation. - [doc] Started a “Laser Mode” document that summarizes how Grbl’s new laser mode works.
This commit is contained in:
@ -251,7 +251,7 @@
|
||||
|
||||
#define DEFAULT_SPINDLE_SPEED_OVERRIDE 100 // 100%. Don't change this value.
|
||||
#define MAX_SPINDLE_SPEED_OVERRIDE 200 // Percent of programmed spindle speed (100-255). Usually 200%.
|
||||
#define MIN_SPINDLE_SPEED_OVERRIDE 50 // Percent of programmed spindle speed (1-100). Usually 50%.
|
||||
#define MIN_SPINDLE_SPEED_OVERRIDE 10 // Percent of programmed spindle speed (1-100). Usually 10%.
|
||||
#define SPINDLE_OVERRIDE_COARSE_INCREMENT 10 // (1-99). Usually 10%.
|
||||
#define SPINDLE_OVERRIDE_FINE_INCREMENT 1 // (1-99). Usually 1%.
|
||||
|
||||
|
57
grbl/gcode.c
57
grbl/gcode.c
@ -631,10 +631,9 @@ uint8_t gc_execute_line(char *line)
|
||||
|
||||
// [20. Motion modes ]:
|
||||
if (gc_block.modal.motion == MOTION_MODE_NONE) {
|
||||
// [G80 Errors]: Axis word exist and are not used by a non-modal command.
|
||||
if ((axis_words) && (axis_command != AXIS_COMMAND_NON_MODAL)) {
|
||||
FAIL(STATUS_GCODE_AXIS_WORDS_EXIST); // [No axis words allowed]
|
||||
}
|
||||
// [G80 Errors]: Axis word are programmed while G80 is active.
|
||||
// NOTE: Even non-modal commands or TLO that use axis words will throw this strict error.
|
||||
if (axis_words) { FAIL(STATUS_GCODE_AXIS_WORDS_EXIST); } // [No axis words allowed]
|
||||
|
||||
// Check remaining motion modes, if axis word are implicit (exist and not used by G10/28/30/92), or
|
||||
// was explicitly commanded in the g-code block.
|
||||
@ -859,32 +858,28 @@ uint8_t gc_execute_line(char *line)
|
||||
|| (gc_block.modal.motion == MOTION_MODE_CCW_ARC)) ) {
|
||||
gc_parser_flags |= GC_PARSER_LASER_DISABLE;
|
||||
}
|
||||
// M3 constant power laser requires planner syncs to update the laser in certain conditions.
|
||||
// certain conditions.
|
||||
if (gc_state.modal.spindle == SPINDLE_ENABLE_CW) {
|
||||
if ((gc_state.modal.motion == MOTION_MODE_LINEAR) || (gc_state.modal.motion == MOTION_MODE_CW_ARC)
|
||||
|| (gc_state.modal.motion == MOTION_MODE_CCW_ARC)) {
|
||||
if (gc_parser_flags & GC_PARSER_LASER_DISABLE) {
|
||||
gc_parser_flags |= GC_PARSER_LASER_FORCE_SYNC; // Change from G1/2/3 motion mode.
|
||||
} else {
|
||||
// Any non-motion block with M3 enabled and G1/2/3 modal state requires a sync when
|
||||
// the spindle speed changes. It is otherwise passed onto the planner.
|
||||
if (gc_state.spindle_speed != gc_block.values.s) {
|
||||
// NOTE: A G1/2/3 motion will always have axis words and be in AXIS_COMMAND_MOTION_MODE.
|
||||
// A non-motion G1 or any non-modal command using axis words will alter axis_command.
|
||||
if (!(axis_words) || (axis_command != AXIS_COMMAND_MOTION_MODE )) {
|
||||
gc_parser_flags |= GC_PARSER_LASER_FORCE_SYNC;
|
||||
}
|
||||
|
||||
// Any motion mode with axis words is allowed to be passed from a spindle speed update.
|
||||
// NOTE: G1 and G0 without axis words sets axis_command to none. G28/30 are intentionally omitted.
|
||||
// TODO: Check sync conditions for M3 enabled motions that don't enter the planner. (zero length).
|
||||
if (axis_words && (axis_command == AXIS_COMMAND_MOTION_MODE)) {
|
||||
gc_parser_flags |= GC_PARSER_LASER_ISMOTION;
|
||||
} else {
|
||||
// M3 constant power laser requires planner syncs to update the laser when changing between
|
||||
// a G1/2/3 motion mode state and vice versa when there is no motion in the line.
|
||||
if (gc_state.modal.spindle == SPINDLE_ENABLE_CW) {
|
||||
if ((gc_state.modal.motion == MOTION_MODE_LINEAR) || (gc_state.modal.motion == MOTION_MODE_CW_ARC)
|
||||
|| (gc_state.modal.motion == MOTION_MODE_CCW_ARC)) {
|
||||
if (bit_istrue(gc_parser_flags,GC_PARSER_LASER_DISABLE)) {
|
||||
gc_parser_flags |= GC_PARSER_LASER_FORCE_SYNC; // Change from G1/2/3 motion mode.
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// When changing to a G1 motion mode without axis words from a non-G1/2/3 motion mode.
|
||||
if (bit_isfalse(gc_parser_flags,GC_PARSER_LASER_DISABLE)) {
|
||||
if (!(axis_words) || (axis_command != AXIS_COMMAND_MOTION_MODE )) {
|
||||
} else {
|
||||
// When changing to a G1 motion mode without axis words from a non-G1/2/3 motion mode.
|
||||
if (bit_isfalse(gc_parser_flags,GC_PARSER_LASER_DISABLE)) {
|
||||
gc_parser_flags |= GC_PARSER_LASER_FORCE_SYNC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -909,9 +904,11 @@ uint8_t gc_execute_line(char *line)
|
||||
if ((gc_state.spindle_speed != gc_block.values.s) || bit_istrue(gc_parser_flags,GC_PARSER_LASER_FORCE_SYNC)) {
|
||||
if (gc_state.modal.spindle != SPINDLE_DISABLE) {
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
if (bit_istrue(gc_parser_flags,GC_PARSER_LASER_DISABLE)) {
|
||||
spindle_sync(gc_state.modal.spindle, 0.0);
|
||||
} else { spindle_sync(gc_state.modal.spindle, gc_block.values.s); }
|
||||
if (bit_isfalse(gc_parser_flags,GC_PARSER_LASER_ISMOTION)) {
|
||||
if (bit_istrue(gc_parser_flags,GC_PARSER_LASER_DISABLE)) {
|
||||
spindle_sync(gc_state.modal.spindle, 0.0);
|
||||
} else { spindle_sync(gc_state.modal.spindle, gc_block.values.s); }
|
||||
}
|
||||
#else
|
||||
spindle_sync(gc_state.modal.spindle, 0.0);
|
||||
#endif
|
||||
|
@ -169,6 +169,7 @@
|
||||
#define GC_PARSER_PROBE_IS_NO_ERROR bit(4)
|
||||
#define GC_PARSER_LASER_FORCE_SYNC bit(5)
|
||||
#define GC_PARSER_LASER_DISABLE bit(6)
|
||||
#define GC_PARSER_LASER_ISMOTION bit(7)
|
||||
|
||||
|
||||
// NOTE: When this struct is zeroed, the above defines set the defaults for the system.
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
// Grbl versioning system
|
||||
#define GRBL_VERSION "1.1e"
|
||||
#define GRBL_VERSION_BUILD "20161203"
|
||||
#define GRBL_VERSION_BUILD "20161204"
|
||||
|
||||
// Define standard libraries used by Grbl.
|
||||
#include <avr/io.h>
|
||||
|
@ -363,8 +363,10 @@ ISR(TIMER1_COMPA_vect)
|
||||
} else {
|
||||
// Segment buffer empty. Shutdown.
|
||||
st_go_idle();
|
||||
// Ensure pwm is set properly upon completion of rate-controlled motion.
|
||||
if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(SPINDLE_PWM_OFF_VALUE); }
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
// Ensure pwm is set properly upon completion of rate-controlled motion.
|
||||
if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(SPINDLE_PWM_OFF_VALUE); }
|
||||
#endif
|
||||
system_set_exec_state_flag(EXEC_CYCLE_STOP); // Flag main program for cycle end
|
||||
return; // Nothing to do but exit.
|
||||
}
|
||||
@ -655,16 +657,18 @@ void st_prep_buffer()
|
||||
prep.current_speed = sqrt(pl_block->entry_speed_sqr);
|
||||
}
|
||||
|
||||
// Setup laser mode variables. PWM rate adjusted motions will always complete a motion with the
|
||||
// spindle off.
|
||||
st_prep_block->is_pwm_rate_adjusted = false;
|
||||
if (settings.flags & BITFLAG_LASER_MODE) {
|
||||
if (pl_block->condition & PL_COND_FLAG_SPINDLE_CCW) {
|
||||
// Pre-compute inverse programmed rate to speed up PWM updating per step segment.
|
||||
prep.inv_rate = 1.0/pl_block->programmed_rate;
|
||||
st_prep_block->is_pwm_rate_adjusted = true;
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
// Setup laser mode variables. PWM rate adjusted motions will always complete a motion with the
|
||||
// spindle off.
|
||||
st_prep_block->is_pwm_rate_adjusted = false;
|
||||
if (settings.flags & BITFLAG_LASER_MODE) {
|
||||
if (pl_block->condition & PL_COND_FLAG_SPINDLE_CCW) {
|
||||
// Pre-compute inverse programmed rate to speed up PWM updating per step segment.
|
||||
prep.inv_rate = 1.0/pl_block->programmed_rate;
|
||||
st_prep_block->is_pwm_rate_adjusted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user