2009-01-25 00:48:56 +01:00
|
|
|
/*
|
2011-01-14 16:45:18 +01:00
|
|
|
motion_control.h - high level interface for issuing motion commands
|
2015-02-16 01:36:08 +01:00
|
|
|
Part of Grbl
|
2009-01-25 00:48:56 +01:00
|
|
|
|
2015-02-16 01:36:08 +01:00
|
|
|
Copyright (c) 2011-2015 Sungeun K. Jeon
|
|
|
|
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
2011-09-07 03:39:14 +02:00
|
|
|
|
2009-01-25 00:48:56 +01:00
|
|
|
Grbl is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Grbl is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef motion_control_h
|
2011-02-11 00:53:00 +01:00
|
|
|
#define motion_control_h
|
2015-02-10 16:25:09 +01:00
|
|
|
|
2009-01-25 00:48:56 +01:00
|
|
|
|
2014-02-19 15:48:09 +01:00
|
|
|
#define HOMING_CYCLE_LINE_NUMBER -1
|
|
|
|
|
2009-02-11 00:37:33 +01:00
|
|
|
// Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second
|
|
|
|
// unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in
|
2010-03-03 17:52:56 +01:00
|
|
|
// (1 minute)/feed_rate time.
|
2014-02-26 20:10:07 +01:00
|
|
|
#ifdef USE_LINE_NUMBERS
|
2014-02-19 15:48:09 +01:00
|
|
|
void mc_line(float *target, float feed_rate, uint8_t invert_feed_rate, int32_t line_number);
|
2014-02-26 20:10:07 +01:00
|
|
|
#else
|
|
|
|
void mc_line(float *target, float feed_rate, uint8_t invert_feed_rate);
|
|
|
|
#endif
|
2011-02-21 22:32:42 +01:00
|
|
|
|
2011-09-07 03:39:14 +02:00
|
|
|
// Execute an arc in offset mode format. position == current xyz, target == target xyz,
|
|
|
|
// offset == offset from current xyz, axis_XXX defines circle plane in tool space, axis_linear is
|
2014-10-02 04:22:16 +02:00
|
|
|
// the direction of helical travel, radius == circle radius, is_clockwise_arc boolean. Used
|
2011-09-07 03:39:14 +02:00
|
|
|
// for vector transformation direction.
|
2014-02-26 20:10:07 +01:00
|
|
|
#ifdef USE_LINE_NUMBERS
|
2014-05-26 00:05:28 +02:00
|
|
|
void mc_arc(float *position, float *target, float *offset, float radius, float feed_rate,
|
2014-10-02 04:22:16 +02:00
|
|
|
uint8_t invert_feed_rate, uint8_t axis_0, uint8_t axis_1, uint8_t axis_linear, uint8_t is_clockwise_arc, int32_t line_number);
|
2014-02-26 20:10:07 +01:00
|
|
|
#else
|
2014-05-26 00:05:28 +02:00
|
|
|
void mc_arc(float *position, float *target, float *offset, float radius, float feed_rate,
|
2014-10-02 04:22:16 +02:00
|
|
|
uint8_t invert_feed_rate, uint8_t axis_0, uint8_t axis_1, uint8_t axis_linear, uint8_t is_clockwise_arc);
|
2014-02-26 20:10:07 +01:00
|
|
|
#endif
|
2011-02-11 23:01:16 +01:00
|
|
|
|
2011-09-18 13:36:55 +02:00
|
|
|
// Dwell for a specific number of seconds
|
2012-10-08 23:57:58 +02:00
|
|
|
void mc_dwell(float seconds);
|
2009-01-28 23:48:21 +01:00
|
|
|
|
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
|
|
|
// Perform homing cycle to locate machine zero. Requires limit switches.
|
2013-12-30 04:34:51 +01:00
|
|
|
void mc_homing_cycle();
|
2009-01-28 23:48:21 +01:00
|
|
|
|
2014-02-25 21:19:52 +01:00
|
|
|
// Perform tool length probe cycle. Requires probe switch.
|
2014-02-28 06:30:24 +01:00
|
|
|
#ifdef USE_LINE_NUMBERS
|
2014-10-02 04:22:16 +02:00
|
|
|
void mc_probe_cycle(float *target, float feed_rate, uint8_t invert_feed_rate, uint8_t is_probe_away,
|
|
|
|
uint8_t is_no_error, int32_t line_number);
|
2014-02-28 06:30:24 +01:00
|
|
|
#else
|
2014-10-02 04:22:16 +02:00
|
|
|
void mc_probe_cycle(float *target, float feed_rate, uint8_t invert_feed_rate, uint8_t is_probe_away,
|
|
|
|
uint8_t is_no_error);
|
2014-02-28 06:30:24 +01:00
|
|
|
#endif
|
2014-02-25 21:19:52 +01:00
|
|
|
|
v1.0 Beta Release.
- Tons of new stuff in this release, which is fairly stable and well
tested. However, much more is coming soon!
- Real-time parking motion with safety door. When this compile option
is enabled, an opened safety door will cause Grbl to automatically feed
hold, retract, de-energize the spindle/coolant, and parks near Z max.
After the door is closed and resume is commanded, this reverses and the
program continues as if nothing happened. This is also highly
configurable. See config.h for details.
- New spindle max and min rpm ‘$’ settings! This has been requested
often. Grbl will output 5V when commanded to turn on the spindle at its
max rpm, and 0.02V with min rpm. The voltage and the rpm range are
linear to each other. This should help users tweak their settings to
get close to true rpm’s.
- If the new max rpm ‘$’ setting is set = 0 or less than min rpm, the
spindle speed PWM pin will act like a regular on/off spindle enable
pin. On pin D11.
- BEWARE: Your old EEPROM settings will be wiped! The new spindle rpm
settings require a new settings version, so Grbl will automatically
wipe and restore the EEPROM with the new defaults.
- Control pin can now be inverted individually with a
CONTROL_INVERT_MASK in the cpu_map header file. Not typical for users
to need this, but handy to have.
- Fixed bug when Grbl receive too many characters in a line and
overflows. Previously it would respond with an error per overflow
character and another acknowledge upon an EOL character. This broke the
streaming protocol. Now fixed to only respond with an error after an
EOL character.
- Fixed a bug with the safety door during an ALARM mode. You now can’t
home or unlock the axes until the safety door has been closed. This is
for safety reasons (obviously.)
- Tweaked some the Mega2560 cpu_map settings . Increased segment buffer
size and fixed the spindle PWM settings to output at a higher PWM
frequency.
- Generalized the delay function used by G4 delay for use by parking
motion. Allows non-blocking status reports and real-time control during
re-energizing of the spindle and coolant.
- Added spindle rpm max and min defaults to default.h files.
- Added a new print float for rpm values.
2015-08-28 05:37:19 +02:00
|
|
|
// Plans and executes the single special motion case for parking. Independent of main planner buffer.
|
|
|
|
void mc_parking_motion(float *parking_target, float feed_rate);
|
|
|
|
|
2012-11-15 01:36:29 +01:00
|
|
|
// Performs system reset. If in motion state, kills all motion and sets system alarm.
|
|
|
|
void mc_reset();
|
2012-10-22 03:18:24 +02:00
|
|
|
|
2009-01-25 00:48:56 +01:00
|
|
|
#endif
|