Commit Graph

66 Commits

Author SHA1 Message Date
Sonny Jeon
f41dd69273 Tweaks and bug fixes. Increase to 3 startup blocks. Remove purge/added unlock command
- Increased the number of startup blocks to 3 for no good reason other
than it doesn't increase the flash size.

- Removed the purge buffer command and replaced with an disable homing
lock command.

- Homing now blocks all g-code commands (not system commands) until the
homing cycle has been performed or the disable homing lock is sent.
Homing is required upon startup or if Grbl loses it position. This is
for safety reasons.

- Cleaned up some of the Grbl states and re-organized it to be little
more cohesive.

- Cleaned up the feedback and status messages to not use so much flash
space, as it's a premium now.

 - Check g-code and dry run switches how are mutually exclusive and
can't be enabled when the other is. And automatically resets Grbl when
disabled.

- Some bug fixes and other minor tweaks.
2012-11-05 21:40:52 -07:00
Sonny Jeon
9cabc915ef Runtime command pinned out! Re-organized coolant pins.
- Pinned out cycle start(A2), feed hold(A1), and reset(A0) runtime
commands. These pins are held high with the internal pull-up resistor
enabled. All you have to do is connect a normally-open switch to the
pin and ground. That's it.

- Moved the coolant control pins to A3 (and the optional mist control
to A4).

- Moved all of the MASK defines into the config.h file to centralize
them.
2012-11-04 10:48:57 -07:00
Sonny Jeon
4c711a4af7 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 11:32:23 -06:00
Sonny Jeon
303cf59f52 Added block delete, opt stop, single block mode. New parser state and parameter feedback. Overhauled '$' command.
NOTE: Another incremental update. Likely buggy, still a ways to go
before everything is installed, such as startup blocks.

- Changed the '$' command to print help. '$$' now prints Grbl settings.
The help now instructs the user of runtime commands, switch toggling,
homing, etc. Jogging will be added to these in v0.9.

- Added switches: block delete, opt stop, and single block mode.

- Now can print the g-code parser state and persistent parameters
(coord sys) to view what Grbl has internally.

- Made the gc struct in the g-code parser global to be able to print
the states. Also moved coordinate system tracking from sys to gc struct.

- Changed up the welcome flag and updated version to v0.8c.

