Luigi Santivetti | 69972f9 | 2019-11-12 22:55:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | motion_control.h - high level interface for issuing motion commands |
| 3 | Part of Grbl |
| 4 | |
| 5 | Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC |
| 6 | Copyright (c) 2009-2011 Simen Svale Skogsrud |
| 7 | |
| 8 | Grbl is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 3 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | Grbl is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with Grbl. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | |
| 22 | #ifndef motion_control_h |
| 23 | #define motion_control_h |
| 24 | |
| 25 | |
| 26 | // System motion commands must have a line number of zero. |
| 27 | #define HOMING_CYCLE_LINE_NUMBER 0 |
| 28 | #define PARKING_MOTION_LINE_NUMBER 0 |
| 29 | |
| 30 | #define HOMING_CYCLE_ALL 0 // Must be zero. |
| 31 | #define HOMING_CYCLE_X bit(X_AXIS) |
| 32 | #define HOMING_CYCLE_Y bit(Y_AXIS) |
| 33 | #define HOMING_CYCLE_Z bit(Z_AXIS) |
| 34 | |
| 35 | |
| 36 | // Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second |
| 37 | // unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in |
| 38 | // (1 minute)/feed_rate time. |
| 39 | void mc_line(float *target, plan_line_data_t *pl_data); |
| 40 | |
| 41 | // Execute an arc in offset mode format. position == current xyz, target == target xyz, |
| 42 | // offset == offset from current xyz, axis_XXX defines circle plane in tool space, axis_linear is |
| 43 | // the direction of helical travel, radius == circle radius, is_clockwise_arc boolean. Used |
| 44 | // for vector transformation direction. |
| 45 | void mc_arc(float *target, plan_line_data_t *pl_data, float *position, float *offset, float radius, |
| 46 | uint8_t axis_0, uint8_t axis_1, uint8_t axis_linear, uint8_t is_clockwise_arc); |
| 47 | |
| 48 | // Dwell for a specific number of seconds |
| 49 | void mc_dwell(float seconds); |
| 50 | |
| 51 | // Perform homing cycle to locate machine zero. Requires limit switches. |
| 52 | void mc_homing_cycle(uint8_t cycle_mask); |
| 53 | |
| 54 | // Perform tool length probe cycle. Requires probe switch. |
| 55 | uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_flags); |
| 56 | |
| 57 | // Handles updating the override control state. |
| 58 | void mc_override_ctrl_update(uint8_t override_state); |
| 59 | |
| 60 | // Plans and executes the single special motion case for parking. Independent of main planner buffer. |
| 61 | void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data); |
| 62 | |
| 63 | // Performs system reset. If in motion state, kills all motion and sets system alarm. |
| 64 | void mc_reset(); |
| 65 | |
| 66 | #endif |