Commit Graph

42 Commits

Author SHA1 Message Date
Sonny Jeon
3dfffa622d Arc mm_per_segment removed, now in terms of tolerance. Stepper ramp counter variable type corrected.
- Arc mm_per_segment parameter was removed and replaced with an
arc_tolerance parameter, which scales all arc segments automatically to
radius, such that the line segment error doesn't exceed the tolerance.
Significantly improves arc performance through larger radius arc,
because the segments are much longer and the planner buffer has more to
work with.

- Moved n_arc correction from the settings to config.h. Mathematically
this doesn't need to be a setting anymore, as the default config value
will work for all known CNC applications. The error does not accumulate
as much anymore, since the small angle approximation used by the arc
generation has been updated to a third-order approximation and how the
line segment length scale with radius and tolerance now. Left in
config.h for extraneous circumstances.

- Corrected the st.ramp_count variable (acceleration tick counter) to a
8-bit vs. 32-bit variable. Should make the stepper algorithm just a
touch faster overall.
2012-12-19 17:30:09 -07:00
Sonny Jeon
a1397f61c4 Max velocity axes independence installed. Fixed intermittent slow trailing steps. Timer0 disable fix.
- Maximum velocity for each axis is now configurable in settings. All
rapids/seek move at these maximums. All feed rates(including rapids)
may be limited and scaled down so that no axis does not exceed their
limits.

- Moved around auto-cycle start. May change later, but mainly to ensure
the planner buffer is completely full before cycle starting a streaming
program. Otherwise it should auto-start when there is a break in the
serial stream.

- Reverted old block->max_entry_speed_sqr calculations. Feedrate
overrides not close to ready at all.

- Fixed intermittent slow trailing steps for some triangle velocity
profile moves. The acceleration tick counter updating was corrected to
be exact for that particular transition. Should be ok for normal
trapezoidal profiles.

- Fixed the Timer0 disable after a step pulse falling edge. Thanks
@blinkenlight!
2012-12-16 16:23:24 -07:00
Sonny Jeon
cc4df3e14b Acceleration independence installed. Initial re-work of planner for feedrate overrides.
NOTE: This push is a work-in-progress and there are known bugs that
need to be fixed, like homing acceleration being incompatible. Released
for testing. Settings will definitely be overwritten, as new settings
were needed.

- Acceleration independence installed in planner. Each axis can now
have different accelerations and Grbl will maximize the accelerations
depending on the direction its moving. Very useful for users like on
the ShapeOko with vastly different Z-axis properties.

- More planner optimizations and re-factoring. Slightly improved some
of the older calculations, but new acceleration calculations offset
these improvements. Overall no change in processing speed.

- Removed planner nominal length checks. It was arguable whether or not
this improved planner efficiency, especially in the worst case scenario
of arcs.

- Updated readme and changed to markdown format.
2012-12-14 08:27:02 -07:00
Sonny Jeon
559feb97e2 Re-factored system states and alarm management. Serial baud support greater than 57600.
- Refactored system states to be more clear and concise. Alarm locks
processes when position is unknown to indicate to user something has
gone wrong.

- Changed mc_alarm to mc_reset, which now manages the system reset
function. Centralizes it.

- Renamed '$X' kill homing lock to kill alarm lock.

- Created an alarm error reporting method to clear up what is an alarm:
message vs a status error: message. For GUIs mainly. Alarm codes are
negative. Status codes are positive.

- Serial baud support upto 115200. Previous baudrate calc was unstable
for 57600 and above.

- Alarm state locks out all g-code blocks, including startup scripts,
but allows user to access settings and internal commands. For example,
to disable hard limits, if they are problematic.

- Hard limits do not respond in an alarm state.

- Fixed a problem with the hard limit interrupt during the homing
cycle. The interrupt register is still active during the homing cycle
and still signal the interrupt to trigger when re-enabled. Instead,
just disabled the register.