- Removed spindle speed from gcode parser. Not used.
2012-11-01 19:48:55 -06:00
Sonny Jeon
e0a9054e32 New report module. 6 persistent work coordinates. New G-codes and settings. README and minor bug updates
(NOTE: This push is likely buggy so proceed with caution. Just
uploading to let people know where we're going.)

- New report.c module. Moved all feedback functions into this module to
centralize these processes. Includes realtime status reports, status
messages, feedback messages.

- Official support 6 work coordinate systems (G54-G59), which are
persistently held in EEPROM memory.

- New g-code support: G28.1, G30.1 stores current machine position as a
home position into EEPROM. G10 L20 Px stores current machine position
into work coordinates without needing to explicitly send XYZ words.

- Homing performed with '$H' command. G28/G30 no longer start the
homing cycle. This is how it's supposed to be.

- New settings: Stepper enable invert and n_arc correction installed.

- Updated and changed up some limits and homing functionality. Pull-off
travel will now move after the homing cycle regardless of hard limits
enabled. Fixed direction of pull-off travel (went wrong way).

- Started on designing an internal Grbl command protocol based on the
'$' settings letter. Commands with non numeric characters after '$'
will perform switch commands, homing cycle, jogging, printing
paramters, etc. Much more to do here.

- Updated README to reflect all of the new features.
2012-11-01 09:37:27 -06:00
Sonny Jeon
909feb7f79 Re-organized status messages to be more coherent and centralized.
- Reorganized all of the status message feedback from both the g-code
parser and settings modules to be centralized into two message modules:
status feedback from executing a line and warnings for misc feedback.

- Pulled out the printPgmString() messages in settings.c and placed it
into the new module. (settings_dump() not moved).

- Some other minor edits. Renaming defines, comment updates, etc.
2012-10-21 16:55:59 -06:00
Sonny Jeon
39e11b696f Hard limits code minor updates.
- Fixed a bug that would not disable the steppers if a user issues a
system abort during a homing cycle.

- Updated the hard limit interrupt to be more correct and to issue a
shutdown for the right situations when the switch has been triggered.

- Added a status message to indicate to the user what happened and what
to do upon a hard limit trigger.
2012-10-18 21:29:07 -06:00
Sonny Jeon
df5bb70b25 Hard limits, homing direction, pull-off limits after homing, status reports in mm or inches, system alarm, and more.
- Thank you statement added for Alden Hart of Synthetos.

- Hard limits option added, which also works with homing by pulling off
the switches to help prevent unintended triggering. Hard limits use a
interrupt to sense a falling edge pin change and immediately go into
alarm mode, which stops everything and forces the user to issue a reset
(Ctrl-x) or reboot.

- Auto cycle start now a configuration option.

- Alarm mode: A new method to kill all Grbl processes in the event of
something catastrophic or potentially catastropic. Just works with hard
limits for now, but will be expanded to include g-code errors (most
likely) and other events.

- Updated status reports to be configurable in inches or mm mode. Much
more to do here, but this is the first step.

- New settings: auto cycle start, hard limit enable, homing direction
mask (which works the same as the stepper mask), homing pulloff
distance (or distance traveled from homed machine zero to prevent
accidental limit trip).

- Minor memory liberation and calculation speed ups.
2012-10-16 21:29:45 -06:00
Sonny Jeon
00701ff24e Updated delay_us() function to accept long integers 2012-10-12 08:27:14 -06:00
Sonny Jeon
4c6f5bec48 Improved homing cycle. New settings: homing enable/rates, debounce and step idle lock time.
- Homing cycle will now cycle twice (spec more/less in config) to
improve repeatability and accuracy by decreasing overshoot.

- New Grbl settings added: Enable/disable homing cycles, homing seek
and feed rates, switch debounce delay, and stepper idle lock time.

- Please note that these settings may change upon the next push, since
there will be more added soon. Grbl *should* not re-write your old
settings, just re-write the new ones. So, make sure you keep these
written down somewhere in case they get lost from a code bug.

- Refactored settings migration to be a little smaller and managable
going forward.
2012-10-09 22:01:10 -06:00
Sonny Jeon
ff82489da7 Limit pin internal pull-resistors enabled. Re-wrote read_double() function. Correctly changed all 'double's to 'float's.
- Limit pin internal pull-resistors now enabled. Normal high operation.
This will be the standard going forward.

- Updated all of the 'double' variable types to 'float' to reflect what
happens when compiled for the Arduino. Also done for compatibility
reasons to @jgeisler0303 's Grbl simulator code.

- G-code parser will now ignore 'E' exponent values, since they are
reserved g-code characters for some machines. Thanks @csdexter!

- The read_double() function was re-written and optimized for use in
Grbl. The strtod() avr lib was removed.
2012-10-08 15:57:58 -06:00
Sonny Jeon
d30cb906f8 Updated limit/homing routine. Works, but needs more TLC.
- Added acceleration to the homing routine.

- Homing now accounts for different step rates when moving multiple
axes without exceeding acceleration limits.

- Homing now updates all internal positioning variables to machine zero
after completion.

- "Poor-man's" debounce delay added.

- Updated the delay_us() function to perform faster and more accurate
microsecond delays. Previously, the single increments would add
noticeable time drift for larger delays.

- Fix a bug in the stepper.c prescalar calculations that was changed in
the last commit.

- Other minor fixes.
2012-09-30 19:57:10 -06:00
Sonny Jeon
4224ab4999 Minor prescalar optimization. Changed up some defines. 2012-09-21 17:55:02 -06:00
Sonny Jeon
420c7c2584 Added coolant control (M7*, M8, M9). Mist control can be enabled via config.h.
- Added coolant control! Flood control (M8) functions on analog pin 0.
Mist control (M7) is compile-time optional and is on analog pin 1. (Use
only if you have multiple coolants on your system). Based on work by
@openpnp.

- Fixed some variable assignments in spindle control.
2012-09-21 11:14:13 -06:00
Sonny Jeon
79e0fd594b Added step pulse delay after direction set (Compile-time option only). Updated read me.
Added a compile-time only experimental feature that creates a
user-specified time delay between a step pulse and a direction pin set
(in config.h). This is for users with hardware-specific issues
(opto-couplers) that need more than a few microseconds between events,
which can lead to slowly progressing step drift after many many
direction changes. We suggest to try the hack/fix posted in the Wiki
before using this, as this experimental feature may cause Grbl to take
a performance hit at high step rates and about complex curves.
2012-06-26 21:48:42 -06:00
Sonny Jeon
d3be216931 Minor fix related to spindle_stop() crashing abort in certain cases.
- Updated spindle_stop() to fix abort bug and to be more in line with
v0.8.
2012-03-10 12:34:09 -07:00
Sonny Jeon
86cdae0060 Minor updates.
- Updated makefile to be more universally compatible by not requiring
grep or ruby.

- Edited XON/XOFF flow control usage, noting that FTDI-based Arduinos
are known to work, but not Atmega8U2-based Arduino. Still officially
not supported, but added for advanced users.

- Minor edits.
2012-03-05 12:01:02 -07:00
Sonny Jeon
d6abf10d49 Minor include related compile fix. Added experimental XON/XOFF flow control. Not officially supported!
- A latency issue related to USB-to-serial converters on the Arduino
does not allow for XON/XOFF flow control to work correctly on standard
terminal programs. It seems that only specialized UI's or avoiding the
USB port all together solves this problem. However, XON/XOFF flow
control is added for advanced users only as a compile-time option. This
feature is officially *NOT* supported by grbl, but let us know of any
successes with it!
2012-02-25 09:06:42 -07:00
Sonny Jeon
567fbf93ed G54 work coordinate support (w/ G10,G92.1). Re-factored g-code parser with error checking. Minor compiler compatibility changes.
- G54 work coordinate system support. Up to 6 work coordinate systems
(G54-G59) available as a compile-time option.

- G10 command added to set work coordinate offsets from machine
position.

- G92/G92.1 position offsets and cancellation support. Properly follows
NIST standard rules with other systems.

- G53 absolute override now works correctly with new coordinate systems.

- Revamped g-code parser with robust error checking. Providing user
feedback with bad commands. Follows NIST standards.

- Planner module slightly changed to only expected position movements
in terms of machine coordinates only. This was to simplify coordinate
system handling, which is done solely by the g-code parser.

- Upon grbl system abort, machine position and work positions are
retained, while G92 offsets are reset per NIST standards.

- Compiler compatibility update for _delay_us().

- Updated README.
2012-02-11 11:59:35 -07:00
Sonny Jeon
b51e902530 Program stop support (M0,M1*,M2,M30*), proper position retainment upon reset, misc minor updates.
- Program stop support (M0,M1*,M2,M30*). *Optional stop to be done.
*Pallet shuttle not supported.

- Work position is set equal to machine position upon reset, as
according to NIST RS274-NGC guidelines. G92 is disabled.

- Renamed mc_set_current_position() to mc_set_coordinate_offset().

- Fixed bug in plan_synchronize(). Would exit right before last step is
finished and caused issues with program stops. Now fixed.

- Spindle now stops upon a run-time abort command.

- Updated readme and misc upkeeping.
2012-01-28 20:41:08 -07:00
Sonny Jeon
d27dd13a54 Fix bug with premature step end. Refactored _delay_ms() and square() for better portability.
- Fixed a premature step end bug dating back to Simen's 0.7b edge
version is fixed, from which this code is forked from. Caused by Timer2
constantly overflowing calling the Step Reset Interrupt every 128usec.
Now Timer2 is always disabled after a step end and should free up some
cycles for the main program. Could be more than one way to fix this
problem. I'm open to suggestions.

- _delay_ms() refactored to accept only constants to comply with
current compilers. square() removed since not available with some
compilers.
2012-01-15 18:25:12 -07:00
Sonny Jeon
e8a6bfd179 Position reporting, refactored system variables, serial print fixes, updated streaming scripts.
- Added machine position reporting to status queries. This will be
further developed with part positioning/offsets and maintaining
location upon reset.

- System variables refactored into a global struct for better
readability.

- Removed old obsolete Ruby streaming scripts. These were no longer
compatible. Updated Python streaming scripts.

- Fixed printFloat() and other printing functions.

- Decreased planner buffer back to 18 blocks and increased TX serial
buffer to 64 bytes. Need the memory space for future developments.

- Begun adding run-time modes to grbl, where block delete toggle, mm/in
reporting modes, jog modes, etc can be set during runtime. Will be
fleshed out and placed into EEPROM when everything is added.
2012-01-06 10:10:41 -07:00
Sonny Jeon
03e2ca7cd5 Initial v0.8 ALPHA commit. Features multi-tasking run-time command execution (feed hold, cycle start, reset, status query). Extensive re-structuring of code for future features.
- ALPHA status. - Multitasking ability with run-time command executions
for real-time control and feedback. - Decelerating feed hold and resume
during operation. - System abort/reset, which immediately kills all
movement and re-initializes grbl. - Re-structured grbl to easily allow
for new features: Status reporting, jogging, backlash compensation. (To
be completed in the following releases.) - Resized TX/RX serial buffers
(32/128 bytes) - Increased planner buffer size to 20 blocks. - Updated
documentation.
2011-12-08 18:47:48 -07:00
Sonny Jeon
9141ad2825 Third time's a charm! No more deceleration issues! Updated grbl version and settings. General cleanup.
- Fleshed out the original idea to completely remove the long slope at
the end of deceleration issue. This third time should absolutely
eliminate it.
- Changed the acceleration setting to kept as mm/min^2 internally,
since this was creating unneccessary additional computation in the
planner. Human readable value kept at mm/sec^2.
- Updated grbl version 0.7d and settings version to 4. NOTE: Please
check settings after update. These may have changed, but shouldn't.
- Before updating the new features (pause, e-stop, federate override,
etc), the edge branch will soon be merged with the master, barring any
immediate issues that people may have, and the edge branch will be the
testing ground for the new grbl version 0.8.
2011-10-11 20:51:04 -06:00
Sonny Jeon
ca26bb9ccf Minor update to further eliminate the ole long slope deceleration issue. New update note!
- Added another way to further ensure the long slope deceleration issue
is eliminated. If the stepper rate change is too great near zero, the
stepper rate is adjusted at half increments to the end of travel,
creating a smooth transition. - If the new STEPPER_IDLE_LOCK_TIME is
set as zero, this delay is not compiled at compile-time. - NOTE: The
next update is likely going to be major, involving a full re-write of
the stepper.c program to integrate a simple way to apply pauses,
jogging, e-stop, and feedrate overrides. The interface should be
flexible enough to be easily modified for use with either hardware
switches or software commands. Coming soon.
2011-10-06 23:14:21 -06:00
Sonny Jeon
59a84c4925 Added complete stop delay at the end of all motion. Moved grbl preprocessor script into a new repository.
Added a very short (25 ms) user-definable delay before the steppers are
disabled at the motors are disabled and grbl goes idle. This ensures
any residual inertia at the end of the last motion does not cause the
axes to drift and grbl to lose its position when manually entering
g-code or when performing a tool change and starting the next
operation.
2011-09-29 16:25:48 -06:00
Sonny Jeon
2be0d66872 Fixed long slope at deceleration issue. Moved things into config.h. New MINIMUM_PLANNER_SPEED parameter.
- The long standing issue of a long slope at deceleration is likely
fixed. The stepper program was not tracking and timing the end of
acceleration and start of deceleration exactly and now is fixed to
start and stop on time. Also, to ensure a better acceleration curve fit
used by the planner, the stepper program delays the start of the
accelerations by a half trapezoid tick to employ the midpoint rule. -
Settings version 3 migration (not fully tested, but should work) -
Added a MINIMUM_PLANNER_SPEED user-defined parameter to planner to let
a user change this if problems arise for some reason. - Moved all
user-definable #define parameters into config.h with clear comments on
what they do and recommendations of how to change them. - Minor
housekeeping.
2011-09-24 07:46:41 -06:00
Sonny J
6de805441f Fixed minor bugs in planner. Increased max dwell time. Long slope bug stop-gap solution note.
- Fixed the planner TODO regarding minimum nominal speeds. Re-arranged
calculations to be both more efficient and guaranteed to be greater
than zero. - Missed a parenthesis location on the rate_delta
calculation. Should fix a nearly in-perceptible issue with incorrect
acceleration ramping in diagonal directions. - Increased maximum dwell
time from 6.5sec to an 18hour max. A crazy amount more, but that's how
the math works out. - Converted the internal feedrate values to mm/min
only, as it was switching between mm/min to mm/sec and back to mm/min.
Also added a feedrate > 0 check in gcode.c. - Identified the long slope
at the end of rapid de/ac-celerations noted by stephanix. Problem with
the numerical integration truncation error between the exact solution
of estimate_acceleration_distance and how grbl actually performs the
acceleration ramps discretely. Increasing the
ACCELERATION_TICKS_PER_SECOND in config.h helps fix this problem.
Investigating further.
2011-09-18 05:36:55 -06:00
Simen Svale Skogsrud
c2aec12004 converted the STEPPER_ENABLE_PIN to a STEPPER_DISABLE_PIN as per the request of Alden Hart of Grbl Shield fame. 2011-05-31 13:08:42 +02:00
Simen Svale Skogsrud
d5d6298de3 added support for limit switches and homing action 2011-02-20 00:29:56 +01:00
Simen Svale Skogsrud
ee6436c625 increased default acceleration ticks per second 2011-02-17 09:42:44 +01:00
Simen Svale Skogsrud
6d3ff506e8 refactored compile time settings back into a new file called config.h 2011-02-05 00:55:37 +01:00
Simen Svale Skogsrud
d00947a23a renamed config.* to settings.* 2011-02-05 00:45:41 +01:00
Simen Svale Skogsrud
4b63cf3ab5 small fixes after testing on real hardware. Still no chaining of motions and something odd with arcs 2011-02-03 10:42:00 +01:00
Simen Svale Skogsrud
420641d13d added the new, more optimal pin configuration 2011-02-03 09:57:10 +01:00
Simen Svale Skogsrud
9b292ffe3c added support for silently upgrading from old settings record w/o accelleration parameters 2011-01-31 23:04:08 +01:00
Simen Svale Skogsrud
4562ee7fe9 merged master 2011-01-31 19:42:56 +01:00
Simen Svale Skogsrud
25383790e2 updated struct types to use typedefs and conform to Micael Barrs Embedded C Coding Standard 2011-01-25 22:51:37 +01:00
Simen Svale Skogsrud
a24fe19720 updated settings version number. Old settings must be reset now that we have changed the format of the settings 2011-01-24 23:32:33 +01:00
Simen Svale Skogsrud
4103e6ca00 still not running, but a lot further along 2011-01-22 23:29:02 +01:00
Simen Svale Skogsrud
5880e55ce9 pcomplete, fully untested, support for accelleration management with look ahead optimization, finally 2011-01-15 00:27:08 +01:00
Simen Svale Skogsrud
0be21a9034 eliminated an annoying constant that broke my cleanly layered abstractions 2011-01-14 16:56:44 +01:00
Simen Svale Skogsrud
49a16cb777 refactored block buffer into separate module motion_plan pending the addition of the actual look ahead planner 2011-01-14 16:45:18 +01:00
Simen Svale Skogsrud
b628a4aabf added basic accelleration management with trapezoid accelleration profiles but no look ahead optimization (coming next patch) 2011-01-14 12:10:18 +01:00
Simen Svale Skogsrud
48b596c2fe added code with merge conflict as note to self, accelleration will just have to wait 2010-12-20 14:01:38 +01:00
Simen Svale Skogsrud
0ac1731488 minor edits 2010-07-08 14:55:43 +02:00
Simen Svale Skogsrud
d0f64d8f65 fixed the inches->mm conversion bug and some general cleanup 2010-07-03 00:23:28 +02:00
Simen Svale Skogsrud
703d812b85 rough accelleration stuff 2010-06-28 23:29:58 +02:00
Simen Svale Skogsrud
e409f10047 moved all strings to pgm-memory 2010-03-07 23:10:41 +01:00
Simen Svale Skogsrud
b8ba8a4231 Added runtime configurable global settings with eeprom persitence 2010-03-07 20:29:18 +01:00