grbl/report.c

390 wiersze
17 KiB
C
Czysty Zwykły widok Historia

/*
report.c - reporting and messaging methods
Part of Grbl
Copyright (c) 2012-2014 Sungeun K. Jeon
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/>.
*/
/*
This file functions as the primary feedback interface for Grbl. Any outgoing data, such
as the protocol status messages, feedback messages, and status reports, are stored here.
For the most part, these functions primarily are called from protocol.c methods. If a
different style feedback is desired (i.e. JSON), then a user can change these following
methods to accomodate their needs.
*/
Lots of re-organization and cleaning-up. Some bug fixes. - Added a new source and header file called system. These files contain the system commands and variables, as well as all of the system headers and standard libraries Grbl uses. Centralizing some of the code. - Re-organized the include headers throughout the source code. - ENABLE_M7 define was missing from config.h. Now there. - SPINDLE_MAX_RPM and SPINDLE_MIN_RPM now defined in config.h. No uncommenting to prevent user issues. Minimum spindle RPM now provides the lower, near 0V, scale adjustment, i.e. some spindles can go really slow so why use up our 256 voltage bins for them? - Remove some persistent variables from coolant and spindle control. They were redundant. - Removed a VARIABLE_SPINDLE define in cpu_map.h that shouldn’t have been there. - Changed the DEFAULT_ARC_TOLERANCE to 0.002mm to improve arc tracing. Before we had issues with performance, no longer. - Fixed a bug with the hard limits and the software debounce feature enabled. The invert limit pin setting wasn’t honored. - Fixed a bug with the homing direction mask. Now is like it used to be. At least for now. - Re-organized main.c to serve as only as the reset/initialization routine. Makes things a little bit clearer in terms of execution procedures. - Re-organized protocol.c as the overall master control unit for execution procedures. Not quite there yet, but starting to make a little more sense in how things are run. - Removed updating of old settings records. So many new settings have been added that it’s not worth adding the code to migrate old user settings. - Tweaked spindle_control.c a bit and made it more clear and consistent with other parts of Grbl. - Tweaked the stepper disable bit code in stepper.c. Requires less flash memory.
2014-01-11 03:22:10 +00:00
#include "system.h"
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
#include "report.h"
#include "print.h"
#include "settings.h"
#include "gcode.h"
#include "coolant_control.h"
2014-02-06 23:10:27 +00:00
#include "planner.h"
#include "spindle_control.h"
// Handles the primary confirmation protocol response for streaming interfaces and human-feedback.
// For every incoming line, this method responds with an 'ok' for a successful command or an
// 'error:' to indicate some error event with the line or some critical system error during
// operation. Errors events can originate from the g-code parser, settings module, or asynchronously
// from a critical error, such as a triggered hard limit. Interface should always monitor for these
// responses.
// NOTE: In silent mode, all error codes are greater than zero.
// TODO: Install silent mode to return only numeric values, primarily for GUIs.
void report_status_message(uint8_t status_code)
{
if (status_code == 0) { // STATUS_OK
printPgmString(PSTR("ok\r\n"));
} else {
printPgmString(PSTR("error: "));
switch(status_code) {
case STATUS_EXPECTED_COMMAND_LETTER:
printPgmString(PSTR("Expected command letter")); break;
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
case STATUS_BAD_NUMBER_FORMAT:
printPgmString(PSTR("Bad number format")); break;
case STATUS_INVALID_STATEMENT:
printPgmString(PSTR("Invalid statement")); break;
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
case STATUS_NEGATIVE_VALUE:
printPgmString(PSTR("Value < 0")); break;
case STATUS_SETTING_DISABLED:
printPgmString(PSTR("Setting disabled")); break;
case STATUS_SETTING_STEP_PULSE_MIN:
printPgmString(PSTR("Value < 3 usec")); break;
case STATUS_SETTING_READ_FAIL:
printPgmString(PSTR("EEPROM read fail. Using defaults")); break;
case STATUS_IDLE_ERROR:
printPgmString(PSTR("Not idle")); break;
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
case STATUS_ALARM_LOCK:
printPgmString(PSTR("Alarm lock")); break;
case STATUS_SOFT_LIMIT_ERROR:
printPgmString(PSTR("Homing not enabled")); break;
case STATUS_OVERFLOW:
printPgmString(PSTR("Line overflow")); break;
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
// Common g-code parser errors.
case STATUS_GCODE_MODAL_GROUP_VIOLATION:
printPgmString(PSTR("Modal group violation")); break;
case STATUS_GCODE_UNSUPPORTED_COMMAND:
printPgmString(PSTR("Unsupported command")); break;
case STATUS_GCODE_UNDEFINED_FEED_RATE:
printPgmString(PSTR("Undefined feed rate")); break;
default:
// Remaining g-code parser errors with error codes
printPgmString(PSTR("Invalid gcode ID:"));
print_uint8_base10(status_code); // Print error code for user reference
}
printPgmString(PSTR("\r\n"));
}
}
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
// Prints alarm messages.
void report_alarm_message(int8_t alarm_code)
{
printPgmString(PSTR("ALARM: "));
switch (alarm_code) {
case ALARM_LIMIT_ERROR:
printPgmString(PSTR("Hard/soft limit")); break;
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
case ALARM_ABORT_CYCLE:
printPgmString(PSTR("Abort during cycle")); break;
G38.2 probe feature rough draft installed. Working but needs testing. - G38.2 straight probe now supported. Rough draft. May be tweaked more as testing ramps up. - G38.2 requires at least one axis word. Multiple axis words work too. When commanded, the probe cycle will move at the last ‘F’ feed rate specified in a straight line. - During a probe cycle: If the probe pin goes low (normal high), Grbl will record that immediate position and engage a feed hold. Meaning that the CNC machine will move a little past the probe switch point, so keep federates low to stop sooner. Once stopped, Grbl will issue a move to go back to the recorded probe trigger point. - During a probe cycle: If the probe switch does not engage by the time the machine has traveled to its target coordinates, Grbl will issue an ALARM and the user will be forced to reset Grbl. (Currently G38.3 probe without error isn’t supported, but would be easy to implement later.) - After a successful probe, Grbl will send a feedback message containing the recorded probe coordinates in the machine coordinate system. This is as the g-code standard on probe parameters specifies. - The recorded probe parameters are retained in Grbl memory and can be viewed with the ‘$#’ print parameters command. Upon a power-cycle, not a soft-reset, Grbl will re-zero these values. - Moved ‘$#’ command to require IDLE or ALARM mode, because it accesses EEPROM to fetch the coordinate system offsets. - Updated the Grbl version to v0.9d. - The probe cycle is subject to change upon testing or user-feedback.
2014-03-01 05:03:26 +00:00
case ALARM_PROBE_FAIL:
printPgmString(PSTR("Probe fail")); break;
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
}
G38.2 probe feature rough draft installed. Working but needs testing. - G38.2 straight probe now supported. Rough draft. May be tweaked more as testing ramps up. - G38.2 requires at least one axis word. Multiple axis words work too. When commanded, the probe cycle will move at the last ‘F’ feed rate specified in a straight line. - During a probe cycle: If the probe pin goes low (normal high), Grbl will record that immediate position and engage a feed hold. Meaning that the CNC machine will move a little past the probe switch point, so keep federates low to stop sooner. Once stopped, Grbl will issue a move to go back to the recorded probe trigger point. - During a probe cycle: If the probe switch does not engage by the time the machine has traveled to its target coordinates, Grbl will issue an ALARM and the user will be forced to reset Grbl. (Currently G38.3 probe without error isn’t supported, but would be easy to implement later.) - After a successful probe, Grbl will send a feedback message containing the recorded probe coordinates in the machine coordinate system. This is as the g-code standard on probe parameters specifies. - The recorded probe parameters are retained in Grbl memory and can be viewed with the ‘$#’ print parameters command. Upon a power-cycle, not a soft-reset, Grbl will re-zero these values. - Moved ‘$#’ command to require IDLE or ALARM mode, because it accesses EEPROM to fetch the coordinate system offsets. - Updated the Grbl version to v0.9d. - The probe cycle is subject to change upon testing or user-feedback.
2014-03-01 05:03:26 +00:00
printPgmString(PSTR("\r\n"));
delay_ms(500); // Force delay to ensure message clears serial write buffer.
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
}
// Prints feedback messages. This serves as a centralized method to provide additional
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
// user feedback for things that are not of the status/alarm message protocol. These are
// messages such as setup warnings, switch toggling, and how to exit alarms.
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
// NOTE: For interfaces, messages are always placed within brackets. And if silent mode
// is installed, the message number codes are less than zero.
// TODO: Install silence feedback messages option in settings
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
void report_feedback_message(uint8_t message_code)
{
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
printPgmString(PSTR("["));
switch(message_code) {
case MESSAGE_CRITICAL_EVENT:
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
printPgmString(PSTR("Reset to continue")); break;
case MESSAGE_ALARM_LOCK:
printPgmString(PSTR("'$H'|'$X' to unlock")); break;
case MESSAGE_ALARM_UNLOCK:
printPgmString(PSTR("Caution: Unlocked")); break;
case MESSAGE_ENABLED:
printPgmString(PSTR("Enabled")); break;
case MESSAGE_DISABLED:
printPgmString(PSTR("Disabled")); break;
}
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
printPgmString(PSTR("]\r\n"));
}
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
// Welcome message
void report_init_message()
{
printPgmString(PSTR("\r\nGrbl " GRBL_VERSION " ['$' for help]\r\n"));
}
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
// Grbl help message
void report_grbl_help() {
printPgmString(PSTR("$$ (view Grbl settings)\r\n"
"$# (view # parameters)\r\n"
"$G (view parser state)\r\n"
"$N (view startup blocks)\r\n"
"$x=value (save Grbl setting)\r\n"
"$Nx=line (save startup block)\r\n"
"$C (check gcode mode)\r\n"
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
"$X (kill alarm lock)\r\n"
"$H (run homing cycle)\r\n"
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
"~ (cycle start)\r\n"
"! (feed hold)\r\n"
"? (current status)\r\n"
"ctrl-x (reset Grbl)\r\n"));
}
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
// Grbl global settings print out.
// NOTE: The numbering scheme here must correlate to storing in settings.c
void report_grbl_settings() {
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
printPgmString(PSTR("$0=")); printFloat(settings.steps_per_mm[X_AXIS]);
printPgmString(PSTR(" (x, step/mm)\r\n$1=")); printFloat(settings.steps_per_mm[Y_AXIS]);
printPgmString(PSTR(" (y, step/mm)\r\n$2=")); printFloat(settings.steps_per_mm[Z_AXIS]);
printPgmString(PSTR(" (z, step/mm)\r\n$3=")); printFloat(settings.max_rate[X_AXIS]);
printPgmString(PSTR(" (x max rate, mm/min)\r\n$4=")); printFloat(settings.max_rate[Y_AXIS]);
printPgmString(PSTR(" (y max rate, mm/min)\r\n$5=")); printFloat(settings.max_rate[Z_AXIS]);
printPgmString(PSTR(" (z max rate, mm/min)\r\n$6=")); printFloat(settings.acceleration[X_AXIS]/(60*60)); // Convert from mm/min^2 for human readability
printPgmString(PSTR(" (x accel, mm/sec^2)\r\n$7=")); printFloat(settings.acceleration[Y_AXIS]/(60*60)); // Convert from mm/min^2 for human readability
printPgmString(PSTR(" (y accel, mm/sec^2)\r\n$8=")); printFloat(settings.acceleration[Z_AXIS]/(60*60)); // Convert from mm/min^2 for human readability
printPgmString(PSTR(" (z accel, mm/sec^2)\r\n$9=")); printFloat(-settings.max_travel[X_AXIS]); // Grbl internally store this as negative.
printPgmString(PSTR(" (x max travel, mm)\r\n$10=")); printFloat(-settings.max_travel[Y_AXIS]); // Grbl internally store this as negative.
printPgmString(PSTR(" (y max travel, mm)\r\n$11=")); printFloat(-settings.max_travel[Z_AXIS]); // Grbl internally store this as negative.
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
printPgmString(PSTR(" (z max travel, mm)\r\n$12=")); print_uint8_base10(settings.pulse_microseconds);
printPgmString(PSTR(" (step pulse, usec)\r\n$13=")); print_uint8_base10(settings.step_invert_mask);
Lots of re-organization and cleaning-up. Some bug fixes. - Added a new source and header file called system. These files contain the system commands and variables, as well as all of the system headers and standard libraries Grbl uses. Centralizing some of the code. - Re-organized the include headers throughout the source code. - ENABLE_M7 define was missing from config.h. Now there. - SPINDLE_MAX_RPM and SPINDLE_MIN_RPM now defined in config.h. No uncommenting to prevent user issues. Minimum spindle RPM now provides the lower, near 0V, scale adjustment, i.e. some spindles can go really slow so why use up our 256 voltage bins for them? - Remove some persistent variables from coolant and spindle control. They were redundant. - Removed a VARIABLE_SPINDLE define in cpu_map.h that shouldn’t have been there. - Changed the DEFAULT_ARC_TOLERANCE to 0.002mm to improve arc tracing. Before we had issues with performance, no longer. - Fixed a bug with the hard limits and the software debounce feature enabled. The invert limit pin setting wasn’t honored. - Fixed a bug with the homing direction mask. Now is like it used to be. At least for now. - Re-organized main.c to serve as only as the reset/initialization routine. Makes things a little bit clearer in terms of execution procedures. - Re-organized protocol.c as the overall master control unit for execution procedures. Not quite there yet, but starting to make a little more sense in how things are run. - Removed updating of old settings records. So many new settings have been added that it’s not worth adding the code to migrate old user settings. - Tweaked spindle_control.c a bit and made it more clear and consistent with other parts of Grbl. - Tweaked the stepper disable bit code in stepper.c. Requires less flash memory.
2014-01-11 03:22:10 +00:00
printPgmString(PSTR(" (step port invert mask:")); print_uint8_base2(settings.step_invert_mask);
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
printPgmString(PSTR(")\r\n$14=")); print_uint8_base10(settings.dir_invert_mask);
Lots of re-organization and cleaning-up. Some bug fixes. - Added a new source and header file called system. These files contain the system commands and variables, as well as all of the system headers and standard libraries Grbl uses. Centralizing some of the code. - Re-organized the include headers throughout the source code. - ENABLE_M7 define was missing from config.h. Now there. - SPINDLE_MAX_RPM and SPINDLE_MIN_RPM now defined in config.h. No uncommenting to prevent user issues. Minimum spindle RPM now provides the lower, near 0V, scale adjustment, i.e. some spindles can go really slow so why use up our 256 voltage bins for them? - Remove some persistent variables from coolant and spindle control. They were redundant. - Removed a VARIABLE_SPINDLE define in cpu_map.h that shouldn’t have been there. - Changed the DEFAULT_ARC_TOLERANCE to 0.002mm to improve arc tracing. Before we had issues with performance, no longer. - Fixed a bug with the hard limits and the software debounce feature enabled. The invert limit pin setting wasn’t honored. - Fixed a bug with the homing direction mask. Now is like it used to be. At least for now. - Re-organized main.c to serve as only as the reset/initialization routine. Makes things a little bit clearer in terms of execution procedures. - Re-organized protocol.c as the overall master control unit for execution procedures. Not quite there yet, but starting to make a little more sense in how things are run. - Removed updating of old settings records. So many new settings have been added that it’s not worth adding the code to migrate old user settings. - Tweaked spindle_control.c a bit and made it more clear and consistent with other parts of Grbl. - Tweaked the stepper disable bit code in stepper.c. Requires less flash memory.
2014-01-11 03:22:10 +00:00
printPgmString(PSTR(" (dir port invert mask:")); print_uint8_base2(settings.dir_invert_mask);
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
printPgmString(PSTR(")\r\n$15=")); print_uint8_base10(settings.stepper_idle_lock_time);
printPgmString(PSTR(" (step idle delay, msec)\r\n$16=")); printFloat(settings.junction_deviation);
printPgmString(PSTR(" (junction deviation, mm)\r\n$17=")); printFloat(settings.arc_tolerance);
printPgmString(PSTR(" (arc tolerance, mm)\r\n$18=")); print_uint8_base10(settings.decimal_places);
printPgmString(PSTR(" (n-decimals, int)\r\n$19=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_REPORT_INCHES));
printPgmString(PSTR(" (report inches, bool)\r\n$20=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_AUTO_START));
printPgmString(PSTR(" (auto start, bool)\r\n$21=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_INVERT_ST_ENABLE));
printPgmString(PSTR(" (invert step enable, bool)\r\n$22=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_INVERT_LIMIT_PINS));
printPgmString(PSTR(" (invert limit pins, bool)\r\n$23=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_SOFT_LIMIT_ENABLE));
printPgmString(PSTR(" (soft limits, bool)\r\n$24=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE));
printPgmString(PSTR(" (hard limits, bool)\r\n$25=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE));
printPgmString(PSTR(" (homing cycle, bool)\r\n$26=")); print_uint8_base10(settings.homing_dir_mask);
Lots of re-organization and cleaning-up. Some bug fixes. - Added a new source and header file called system. These files contain the system commands and variables, as well as all of the system headers and standard libraries Grbl uses. Centralizing some of the code. - Re-organized the include headers throughout the source code. - ENABLE_M7 define was missing from config.h. Now there. - SPINDLE_MAX_RPM and SPINDLE_MIN_RPM now defined in config.h. No uncommenting to prevent user issues. Minimum spindle RPM now provides the lower, near 0V, scale adjustment, i.e. some spindles can go really slow so why use up our 256 voltage bins for them? - Remove some persistent variables from coolant and spindle control. They were redundant. - Removed a VARIABLE_SPINDLE define in cpu_map.h that shouldn’t have been there. - Changed the DEFAULT_ARC_TOLERANCE to 0.002mm to improve arc tracing. Before we had issues with performance, no longer. - Fixed a bug with the hard limits and the software debounce feature enabled. The invert limit pin setting wasn’t honored. - Fixed a bug with the homing direction mask. Now is like it used to be. At least for now. - Re-organized main.c to serve as only as the reset/initialization routine. Makes things a little bit clearer in terms of execution procedures. - Re-organized protocol.c as the overall master control unit for execution procedures. Not quite there yet, but starting to make a little more sense in how things are run. - Removed updating of old settings records. So many new settings have been added that it’s not worth adding the code to migrate old user settings. - Tweaked spindle_control.c a bit and made it more clear and consistent with other parts of Grbl. - Tweaked the stepper disable bit code in stepper.c. Requires less flash memory.
2014-01-11 03:22:10 +00:00
printPgmString(PSTR(" (homing dir invert mask:")); print_uint8_base2(settings.homing_dir_mask);
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
printPgmString(PSTR(")\r\n$27=")); printFloat(settings.homing_feed_rate);
printPgmString(PSTR(" (homing feed, mm/min)\r\n$28=")); printFloat(settings.homing_seek_rate);
printPgmString(PSTR(" (homing seek, mm/min)\r\n$29=")); print_uint8_base10(settings.homing_debounce_delay);
printPgmString(PSTR(" (homing debounce, msec)\r\n$30=")); printFloat(settings.homing_pulloff);
printPgmString(PSTR(" (homing pull-off, mm)\r\n"));
}
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
G38.2 probe feature rough draft installed. Working but needs testing. - G38.2 straight probe now supported. Rough draft. May be tweaked more as testing ramps up. - G38.2 requires at least one axis word. Multiple axis words work too. When commanded, the probe cycle will move at the last ‘F’ feed rate specified in a straight line. - During a probe cycle: If the probe pin goes low (normal high), Grbl will record that immediate position and engage a feed hold. Meaning that the CNC machine will move a little past the probe switch point, so keep federates low to stop sooner. Once stopped, Grbl will issue a move to go back to the recorded probe trigger point. - During a probe cycle: If the probe switch does not engage by the time the machine has traveled to its target coordinates, Grbl will issue an ALARM and the user will be forced to reset Grbl. (Currently G38.3 probe without error isn’t supported, but would be easy to implement later.) - After a successful probe, Grbl will send a feedback message containing the recorded probe coordinates in the machine coordinate system. This is as the g-code standard on probe parameters specifies. - The recorded probe parameters are retained in Grbl memory and can be viewed with the ‘$#’ print parameters command. Upon a power-cycle, not a soft-reset, Grbl will re-zero these values. - Moved ‘$#’ command to require IDLE or ALARM mode, because it accesses EEPROM to fetch the coordinate system offsets. - Updated the Grbl version to v0.9d. - The probe cycle is subject to change upon testing or user-feedback.
2014-03-01 05:03:26 +00:00
// Prints current probe parameters. Upon a probe command, these parameters are updated upon a
// successful probe or upon a failed probe with the G38.3 without errors command (if supported).
// These values are retained until Grbl is power-cycled, whereby they will be re-zeroed.
void report_probe_parameters()
{
uint8_t i;
float print_position[N_AXIS];
// Report in terms of machine position.
printPgmString(PSTR("[Probe:"));
for (i=0; i< N_AXIS; i++) {
print_position[i] = sys.probe_position[i]/settings.steps_per_mm[i];
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) { print_position[i] *= INCH_PER_MM; }
printFloat(print_position[i]);
if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); }
}
printPgmString(PSTR("]\r\n"));
}
// Prints Grbl NGC parameters (coordinate offsets, probing)
void report_ngc_parameters()
{
float coord_data[N_AXIS];
uint8_t coord_select, i;
for (coord_select = 0; coord_select <= SETTING_INDEX_NCOORD; coord_select++) {
if (!(settings_read_coord_data(coord_select,coord_data))) {
report_status_message(STATUS_SETTING_READ_FAIL);
return;
}
printPgmString(PSTR("[G"));
switch (coord_select) {
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
case 6: printPgmString(PSTR("28")); break;
case 7: printPgmString(PSTR("30")); break;
default: print_uint8_base10(coord_select+54); break; // G54-G59
}
printPgmString(PSTR(":"));
for (i=0; i<N_AXIS; i++) {
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) { printFloat(coord_data[i]*INCH_PER_MM); }
else { printFloat(coord_data[i]); }
if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); }
else { printPgmString(PSTR("]\r\n")); }
}
}
printPgmString(PSTR("[G92:")); // Print G92,G92.1 which are not persistent in memory
for (i=0; i<N_AXIS; i++) {
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) { printFloat(gc_state.coord_offset[i]*INCH_PER_MM); }
else { printFloat(gc_state.coord_offset[i]); }
if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); }
else { printPgmString(PSTR("]\r\n")); }
}
G38.2 probe feature rough draft installed. Working but needs testing. - G38.2 straight probe now supported. Rough draft. May be tweaked more as testing ramps up. - G38.2 requires at least one axis word. Multiple axis words work too. When commanded, the probe cycle will move at the last ‘F’ feed rate specified in a straight line. - During a probe cycle: If the probe pin goes low (normal high), Grbl will record that immediate position and engage a feed hold. Meaning that the CNC machine will move a little past the probe switch point, so keep federates low to stop sooner. Once stopped, Grbl will issue a move to go back to the recorded probe trigger point. - During a probe cycle: If the probe switch does not engage by the time the machine has traveled to its target coordinates, Grbl will issue an ALARM and the user will be forced to reset Grbl. (Currently G38.3 probe without error isn’t supported, but would be easy to implement later.) - After a successful probe, Grbl will send a feedback message containing the recorded probe coordinates in the machine coordinate system. This is as the g-code standard on probe parameters specifies. - The recorded probe parameters are retained in Grbl memory and can be viewed with the ‘$#’ print parameters command. Upon a power-cycle, not a soft-reset, Grbl will re-zero these values. - Moved ‘$#’ command to require IDLE or ALARM mode, because it accesses EEPROM to fetch the coordinate system offsets. - Updated the Grbl version to v0.9d. - The probe cycle is subject to change upon testing or user-feedback.
2014-03-01 05:03:26 +00:00
report_probe_parameters(); // Print probe parameters. Not persistent in memory.
}
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
// Print current gcode parser mode state
void report_gcode_modes()
{
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
switch (gc_state.modal.motion) {
case MOTION_MODE_SEEK : printPgmString(PSTR("[G0")); break;
case MOTION_MODE_LINEAR : printPgmString(PSTR("[G1")); break;
case MOTION_MODE_CW_ARC : printPgmString(PSTR("[G2")); break;
case MOTION_MODE_CCW_ARC : printPgmString(PSTR("[G3")); break;
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
case MOTION_MODE_NONE : printPgmString(PSTR("[G80")); break;
}
printPgmString(PSTR(" G"));
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
print_uint8_base10(gc_state.modal.coord_select+54);
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
switch (gc_state.modal.plane_select) {
case PLANE_SELECT_XY : printPgmString(PSTR(" G17")); break;
case PLANE_SELECT_ZX : printPgmString(PSTR(" G18")); break;
case PLANE_SELECT_YZ : printPgmString(PSTR(" G19")); break;
}
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
if (gc_state.modal.units == UNITS_MODE_MM) { printPgmString(PSTR(" G21")); }
else { printPgmString(PSTR(" G20")); }
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
if (gc_state.modal.distance == DISTANCE_MODE_ABSOLUTE) { printPgmString(PSTR(" G90")); }
else { printPgmString(PSTR(" G91")); }
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
if (gc_state.modal.feed_rate == FEED_RATE_MODE_INVERSE_TIME) { printPgmString(PSTR(" G93")); }
else { printPgmString(PSTR(" G94")); }
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
switch (gc_state.modal.program_flow) {
case PROGRAM_FLOW_RUNNING : printPgmString(PSTR(" M0")); break;
case PROGRAM_FLOW_PAUSED : printPgmString(PSTR(" M1")); break;
case PROGRAM_FLOW_COMPLETED : printPgmString(PSTR(" M2")); break;
}
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
switch (gc_state.modal.spindle) {
case SPINDLE_ENABLE_CW : printPgmString(PSTR(" M3")); break;
case SPINDLE_ENABLE_CCW : printPgmString(PSTR(" M4")); break;
case SPINDLE_DISABLE : printPgmString(PSTR(" M5")); break;
}
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
switch (gc_state.modal.coolant) {
case COOLANT_DISABLE : printPgmString(PSTR(" M9")); break;
case COOLANT_FLOOD_ENABLE : printPgmString(PSTR(" M8")); break;
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
#ifdef ENABLE_M7
case COOLANT_MIST_ENABLE : printPgmString(PSTR(" M7")); break;
#endif
}
printPgmString(PSTR(" T"));
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
print_uint8_base10(gc_state.tool);
printPgmString(PSTR(" F"));
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
printFloat(gc_state.feed_rate);
printPgmString(PSTR("]\r\n"));
}
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
// Prints specified startup line
void report_startup_line(uint8_t n, char *line)
{
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
printPgmString(PSTR("$N")); print_uint8_base10(n);
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
printPgmString(PSTR("=")); printString(line);
printPgmString(PSTR("\r\n"));
}
// Prints build info line
void report_build_info(char *line)
{
printPgmString(PSTR("[" GRBL_VERSION "." GRBL_VERSION_BUILD ":"));
printString(line);
printPgmString(PSTR("]\r\n"));
}
New startup script setting. New dry run, check gcode switches. New system state variable. Lots of reorganizing. (All v0.8 features installed. Still likely buggy, but now thourough testing will need to start to squash them all. As soon as we're done, this will be pushed to master and v0.9 development will be started. Please report ANY issues to us so we can get this rolled out ASAP.) - User startup script! A user can now save one (up to 5 as compile-time option) block of g-code in EEPROM memory. This will be run everytime Grbl resets. Mainly to be used as a way to set your preferences, like G21, G54, etc. - New dry run and check g-code switches. Dry run moves ALL motions at rapids rate ignoring spindle, coolant, and dwell commands. For rapid physical proofing of your code. The check g-code switch ignores all motion and provides the user a way to check if there are any errors in their program that Grbl may not like. - Program restart! (sort of). Program restart is typically an advanced feature that allows users to restart a program mid-stream. The check g-code switch can perform this feature by enabling the switch at the start of the program, and disabling it at the desired point with some minimal changes. - New system state variable. This state variable tracks all of the different state processes that Grbl performs, i.e. cycle start, feed hold, homing, etc. This is mainly for making managing of these task easier and more clear. - Position lost state variable. Only when homing is enabled, Grbl will refuse to move until homing is completed and position is known. This is mainly for safety. Otherwise, it will let users fend for themselves. - Moved the default settings defines into config.h. The plan is to eventually create a set of config.h's for particular as-built machines to help users from doing it themselves. - Moved around misc defines into .h files. And lots of other little things.
2012-11-03 17:32:23 +00:00
// Prints real-time data. This function grabs a real-time snapshot of the stepper subprogram
// and the actual location of the CNC machine. Users may change the following function to their
// specific needs, but the desired real-time data report must be as short as possible. This is
// requires as it minimizes the computational overhead and allows grbl to keep running smoothly,
// especially during g-code programs with fast, short line segments and high frequency reports (5-20Hz).
void report_realtime_status()
{
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
// **Under construction** Bare-bones status report. Provides real-time machine position relative to
// the system power on location (0,0,0) and work coordinate position (G54 and G92 applied). Eventually
// to be added are distance to go on block, processed block id, and feed rate. Also a settings bitmask
// for a user to select the desired real-time data.
uint8_t i;
2013-01-09 22:22:45 +00:00
int32_t current_position[N_AXIS]; // Copy current state of the system position variable
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
memcpy(current_position,sys.position,sizeof(sys.position));
2013-01-09 22:22:45 +00:00
float print_position[N_AXIS];
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
// Report current machine state
switch (sys.state) {
case STATE_IDLE: printPgmString(PSTR("<Idle")); break;
case STATE_QUEUED: printPgmString(PSTR("<Queue")); break;
case STATE_CYCLE: printPgmString(PSTR("<Run")); break;
case STATE_HOLD: printPgmString(PSTR("<Hold")); break;
case STATE_HOMING: printPgmString(PSTR("<Home")); break;
case STATE_ALARM: printPgmString(PSTR("<Alarm")); break;
case STATE_CHECK_MODE: printPgmString(PSTR("<Check")); break;
}
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
// Report machine position
printPgmString(PSTR(",MPos:"));
2013-01-09 22:22:45 +00:00
for (i=0; i< N_AXIS; i++) {
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
print_position[i] = current_position[i]/settings.steps_per_mm[i];
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) { print_position[i] *= INCH_PER_MM; }
printFloat(print_position[i]);
printPgmString(PSTR(","));
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
}
// Report work position
printPgmString(PSTR("WPos:"));
2013-01-09 22:22:45 +00:00
for (i=0; i< N_AXIS; i++) {
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) {
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
print_position[i] -= (gc_state.coord_system[i]+gc_state.coord_offset[i])*INCH_PER_MM;
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
} else {
Major g-code parser overhaul. 100%* compliant. Other related updates. - Completely overhauled the g-code parser. It’s now 100%* compliant. (* may have some bugs). Being compliant, here are some of the major differences. - SMALLER and JUST AS FAST! A number of optimizations were found that sped things up and allowed for the more thorough error-checking to be installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and still was able to make it significantly smaller than it was. - No default feed rate setting! Removed completely! This doesn’t exist in the g-code standard. So, it now errors out whenever it’s undefined for motions that require it (G1/2/3/38.2). - Any g-code parser error expunges the ENTIRE block. This means all information is lost and not passed on to the running state. Before some of the states would remain, which could have led to some problems. - If the g-code block passes all of the error-checks, the g-code state is updated and all motions are executed according to the order of execution. - Changes in spindle speed, when already running, will update the output pin accordingly. This fixes a bug, where it wouldn’t update the speed. - Update g-code parser error reporting. Errors now return detailed information of what exact went wrong. The most common errors return a short text description. For less common errors, the parser reports ‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs and their descriptions will be documented for user reference elsewhere to save flash space. - Other notable changes: - Added a print integer routine for uint8 variables. This saved significant flash space by switching from a heavier universal print integer routine. - Saved some flash space with our own short hypotenuse calculation - Some arc computation flash and memory optimizations.
2014-05-25 22:05:28 +00:00
print_position[i] -= gc_state.coord_system[i]+gc_state.coord_offset[i];
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
}
printFloat(print_position[i]);
if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); }
Re-factored system states and alarm management. Serial baud support greater than 57600. - Refactored system states to be more clear and concise. Alarm locks processes when position is unknown to indicate to user something has gone wrong. - Changed mc_alarm to mc_reset, which now manages the system reset function. Centralizes it. - Renamed '$X' kill homing lock to kill alarm lock. - Created an alarm error reporting method to clear up what is an alarm: message vs a status error: message. For GUIs mainly. Alarm codes are negative. Status codes are positive. - Serial baud support upto 115200. Previous baudrate calc was unstable for 57600 and above. - Alarm state locks out all g-code blocks, including startup scripts, but allows user to access settings and internal commands. For example, to disable hard limits, if they are problematic. - Hard limits do not respond in an alarm state. - Fixed a problem with the hard limit interrupt during the homing cycle. The interrupt register is still active during the homing cycle and still signal the interrupt to trigger when re-enabled. Instead, just disabled the register. - Homing rate adjusted. All axes move at homing seek rate, regardless of how many axes move at the same time. This is unlike how the stepper module does it as a point to point rate. - New config.h settings to disable the homing rate adjustment and the force homing upon powerup. - Reduced the number of startup lines back down to 2 from 3. This discourages users from placing motion block in there, which can be very dangerous. - Startup blocks now run only after an alarm-free reset or after a homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-15 00:36:29 +00:00
}
G38.2 probe feature rough draft installed. Working but needs testing. - G38.2 straight probe now supported. Rough draft. May be tweaked more as testing ramps up. - G38.2 requires at least one axis word. Multiple axis words work too. When commanded, the probe cycle will move at the last ‘F’ feed rate specified in a straight line. - During a probe cycle: If the probe pin goes low (normal high), Grbl will record that immediate position and engage a feed hold. Meaning that the CNC machine will move a little past the probe switch point, so keep federates low to stop sooner. Once stopped, Grbl will issue a move to go back to the recorded probe trigger point. - During a probe cycle: If the probe switch does not engage by the time the machine has traveled to its target coordinates, Grbl will issue an ALARM and the user will be forced to reset Grbl. (Currently G38.3 probe without error isn’t supported, but would be easy to implement later.) - After a successful probe, Grbl will send a feedback message containing the recorded probe coordinates in the machine coordinate system. This is as the g-code standard on probe parameters specifies. - The recorded probe parameters are retained in Grbl memory and can be viewed with the ‘$#’ print parameters command. Upon a power-cycle, not a soft-reset, Grbl will re-zero these values. - Moved ‘$#’ command to require IDLE or ALARM mode, because it accesses EEPROM to fetch the coordinate system offsets. - Updated the Grbl version to v0.9d. - The probe cycle is subject to change upon testing or user-feedback.
2014-03-01 05:03:26 +00:00
#ifdef USE_LINE_NUMBERS
// Report current line number
printPgmString(PSTR(",Ln:"));
int32_t ln=0;
plan_block_t * pb = plan_get_current_block();
if(pb != NULL) {
ln = pb->line_number;
}
printInteger(ln);
G38.2 probe feature rough draft installed. Working but needs testing. - G38.2 straight probe now supported. Rough draft. May be tweaked more as testing ramps up. - G38.2 requires at least one axis word. Multiple axis words work too. When commanded, the probe cycle will move at the last ‘F’ feed rate specified in a straight line. - During a probe cycle: If the probe pin goes low (normal high), Grbl will record that immediate position and engage a feed hold. Meaning that the CNC machine will move a little past the probe switch point, so keep federates low to stop sooner. Once stopped, Grbl will issue a move to go back to the recorded probe trigger point. - During a probe cycle: If the probe switch does not engage by the time the machine has traveled to its target coordinates, Grbl will issue an ALARM and the user will be forced to reset Grbl. (Currently G38.3 probe without error isn’t supported, but would be easy to implement later.) - After a successful probe, Grbl will send a feedback message containing the recorded probe coordinates in the machine coordinate system. This is as the g-code standard on probe parameters specifies. - The recorded probe parameters are retained in Grbl memory and can be viewed with the ‘$#’ print parameters command. Upon a power-cycle, not a soft-reset, Grbl will re-zero these values. - Moved ‘$#’ command to require IDLE or ALARM mode, because it accesses EEPROM to fetch the coordinate system offsets. - Updated the Grbl version to v0.9d. - The probe cycle is subject to change upon testing or user-feedback.
2014-03-01 05:03:26 +00:00
#endif
printPgmString(PSTR(">\r\n"));
}