- Homing rate adjusted. All axes move at homing seek rate, regardless
of how many axes move at the same time. This is unlike how the stepper
module does it as a point to point rate.

- New config.h settings to disable the homing rate adjustment and the
force homing upon powerup.

- Reduced the number of startup lines back down to 2 from 3. This
discourages users from placing motion block in there, which can be very
dangerous.

- Startup blocks now run only after an alarm-free reset or after a
homing cycle. Does not run when $X kill is called. For satefy reasons
2012-11-14 17:36:29 -07:00
Sonny Jeon
baf137882b Sanguino compile patch
@daapp : Sanguino compile serial USART path. Thanks!
2012-11-08 17:24:56 -07:00
Sonny Jeon
5e7a4b3ba8 More tweaks. Removed dry run. Trimmed all messages to save flash space.
- Removed the dry run switch. It was getting overly complicated for
what it needed to do. In practice, single block mode and feed rate
overrides (coming in next release) does a much better job with dry runs
than 'dry run'.

- Trimmed all of Grbl's messages from help, status, feedback to
settings. Saved 0.6KB+ of flash space that could be used for v0.9
features.

- Removed some settings inits when set. Will depend on user to power
cycle to get some of these to reload.

- Fixed a bug with settings version not re-writing old settings, when
it should. Thanks Alden!
2012-11-07 20:53:03 -07:00
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
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
065ceceb34 New alarm method. Re(re)organized status messages.
- Installed a new 'alarm' method to centralize motion kills across
alarm or reset events. Right now, this is controlled by system abort
and hard limits. But, in the future, a g-code parser error may call
this too as a safety feature.

- Re(re)organized status messages to just print all errors, regardless
from where it was called. This centralizes them into one place.

- Misc messages method installed for any user feedback that is not a
confirmation or error. Mainly so that there is a place to perform
warnings and such.

- New stuff installed and still made the flash size smaller by saving
flash space from clearing out repeated '\r\n' pgmstrings.

- Fixed a bug where hard limits message would print everytime a system
abort was sent.
2012-10-21 19:18:24 -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
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
34f6d2eb4b Minor updates, improvements, and bug fixes.
- Allowed status_message function to be called by others. This is to
centralize all feedback into protocol.c.

- Fixed a bug where line number words 'N' were causing the parser to
error out.

- Allowed homing routine feed rates to move slower than the
MINIMUM_STEP_RATE parameter in config.h.

- Homing performs idle lock at the end of the routine.

- Stepper idle lock time will now not disable the steppers when the
value is set at 255. This is accomodate users who prefer to keep their
axes enabled at all times.

- Moved some defines around to where they need to be.
2012-10-13 13:11:43 -06:00
Sonny Jeon
9b4e108905 (2x) speed increase in printFloat() function. Decimal places setting added.
- printFloat() function execution doubled in speed. This is a precursor
to status reporting, since GUIs may query real-time position rapidly.

