Luigi Santivetti | 69972f9 | 2019-11-12 22:55:40 +0000 | [diff] [blame^] | 1 | /* |
| 2 | report.h - reporting and messaging methods |
| 3 | Part of Grbl |
| 4 | |
| 5 | Copyright (c) 2012-2016 Sungeun K. Jeon for Gnea Research LLC |
| 6 | |
| 7 | Grbl is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | Grbl is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with Grbl. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | #ifndef report_h |
| 21 | #define report_h |
| 22 | |
| 23 | // Define Grbl status codes. Valid values (0-255) |
| 24 | #define STATUS_OK 0 |
| 25 | #define STATUS_EXPECTED_COMMAND_LETTER 1 |
| 26 | #define STATUS_BAD_NUMBER_FORMAT 2 |
| 27 | #define STATUS_INVALID_STATEMENT 3 |
| 28 | #define STATUS_NEGATIVE_VALUE 4 |
| 29 | #define STATUS_SETTING_DISABLED 5 |
| 30 | #define STATUS_SETTING_STEP_PULSE_MIN 6 |
| 31 | #define STATUS_SETTING_READ_FAIL 7 |
| 32 | #define STATUS_IDLE_ERROR 8 |
| 33 | #define STATUS_SYSTEM_GC_LOCK 9 |
| 34 | #define STATUS_SOFT_LIMIT_ERROR 10 |
| 35 | #define STATUS_OVERFLOW 11 |
| 36 | #define STATUS_MAX_STEP_RATE_EXCEEDED 12 |
| 37 | #define STATUS_CHECK_DOOR 13 |
| 38 | #define STATUS_LINE_LENGTH_EXCEEDED 14 |
| 39 | #define STATUS_TRAVEL_EXCEEDED 15 |
| 40 | #define STATUS_INVALID_JOG_COMMAND 16 |
| 41 | #define STATUS_SETTING_DISABLED_LASER 17 |
| 42 | |
| 43 | #define STATUS_GCODE_UNSUPPORTED_COMMAND 20 |
| 44 | #define STATUS_GCODE_MODAL_GROUP_VIOLATION 21 |
| 45 | #define STATUS_GCODE_UNDEFINED_FEED_RATE 22 |
| 46 | #define STATUS_GCODE_COMMAND_VALUE_NOT_INTEGER 23 |
| 47 | #define STATUS_GCODE_AXIS_COMMAND_CONFLICT 24 |
| 48 | #define STATUS_GCODE_WORD_REPEATED 25 |
| 49 | #define STATUS_GCODE_NO_AXIS_WORDS 26 |
| 50 | #define STATUS_GCODE_INVALID_LINE_NUMBER 27 |
| 51 | #define STATUS_GCODE_VALUE_WORD_MISSING 28 |
| 52 | #define STATUS_GCODE_UNSUPPORTED_COORD_SYS 29 |
| 53 | #define STATUS_GCODE_G53_INVALID_MOTION_MODE 30 |
| 54 | #define STATUS_GCODE_AXIS_WORDS_EXIST 31 |
| 55 | #define STATUS_GCODE_NO_AXIS_WORDS_IN_PLANE 32 |
| 56 | #define STATUS_GCODE_INVALID_TARGET 33 |
| 57 | #define STATUS_GCODE_ARC_RADIUS_ERROR 34 |
| 58 | #define STATUS_GCODE_NO_OFFSETS_IN_PLANE 35 |
| 59 | #define STATUS_GCODE_UNUSED_WORDS 36 |
| 60 | #define STATUS_GCODE_G43_DYNAMIC_AXIS_ERROR 37 |
| 61 | #define STATUS_GCODE_MAX_VALUE_EXCEEDED 38 |
| 62 | |
| 63 | // Define Grbl alarm codes. Valid values (1-255). 0 is reserved. |
| 64 | #define ALARM_HARD_LIMIT_ERROR EXEC_ALARM_HARD_LIMIT |
| 65 | #define ALARM_SOFT_LIMIT_ERROR EXEC_ALARM_SOFT_LIMIT |
| 66 | #define ALARM_ABORT_CYCLE EXEC_ALARM_ABORT_CYCLE |
| 67 | #define ALARM_PROBE_FAIL_INITIAL EXEC_ALARM_PROBE_FAIL_INITIAL |
| 68 | #define ALARM_PROBE_FAIL_CONTACT EXEC_ALARM_PROBE_FAIL_CONTACT |
| 69 | #define ALARM_HOMING_FAIL_RESET EXEC_ALARM_HOMING_FAIL_RESET |
| 70 | #define ALARM_HOMING_FAIL_DOOR EXEC_ALARM_HOMING_FAIL_DOOR |
| 71 | #define ALARM_HOMING_FAIL_PULLOFF EXEC_ALARM_HOMING_FAIL_PULLOFF |
| 72 | #define ALARM_HOMING_FAIL_APPROACH EXEC_ALARM_HOMING_FAIL_APPROACH |
| 73 | |
| 74 | // Define Grbl feedback message codes. Valid values (0-255). |
| 75 | #define MESSAGE_CRITICAL_EVENT 1 |
| 76 | #define MESSAGE_ALARM_LOCK 2 |
| 77 | #define MESSAGE_ALARM_UNLOCK 3 |
| 78 | #define MESSAGE_ENABLED 4 |
| 79 | #define MESSAGE_DISABLED 5 |
| 80 | #define MESSAGE_SAFETY_DOOR_AJAR 6 |
| 81 | #define MESSAGE_CHECK_LIMITS 7 |
| 82 | #define MESSAGE_PROGRAM_END 8 |
| 83 | #define MESSAGE_RESTORE_DEFAULTS 9 |
| 84 | #define MESSAGE_SPINDLE_RESTORE 10 |
| 85 | #define MESSAGE_SLEEP_MODE 11 |
| 86 | |
| 87 | // Prints system status messages. |
| 88 | void report_status_message(uint8_t status_code); |
| 89 | |
| 90 | // Prints system alarm messages. |
| 91 | void report_alarm_message(uint8_t alarm_code); |
| 92 | |
| 93 | // Prints miscellaneous feedback messages. |
| 94 | void report_feedback_message(uint8_t message_code); |
| 95 | |
| 96 | // Prints welcome message |
| 97 | void report_init_message(); |
| 98 | |
| 99 | // Prints Grbl help and current global settings |
| 100 | void report_grbl_help(); |
| 101 | |
| 102 | // Prints Grbl global settings |
| 103 | void report_grbl_settings(); |
| 104 | |
| 105 | // Prints an echo of the pre-parsed line received right before execution. |
| 106 | void report_echo_line_received(char *line); |
| 107 | |
| 108 | // Prints realtime status report |
| 109 | void report_realtime_status(); |
| 110 | |
| 111 | // Prints recorded probe position |
| 112 | void report_probe_parameters(); |
| 113 | |
| 114 | // Prints Grbl NGC parameters (coordinate offsets, probe) |
| 115 | void report_ngc_parameters(); |
| 116 | |
| 117 | // Prints current g-code parser mode state |
| 118 | void report_gcode_modes(); |
| 119 | |
| 120 | // Prints startup line when requested and executed. |
| 121 | void report_startup_line(uint8_t n, char *line); |
| 122 | void report_execute_startup_message(char *line, uint8_t status_code); |
| 123 | |
| 124 | // Prints build info and user info |
| 125 | void report_build_info(char *line); |
| 126 | |
| 127 | #ifdef DEBUG |
| 128 | void report_realtime_debug(); |
| 129 | #endif |
| 130 | |
| 131 | #endif |