2012-11-01 16:37:27 +01:00
|
|
|
/*
|
|
|
|
report.h - reporting and messaging methods
|
2015-02-16 01:36:08 +01:00
|
|
|
Part of Grbl
|
2012-11-01 16:37:27 +01:00
|
|
|
|
2015-01-15 06:14:52 +01:00
|
|
|
Copyright (c) 2012-2015 Sungeun K. Jeon
|
2012-11-01 16:37:27 +01:00
|
|
|
|
|
|
|
Grbl is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Grbl is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef report_h
|
|
|
|
#define report_h
|
|
|
|
|
|
|
|
// Define Grbl status codes.
|
|
|
|
#define STATUS_OK 0
|
2014-05-26 00:05:28 +02:00
|
|
|
#define STATUS_EXPECTED_COMMAND_LETTER 1
|
|
|
|
#define STATUS_BAD_NUMBER_FORMAT 2
|
|
|
|
#define STATUS_INVALID_STATEMENT 3
|
|
|
|
#define STATUS_NEGATIVE_VALUE 4
|
|
|
|
#define STATUS_SETTING_DISABLED 5
|
|
|
|
#define STATUS_SETTING_STEP_PULSE_MIN 6
|
|
|
|
#define STATUS_SETTING_READ_FAIL 7
|
|
|
|
#define STATUS_IDLE_ERROR 8
|
|
|
|
#define STATUS_ALARM_LOCK 9
|
|
|
|
#define STATUS_SOFT_LIMIT_ERROR 10
|
|
|
|
#define STATUS_OVERFLOW 11
|
2015-02-25 16:29:56 +01:00
|
|
|
#define STATUS_MAX_STEP_RATE_EXCEEDED 12
|
2014-05-26 00:05:28 +02:00
|
|
|
|
|
|
|
#define STATUS_GCODE_UNSUPPORTED_COMMAND 20
|
|
|
|
#define STATUS_GCODE_MODAL_GROUP_VIOLATION 21
|
|
|
|
#define STATUS_GCODE_UNDEFINED_FEED_RATE 22
|
|
|
|
#define STATUS_GCODE_COMMAND_VALUE_NOT_INTEGER 23
|
|
|
|
#define STATUS_GCODE_AXIS_COMMAND_CONFLICT 24
|
|
|
|
#define STATUS_GCODE_WORD_REPEATED 25
|
|
|
|
#define STATUS_GCODE_NO_AXIS_WORDS 26
|
|
|
|
#define STATUS_GCODE_INVALID_LINE_NUMBER 27
|
|
|
|
#define STATUS_GCODE_VALUE_WORD_MISSING 28
|
|
|
|
#define STATUS_GCODE_UNSUPPORTED_COORD_SYS 29
|
|
|
|
#define STATUS_GCODE_G53_INVALID_MOTION_MODE 30
|
|
|
|
#define STATUS_GCODE_AXIS_WORDS_EXIST 31
|
|
|
|
#define STATUS_GCODE_NO_AXIS_WORDS_IN_PLANE 32
|
|
|
|
#define STATUS_GCODE_INVALID_TARGET 33
|
|
|
|
#define STATUS_GCODE_ARC_RADIUS_ERROR 34
|
|
|
|
#define STATUS_GCODE_NO_OFFSETS_IN_PLANE 35
|
2014-08-01 16:29:35 +02:00
|
|
|
#define STATUS_GCODE_UNUSED_WORDS 36
|
|
|
|
#define STATUS_GCODE_G43_DYNAMIC_AXIS_ERROR 37
|
2012-11-15 01:36:29 +01:00
|
|
|
|
2015-02-25 16:29:56 +01:00
|
|
|
// Define Grbl alarm codes.
|
|
|
|
#define ALARM_HARD_LIMIT_ERROR 1
|
|
|
|
#define ALARM_SOFT_LIMIT_ERROR 2
|
|
|
|
#define ALARM_ABORT_CYCLE 3
|
|
|
|
#define ALARM_PROBE_FAIL 4
|
|
|
|
#define ALARM_HOMING_FAIL 5
|
2012-11-15 01:36:29 +01:00
|
|
|
|
|
|
|
// Define Grbl feedback message codes.
|
|
|
|
#define MESSAGE_CRITICAL_EVENT 1
|
|
|
|
#define MESSAGE_ALARM_LOCK 2
|
|
|
|
#define MESSAGE_ALARM_UNLOCK 3
|
|
|
|
#define MESSAGE_ENABLED 4
|
|
|
|
#define MESSAGE_DISABLED 5
|
2015-02-12 05:19:00 +01:00
|
|
|
#define MESSAGE_SAFETY_DOOR_AJAR 6
|
Critical M0/2/30 fix. Homing updates.
- Critical fix for M0 program pause. Due to its recent change, it would
cause Grbl to suspend but wouldn’t notify the user of why Grbl was not
doing anything. The state would show IDLE and a cycle start would
resume it. Grbl now enters a HOLD state to better indicate the state
change.
- Critical fix for M2 and M30 program end. As with M0, the state
previously would show IDLE while suspended. Grbl now does not suspend
upon program end and leaves job control to the GUI. Grbl simply reports
a `[Pgm End]` as a feedback message and resets certain g-code modes.
- M2/30 g-code reseting fix. Previously Grbl would soft-reset after an
M2/30, but this was not complaint to the (linuxcnc) g-code standard. It
simply resets [G1,G17,G90,G94,G40,G54,M5,M9,M48] and keeps all other
modes the same.
- M0/M2/M30 check-mode fix. It now does not suspend the machine during
check-mode.
- Minor bug fix related to commands similar to G90.1, but not G90.1,
not reporting an unsupported command.
- Homing cycle refactoring. To help reduce the chance of users
misunderstanding their limit switch wiring, Grbl only moves a short
distance for the locate cycles only. In addition, the homing cycle
pulls-off the limit switch by the pull-off distance to re-engage and
locate home. This should improve its accuracy.
- HOMING_FORCE_ORIGIN now sets the origin to the pull-off location,
rather than where the limit switch was triggered.
- Updated default junction deviation to 0.01mm. Recent tests showed
that this improves Grbl’s cornering behavior a bit.
- Added the ShapeOko3 defaults.
- Added new feedback message `[Pgm End]` for M2/30 notification.
- Limit pin reporting is now a $10 status report option. Requested by
OEMs to help simplify support troubleshooting.
2015-05-17 21:25:36 +02:00
|
|
|
#define MESSAGE_PROGRAM_END 7
|
2012-11-01 16:37:27 +01:00
|
|
|
|
|
|
|
// Prints system status messages.
|
|
|
|
void report_status_message(uint8_t status_code);
|
|
|
|
|
2012-11-15 01:36:29 +01:00
|
|
|
// Prints system alarm messages.
|
|
|
|
void report_alarm_message(int8_t alarm_code);
|
|
|
|
|
2012-11-01 16:37:27 +01:00
|
|
|
// Prints miscellaneous feedback messages.
|
2012-11-15 01:36:29 +01:00
|
|
|
void report_feedback_message(uint8_t message_code);
|
2012-11-01 16:37:27 +01:00
|
|
|
|
|
|
|
// Prints welcome message
|
|
|
|
void report_init_message();
|
|
|
|
|
|
|
|
// Prints Grbl help and current global settings
|
|
|
|
void report_grbl_help();
|
|
|
|
|
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 18:32:23 +01:00
|
|
|
// Prints Grbl global settings
|
2012-11-02 02:48:55 +01:00
|
|
|
void report_grbl_settings();
|
|
|
|
|
2015-03-28 01:13:18 +01:00
|
|
|
// Prints an echo of the pre-parsed line received right before execution.
|
|
|
|
void report_echo_line_received(char *line);
|
|
|
|
|
2012-11-01 16:37:27 +01:00
|
|
|
// Prints realtime status report
|
|
|
|
void report_realtime_status();
|
|
|
|
|
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 06:03:26 +01:00
|
|
|
// Prints recorded probe position
|
|
|
|
void report_probe_parameters();
|
2014-02-25 21:19:52 +01: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 06:03:26 +01:00
|
|
|
// Prints Grbl NGC parameters (coordinate offsets, probe)
|
|
|
|
void report_ngc_parameters();
|
2012-11-02 02:48:55 +01:00
|
|
|
|
2012-11-16 05:53:11 +01:00
|
|
|
// Prints current g-code parser mode state
|
2012-11-02 02:48:55 +01:00
|
|
|
void report_gcode_modes();
|
|
|
|
|
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 18:32:23 +01:00
|
|
|
// Prints startup line
|
|
|
|
void report_startup_line(uint8_t n, char *line);
|
|
|
|
|
2014-01-05 18:27:34 +01:00
|
|
|
// Prints build info and user info
|
|
|
|
void report_build_info(char *line);
|
|
|
|
|
2012-11-01 16:37:27 +01:00
|
|
|
#endif
|