- Decimal places added to settings (for now). This may disappear in
future pushes, but here for testing purposes.
2012-10-11 22:43:54 -06:00
Sonny Jeon
32963289fe Homing direction pin bits fixed. Lite refactoring of settings. 2012-10-10 18:01:43 -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
1720484d76 No changes. Github commit bug. 2012-06-27 07:06:24 -06: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
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
110faae986 More '%' modulo opertor removals and some housecleaning.
- Serial functions contained quite a few modulo operations that would
be executed with high frequency when streaming. AVR processors are very
slow when operating these. In one test on the Arduino forums, it showed
about a 15x slow down compared to a simple if-then statement. -
Clarified some variable names and types and comments.
2011-09-15 20:32:15 -06:00
Sonny J
4d03c4febc Further planner improvements and misc minor bug fixes. Memory savings and increased buffer size.
- Update grbl version and settings version to automatically reset
eeprom. FYI, this will reset your grbl settings. - Saved
3*BLOCK_BUFFER_SIZE doubles in static memory by removing obsolete
variables: speed_x, speed_y, and speed_z. - Increased buffer size
conservatively to 18 from 16. (Probably can do 20). - Removed expensive!
modulo operator from block indexing function. Reduces significant
computational overhead. - Re-organized some sqrt() calls to be more
efficient during time critical planning cases, rather than non-time
critical. - Minor bug fix in planner max junction velocity logic. -
Simplified arc logic and removed need to multiply for CW or CCW
direction.
2011-09-13 21:57:16 -06:00
Sonny J
ffcc3470a3 Optimized planner re-write. Significantly faster. Full arc support enabled by rotation matrix approach.
- Significant improvements in the planner. Removed or reordered
repetitive and expensive calculations by order of importance:
recalculating unchanged blocks, trig functions [sin(), cos(), tan()],
sqrt(), divides, and multiplications. Blocks long enough for nominal
speed to be guaranteed to be reached ignored by planner. Done by
introducing two uint8_t flags per block. Reduced computational overhead
by an order of magnitude.   - Arc motion generation completely
re-written and optimized. Now runs with acceleration planner. Removed
all but one trig function (atan2) from initialization. Streamlined
computations. Segment target locations generated by vector
transformation and small angle approximation. Arc path correction
implemented for accumulated error of approximation and single precision
calculation of Arduino. Bug fix in message passing.
2011-09-06 19:39:14 -06:00
Sonny J
5c2150daa9 Significantly improved junction control and fixed computation bugs in planner
- Junction jerk now re-defined as junction_deviation. The distance from
the junction to the edge of a circle tangent to both previous and
current path lines. The circle radii is used to compute the maximum
junction velocity by centripetal acceleration. More robust and
simplified way to compute jerk.   - Fixed bugs related to entry and exit
factors. They were computed based on the current nominal speeds but not
when computing exit factors for neighboring blocks. Removed factors and
replaced with entry speeds only. Factors now only computed for stepper
trapezoid rate conversions.  - Misc: Added min(), next_block_index,
prev_block_index functions for clarity.
2011-09-03 15:31:48 -06:00
Brian Boucheron
d3f1f82e5f added error message for step pulses < 3 microseconds 2011-07-17 13:35:44 -04:00
Simen Svale Skogsrud
c3fda5ac21 fixed a bug where the default step mask would not actually reflect the real pin out 2011-06-05 21:34:53 +02:00
Simen Svale Skogsrud
c0b4b8309a cleaned up serial completing support for non blocking tx and refactoring formatting functions into a new module 'print' 2011-06-03 15:28:14 +02:00
Simen Svale Skogsrud
defabc80ed renamed wiring_serial to serial to reflect its complete remake 2011-05-31 22:45:38 +02:00
Simen Svale Skogsrud
a25812f36b made inverted stepper driving the default as per the request of the Grbl Shield team and frankly myself. Who doesn't need their stepper signals inverted anyway? 2011-05-31 13:13:45 +02:00
Simen Svale Skogsrud
cd074bc590 foolproofed steps/mm setting (must be > 0) 2011-02-25 13:40:48 +01:00
Simen Svale Skogsrud
6be195ba38 cleaned up handling of number parsing in settings_execute_command 2011-02-18 23:08:06 +01:00
Simen Svale Skogsrud
6edbbe322c lowercased boolean constants 2011-02-18 23:04:12 +01:00
Simen Svale Skogsrud
9876e14f0b refactored handling of settings '$' command out of gcode module and into settings module 2011-02-18 22:59:16 +01:00
Simen Svale Skogsrud
2ff680a125 improved some defaults 2011-02-17 20:24:04 +01:00
Simen Svale Skogsrud
23462de85a cleaned up settings.h 2011-02-17 20:23:12 +01:00
Simen Svale Skogsrud
799548c013 replaced use of magical numbers for axis reference with constants 2011-02-06 23:27:04 +01:00
Simen Svale Skogsrud
7092b0e1fe renamed public methods of settings module to include module name 2011-02-05 01:00:41 +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