2009-01-25 00:48:56 +01:00
|
|
|
/*
|
2014-02-09 18:46:34 +01:00
|
|
|
protocol.c - controls Grbl execution protocol and procedures
|
2014-08-07 13:58:04 +02:00
|
|
|
Part of Grbl v0.9
|
2009-01-25 00:48:56 +01:00
|
|
|
|
2015-01-15 06:14:52 +01:00
|
|
|
Copyright (c) 2012-2015 Sungeun K. Jeon
|
2009-01-25 00:48:56 +01:00
|
|
|
|
|
|
|
Grbl is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Grbl is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2014-08-07 13:58:04 +02:00
|
|
|
/*
|
|
|
|
This file is based on work from Grbl v0.8, distributed under the
|
|
|
|
terms of the MIT-license. See COPYING for more details.
|
|
|
|
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
|
|
|
Copyright (c) 2011-2012 Sungeun K. Jeon
|
|
|
|
*/
|
2009-01-25 00:48:56 +01:00
|
|
|
|
2014-01-11 04:22:10 +01:00
|
|
|
#include "system.h"
|
2011-05-31 22:45:38 +02:00
|
|
|
#include "serial.h"
|
2011-02-05 00:45:41 +01:00
|
|
|
#include "settings.h"
|
2014-01-11 04:22:10 +01:00
|
|
|
#include "protocol.h"
|
|
|
|
#include "gcode.h"
|
2014-02-09 18:46:34 +01:00
|
|
|
#include "planner.h"
|
2011-12-09 02:47:48 +01:00
|
|
|
#include "stepper.h"
|
2012-11-01 16:37:27 +01:00
|
|
|
#include "motion_control.h"
|
2014-01-11 04:22:10 +01:00
|
|
|
#include "report.h"
|
2009-01-25 00:48:56 +01:00
|
|
|
|
2013-10-30 02:10:39 +01:00
|
|
|
|
2014-01-11 04:22:10 +01:00
|
|
|
static char line[LINE_BUFFER_SIZE]; // Line to be executed. Zero-terminated.
|
2011-12-09 02:47:48 +01:00
|
|
|
|
2013-10-30 02:10:39 +01:00
|
|
|
|
2012-11-01 16:37:27 +01:00
|
|
|
// Directs and executes one line of formatted input from protocol_process. While mostly
|
2014-01-11 04:22:10 +01:00
|
|
|
// incoming streaming g-code blocks, this also directs and executes Grbl internal commands,
|
|
|
|
// such as settings, initiating the homing cycle, and toggling switch states.
|
|
|
|
static void protocol_execute_line(char *line)
|
|
|
|
{
|
2015-01-15 06:14:52 +01:00
|
|
|
protocol_execute_realtime(); // Runtime command check point.
|
2014-01-11 04:22:10 +01:00
|
|
|
if (sys.abort) { return; } // Bail to calling function upon system abort
|
|
|
|
|
|
|
|
if (line[0] == 0) {
|
|
|
|
// Empty or comment line. Send status message for syncing purposes.
|
2014-05-26 00:05:28 +02:00
|
|
|
report_status_message(STATUS_OK);
|
2014-01-11 04:22:10 +01:00
|
|
|
|
|
|
|
} else if (line[0] == '$') {
|
|
|
|
// Grbl '$' system command
|
2014-05-26 00:05:28 +02:00
|
|
|
report_status_message(system_execute_line(line));
|
2014-01-11 04:22:10 +01:00
|
|
|
|
2014-05-26 00:05:28 +02:00
|
|
|
} else if (sys.state == STATE_ALARM) {
|
|
|
|
// Everything else is gcode. Block if in alarm mode.
|
|
|
|
report_status_message(STATUS_ALARM_LOCK);
|
|
|
|
|
2011-02-18 22:59:16 +01:00
|
|
|
} else {
|
2014-05-26 00:05:28 +02:00
|
|
|
// Parse and execute g-code block!
|
|
|
|
report_status_message(gc_execute_line(line));
|
2011-02-18 22:59:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-09 02:47:48 +01:00
|
|
|
|
2014-02-09 18:46:34 +01:00
|
|
|
/*
|
2014-07-02 16:39:19 +02:00
|
|
|
GRBL PRIMARY LOOP:
|
2014-02-09 18:46:34 +01:00
|
|
|
*/
|
|
|
|
void protocol_main_loop()
|
2009-01-25 00:48:56 +01:00
|
|
|
{
|
2014-01-11 04:22:10 +01:00
|
|
|
// ------------------------------------------------------------
|
|
|
|
// Complete initialization procedures upon a power-up or reset.
|
|
|
|
// ------------------------------------------------------------
|
|
|
|
|
|
|
|
// Print welcome message
|
|
|
|
report_init_message();
|
2011-12-09 02:47:48 +01:00
|
|
|
|
2014-01-11 04:22:10 +01:00
|
|
|
// Check for and report alarm state after a reset, error, or an initial power up.
|
|
|
|
if (sys.state == STATE_ALARM) {
|
|
|
|
report_feedback_message(MESSAGE_ALARM_LOCK);
|
|
|
|
} else {
|
|
|
|
// All systems go!
|
|
|
|
sys.state = STATE_IDLE; // Set system to ready. Clear all state flags.
|
|
|
|
system_execute_startup(line); // Execute startup script.
|
|
|
|
}
|
|
|
|
|
2014-07-02 16:39:19 +02:00
|
|
|
// ---------------------------------------------------------------------------------
|
|
|
|
// Primary loop! Upon a system abort, this exits back to main() to reset the system.
|
|
|
|
// ---------------------------------------------------------------------------------
|
2014-01-11 04:22:10 +01:00
|
|
|
|
|
|
|
uint8_t iscomment = false;
|
|
|
|
uint8_t char_counter = 0;
|
|
|
|
uint8_t c;
|
|
|
|
for (;;) {
|
|
|
|
|
|
|
|
// Process one line of incoming serial data, as the data becomes available. Performs an
|
|
|
|
// initial filtering by removing spaces and comments and capitalizing all letters.
|
2014-07-02 16:39:19 +02:00
|
|
|
|
|
|
|
// NOTE: While comment, spaces, and block delete(if supported) handling should technically
|
|
|
|
// be done in the g-code parser, doing it here helps compress the incoming data into Grbl's
|
|
|
|
// line buffer, which is limited in size. The g-code standard actually states a line can't
|
|
|
|
// exceed 256 characters, but the Arduino Uno does not have the memory space for this.
|
|
|
|
// With a better processor, it would be very easy to pull this initial parsing out as a
|
|
|
|
// seperate task to be shared by the g-code parser and Grbl's system commands.
|
|
|
|
|
2014-01-11 04:22:10 +01:00
|
|
|
while((c = serial_read()) != SERIAL_NO_DATA) {
|
|
|
|
if ((c == '\n') || (c == '\r')) { // End of line reached
|
|
|
|
line[char_counter] = 0; // Set string termination character.
|
|
|
|
protocol_execute_line(line); // Line is complete. Execute it!
|
|
|
|
iscomment = false;
|
|
|
|
char_counter = 0;
|
2011-08-16 03:39:44 +02:00
|
|
|
} else {
|
2014-01-11 04:22:10 +01:00
|
|
|
if (iscomment) {
|
|
|
|
// Throw away all comment characters
|
|
|
|
if (c == ')') {
|
|
|
|
// End of comment. Resume line.
|
|
|
|
iscomment = false;
|
|
|
|
}
|
2011-08-16 03:39:44 +02:00
|
|
|
} else {
|
2014-01-11 04:22:10 +01:00
|
|
|
if (c <= ' ') {
|
2014-05-26 00:05:28 +02:00
|
|
|
// Throw away whitepace and control characters
|
2014-01-11 04:22:10 +01:00
|
|
|
} else if (c == '/') {
|
2014-05-26 00:05:28 +02:00
|
|
|
// Block delete NOT SUPPORTED. Ignore character.
|
|
|
|
// NOTE: If supported, would simply need to check the system if block delete is enabled.
|
2014-01-11 04:22:10 +01:00
|
|
|
} else if (c == '(') {
|
|
|
|
// Enable comments flag and ignore all characters until ')' or EOL.
|
2014-05-26 00:05:28 +02:00
|
|
|
// NOTE: This doesn't follow the NIST definition exactly, but is good enough for now.
|
|
|
|
// In the future, we could simply remove the items within the comments, but retain the
|
|
|
|
// comment control characters, so that the g-code parser can error-check it.
|
2014-01-11 04:22:10 +01:00
|
|
|
iscomment = true;
|
2014-05-26 00:05:28 +02:00
|
|
|
// } else if (c == ';') {
|
|
|
|
// Comment character to EOL NOT SUPPORTED. LinuxCNC definition. Not NIST.
|
|
|
|
|
|
|
|
// TODO: Install '%' feature
|
|
|
|
// } else if (c == '%') {
|
|
|
|
// Program start-end percent sign NOT SUPPORTED.
|
|
|
|
// NOTE: This maybe installed to tell Grbl when a program is running vs manual input,
|
|
|
|
// where, during a program, the system auto-cycle start will continue to execute
|
|
|
|
// everything until the next '%' sign. This will help fix resuming issues with certain
|
|
|
|
// functions that empty the planner buffer to execute its task on-time.
|
|
|
|
|
Settings refactoring. Bug fixes. Misc new features.
This is likely the last major change to the v0.9 code base before push
to master. Only two minor things remain on the agenda (CoreXY support,
force clear EEPROM, and an extremely low federate bug).
- NEW! Grbl is now compile-able and may be flashed directly through the
Arduino IDE. Only minor changes were required for this compatibility.
See the Wiki to learn how to do it.
- New status reporting mask to turn on and off what Grbl sends back.
This includes machine coordinates, work coordinates, serial RX buffer
usage, and planner buffer usage. Expandable to more information on user
request, but that’s it for now.
- Settings have been completely renumbered to allow for future new
settings to be installed without having to constantly reshuffle and
renumber all of the settings every time.
- All settings masks have been standardized to mean bit 0 = X, bit 1 =
Y, and bit 2 = Z, to reduce confusion on how they work. The invert
masks used by the internal Grbl system were updated to accommodate this
change as well.
- New invert probe pin setting, which does what it sounds like.
- Fixed a probing cycle bug, where it would freeze intermittently, and
removed some redundant code.
- Homing may now be set to the origin wherever the limit switches are.
Traditionally machine coordinates should always be in negative space,
but when limit switches on are on the opposite side, the machine
coordinate would be set to -max_travel for the axis. Now you can always
make it [0,0,0] via a compile-time option in config.h. (Soft limits
routine was updated to account for this as well.)
- Probe coordinate message immediately after a probing cycle may now
be turned off via a compile-time option in config.h. By default the
probing location is always reported.
- Reduced the N_ARC_CORRECTION default value to reflect the changes in
how circles are generated by an arc tolerance, rather than a fixed arc
segment setting.
- Increased the incoming line buffer limit from 70 to 80 characters.
Had some extra memory space to invest into this.
- Fixed a bug where tool number T was not being tracked and reported
correctly.
- Added a print free memory function for debugging purposes. Not used
otherwise.
- Realtime rate report should now work during feed holds, but it hasn’t
been tested yet.
- Updated the streaming scripts with MIT-license and added the simple
streaming to the main stream.py script to allow for settings to be sent.
- Some minor code refactoring to improve flash efficiency. Reduced the
flash by several hundred KB, which was re-invested in some of these new
features.
2014-07-26 23:01:34 +02:00
|
|
|
} else if (char_counter >= (LINE_BUFFER_SIZE-1)) {
|
2014-01-11 04:22:10 +01:00
|
|
|
// Detect line buffer overflow. Report error and reset line buffer.
|
|
|
|
report_status_message(STATUS_OVERFLOW);
|
|
|
|
iscomment = false;
|
|
|
|
char_counter = 0;
|
|
|
|
} else if (c >= 'a' && c <= 'z') { // Upcase lowercase
|
|
|
|
line[char_counter++] = c-'a'+'A';
|
|
|
|
} else {
|
|
|
|
line[char_counter++] = c;
|
|
|
|
}
|
2011-08-16 03:39:44 +02:00
|
|
|
}
|
|
|
|
}
|
2009-01-25 00:48:56 +01:00
|
|
|
}
|
2014-01-11 04:22:10 +01:00
|
|
|
|
|
|
|
// If there are no more characters in the serial read buffer to be processed and executed,
|
|
|
|
// this indicates that g-code streaming has either filled the planner buffer or has
|
|
|
|
// completed. In either case, auto-cycle start, if enabled, any queued moves.
|
2014-02-09 18:46:34 +01:00
|
|
|
protocol_auto_cycle_start();
|
|
|
|
|
2015-01-15 06:14:52 +01:00
|
|
|
protocol_execute_realtime(); // Runtime command check point.
|
2014-02-09 18:46:34 +01:00
|
|
|
if (sys.abort) { return; } // Bail to main() program loop to reset system.
|
|
|
|
|
2009-01-25 00:48:56 +01:00
|
|
|
}
|
2014-01-11 04:22:10 +01:00
|
|
|
|
|
|
|
return; /* Never reached */
|
2009-01-25 00:48:56 +01:00
|
|
|
}
|
2014-02-09 18:46:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
// Executes run-time commands, when required. This is called from various check points in the main
|
|
|
|
// program, primarily where there may be a while loop waiting for a buffer to clear space or any
|
|
|
|
// point where the execution time from the last check point may be more than a fraction of a second.
|
2015-01-15 06:14:52 +01:00
|
|
|
// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code
|
2014-02-09 18:46:34 +01:00
|
|
|
// parsing and planning functions. This function also serves as an interface for the interrupts to
|
2015-01-15 06:14:52 +01:00
|
|
|
// set the system realtime flags, where only the main program handles them, removing the need to
|
2014-02-09 18:46:34 +01:00
|
|
|
// define more computationally-expensive volatile variables. This also provides a controlled way to
|
|
|
|
// execute certain tasks without having two or more instances of the same task, such as the planner
|
|
|
|
// recalculating the buffer upon a feedhold or override.
|
2015-01-15 06:14:52 +01:00
|
|
|
// NOTE: The sys.rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,
|
2014-02-09 18:46:34 +01:00
|
|
|
// limit switches, or the main program.
|
2015-01-15 06:14:52 +01:00
|
|
|
void protocol_execute_realtime()
|
2014-02-09 18:46:34 +01:00
|
|
|
{
|
2015-01-15 06:14:52 +01:00
|
|
|
uint8_t rt_exec; // Temp variable to avoid calling volatile multiple times.
|
|
|
|
|
|
|
|
// Check and execute alarms.
|
|
|
|
rt_exec = sys.rt_exec_alarm; // Copy volatile sys.rt_exec_alarm.
|
2014-02-09 18:46:34 +01:00
|
|
|
if (rt_exec) { // Enter only if any bit flag is true
|
|
|
|
// System alarm. Everything has shutdown by something that has gone severely wrong. Report
|
|
|
|
// the source of the error to the user. If critical, Grbl disables by entering an infinite
|
|
|
|
// loop until system reset/abort.
|
2015-01-15 06:14:52 +01:00
|
|
|
sys.state = STATE_ALARM; // Set system alarm state
|
|
|
|
if (rt_exec & EXEC_ALARM_HARD_LIMIT) {
|
|
|
|
report_alarm_message(ALARM_HARD_LIMIT_ERROR);
|
|
|
|
} else if (rt_exec & EXEC_ALARM_SOFT_LIMIT) {
|
|
|
|
report_alarm_message(ALARM_SOFT_LIMIT_ERROR);
|
|
|
|
} else if (rt_exec & EXEC_ALARM_ABORT_CYCLE) {
|
|
|
|
report_alarm_message(ALARM_ABORT_CYCLE);
|
|
|
|
} else if (rt_exec & EXEC_ALARM_PROBE_FAIL) {
|
|
|
|
report_alarm_message(ALARM_PROBE_FAIL);
|
|
|
|
}
|
|
|
|
// Halt everything upon a critical event flag. Currently hard and soft limits flag this.
|
|
|
|
if (rt_exec & EXEC_CRITICAL_EVENT) {
|
|
|
|
report_feedback_message(MESSAGE_CRITICAL_EVENT);
|
|
|
|
bit_false_atomic(sys.rt_exec_state,EXEC_RESET); // Disable any existing reset
|
|
|
|
do {
|
|
|
|
// Nothing. Block EVERYTHING until user issues reset or power cycles. Hard limits
|
|
|
|
// typically occur while unattended or not paying attention. Gives the user time
|
|
|
|
// to do what is needed before resetting, like killing the incoming stream. The
|
|
|
|
// same could be said about soft limits. While the position is not lost, the incoming
|
|
|
|
// stream could be still engaged and cause a serious crash if it continues afterwards.
|
|
|
|
} while (bit_isfalse(sys.rt_exec_state,EXEC_RESET));
|
|
|
|
}
|
|
|
|
bit_false_atomic(sys.rt_exec_alarm,0xFF); // Clear all alarm flags
|
|
|
|
}
|
2014-02-09 18:46:34 +01:00
|
|
|
|
2015-01-15 06:14:52 +01:00
|
|
|
// Check amd execute realtime commands
|
|
|
|
rt_exec = sys.rt_exec_state; // Copy volatile sys.rt_exec_state.
|
|
|
|
if (rt_exec) { // Enter only if any bit flag is true
|
2014-02-09 18:46:34 +01:00
|
|
|
// Execute system abort.
|
|
|
|
if (rt_exec & EXEC_RESET) {
|
|
|
|
sys.abort = true; // Only place this is set true.
|
|
|
|
return; // Nothing else to do but exit.
|
|
|
|
}
|
|
|
|
|
|
|
|
// Execute and serial print status
|
|
|
|
if (rt_exec & EXEC_STATUS_REPORT) {
|
|
|
|
report_realtime_status();
|
2015-01-15 06:14:52 +01:00
|
|
|
bit_false_atomic(sys.rt_exec_state,EXEC_STATUS_REPORT);
|
2014-02-09 18:46:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Execute a feed hold with deceleration, only during cycle.
|
|
|
|
if (rt_exec & EXEC_FEED_HOLD) {
|
|
|
|
// !!! During a cycle, the segment buffer has just been reloaded and full. So the math involved
|
|
|
|
// with the feed hold should be fine for most, if not all, operational scenarios.
|
|
|
|
if (sys.state == STATE_CYCLE) {
|
|
|
|
sys.state = STATE_HOLD;
|
|
|
|
st_update_plan_block_parameters();
|
|
|
|
st_prep_buffer();
|
|
|
|
sys.auto_start = false; // Disable planner auto start upon feed hold.
|
|
|
|
}
|
2015-01-15 06:14:52 +01:00
|
|
|
bit_false_atomic(sys.rt_exec_state,EXEC_FEED_HOLD);
|
2014-02-09 18:46:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Execute a cycle start by starting the stepper interrupt begin executing the blocks in queue.
|
|
|
|
if (rt_exec & EXEC_CYCLE_START) {
|
|
|
|
if (sys.state == STATE_QUEUED) {
|
|
|
|
sys.state = STATE_CYCLE;
|
|
|
|
st_prep_buffer(); // Initialize step segment buffer before beginning cycle.
|
|
|
|
st_wake_up();
|
|
|
|
if (bit_istrue(settings.flags,BITFLAG_AUTO_START)) {
|
|
|
|
sys.auto_start = true; // Re-enable auto start after feed hold.
|
|
|
|
} else {
|
|
|
|
sys.auto_start = false; // Reset auto start per settings.
|
|
|
|
}
|
|
|
|
}
|
2015-01-15 06:14:52 +01:00
|
|
|
bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_START);
|
2014-02-09 18:46:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Reinitializes the cycle plan and stepper system after a feed hold for a resume. Called by
|
2015-01-15 06:14:52 +01:00
|
|
|
// realtime command execution in the main program, ensuring that the planner re-plans safely.
|
2014-02-09 18:46:34 +01:00
|
|
|
// NOTE: Bresenham algorithm variables are still maintained through both the planner and stepper
|
|
|
|
// cycle reinitializations. The stepper path should continue exactly as if nothing has happened.
|
|
|
|
// NOTE: EXEC_CYCLE_STOP is set by the stepper subsystem when a cycle or feed hold completes.
|
|
|
|
if (rt_exec & EXEC_CYCLE_STOP) {
|
2014-02-15 21:13:46 +01:00
|
|
|
if ( plan_get_current_block() ) { sys.state = STATE_QUEUED; }
|
|
|
|
else { sys.state = STATE_IDLE; }
|
2015-01-15 06:14:52 +01:00
|
|
|
bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_STOP);
|
2014-02-09 18:46:34 +01:00
|
|
|
}
|
|
|
|
}
|
2015-01-15 06:14:52 +01:00
|
|
|
|
2014-02-09 18:46:34 +01:00
|
|
|
// Overrides flag byte (sys.override) and execution should be installed here, since they
|
2015-01-15 06:14:52 +01:00
|
|
|
// are realtime and require a direct and controlled interface to the main stepper program.
|
2014-02-09 18:46:34 +01:00
|
|
|
|
|
|
|
// Reload step segment buffer
|
|
|
|
if (sys.state & (STATE_CYCLE | STATE_HOLD | STATE_HOMING)) { st_prep_buffer(); }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Block until all buffered steps are executed or in a cycle state. Works with feed hold
|
|
|
|
// during a synchronize call, if it should happen. Also, waits for clean cycle end.
|
|
|
|
void protocol_buffer_synchronize()
|
|
|
|
{
|
Probing cycle and view build info bug fixes.
- Probing cycle would drop into a QUEUED state, if multiple G38.2 are
sent. It would not honor the auto cycle start flags. To fix, the auto
cycle start state is saved at the beginning of the probing cycle and
restored at the end, since the feed hold it uses to stop a triggered
probe will disable the auto start flag. For now it’s a patch, rather
than a permanent fix.
- protocol_buffer_synchronize() also has a failure case. Auto cycle
start does not get executed when the system is waiting in here, so if
it’s in a QUEUED state already, it won’t resume. Patched here, but not
fully resolved.
- Fixed a problem with the “view build info” command. The EEPROM write
would do weird things and corrupt the EEPROM. Not sure exactly what
caused it, but it’s likely a compiler problem with an improperly
defined EEPROM address. It didn’t have enough room to store a full
string. To fix, the build info EEPROM range was increased and the max
number of STARTUP_BLOCKS was reduced to 2 from 3.
- Lastly, when a $I view build info is used for the first time, it
would normally show an EEPROM read error, since it wasn’t cleared or
wasn’t therein the first place. It will now not show that error. A
patch rather than a permanent fix again.
2014-08-04 05:10:27 +02:00
|
|
|
// If system is queued, ensure cycle resumes if the auto start flag is present.
|
|
|
|
protocol_auto_cycle_start();
|
2014-02-09 18:46:34 +01:00
|
|
|
// Check and set auto start to resume cycle after synchronize and caller completes.
|
|
|
|
if (sys.state == STATE_CYCLE) { sys.auto_start = true; }
|
|
|
|
while (plan_get_current_block() || (sys.state == STATE_CYCLE)) {
|
2015-01-15 06:14:52 +01:00
|
|
|
protocol_execute_realtime(); // Check and execute run-time commands
|
2014-02-09 18:46:34 +01:00
|
|
|
if (sys.abort) { return; } // Check for system abort
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Auto-cycle start has two purposes: 1. Resumes a plan_synchronize() call from a function that
|
|
|
|
// requires the planner buffer to empty (spindle enable, dwell, etc.) 2. As a user setting that
|
|
|
|
// automatically begins the cycle when a user enters a valid motion command manually. This is
|
|
|
|
// intended as a beginners feature to help new users to understand g-code. It can be disabled
|
|
|
|
// as a beginner tool, but (1.) still operates. If disabled, the operation of cycle start is
|
|
|
|
// manually issuing a cycle start command whenever the user is ready and there is a valid motion
|
|
|
|
// command in the planner queue.
|
|
|
|
// NOTE: This function is called from the main loop and mc_line() only and executes when one of
|
|
|
|
// two conditions exist respectively: There are no more blocks sent (i.e. streaming is finished,
|
|
|
|
// single commands), or the planner buffer is full and ready to go.
|
2015-01-15 06:14:52 +01:00
|
|
|
void protocol_auto_cycle_start() { if (sys.auto_start) { bit_true_atomic(sys.rt_exec_state, EXEC_CYCLE_START); } }
|