Commit Graph

759 Commits

Author SHA1 Message Date
Sonny Jeon
66d3155f2f Propagated premature step end bug fix from the edge branch. Updated printFloat() function.
- Will not be uploading a hex build of this, unless asked.
2012-01-15 19:05:06 -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
89a3b37e02 Extended position reporting with both home and work coordinates. Home position now retained after reset. Other minor changes/fixes.
- Grbl now tracks both home and work (G92) coordinate systems and does
live updates when G92 is called.
- Rudimentary home and work position status reporting. Works but still
under major construction.
- Updated the main streaming script. Has a disabled periodic timer for
querying status reports, disabled only because the Python timer doesn't
consistently restart after the script exits. Add here only for user
testing.
- Fixed a bug to prevent an endless serial_write loop during status
reports.
- Refactored the planner variables to make it more clear what they are
and make it easier for clear them.
2012-01-10 08:34:54 -07:00
Sonny Jeon
6f27e2cdb1 Corrected a minor streaming script character counting bug. 2012-01-09 21:41:02 -07:00
Sonny Jeon
f40078110e Updated line in streaming script. 2012-01-09 18:51:53 -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
12bae58994 Various minor updates and variable definition corrections. Removed deprecated acceleration manager.
- Removed deprecated acceleration manager (non-functional since v0.7b)
- Updated variable types and function headers. - Updated stepper
interrupt to ISR() from SIGNAL()+sei(). - General code cleanup.
2011-12-10 11:18:24 -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
4bf0085ae6 Updated README and reordered branch versions. 2011-11-19 14:10:55 -07:00
Sonny Jeon
292fcca67f Re-ordered stepper idle function to first disable interrupt. 2011-11-19 10:08:41 -07:00
Sonny Jeon
b5cc033150 Corrected clearing of target and position variable for the go home routine. Thanks Jens! 2011-11-11 13:36:42 -07:00
Sonny Jeon
169c859b9c Delete a new work file shouldn't have been synced. 2011-10-11 21:00:06 -06: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
c98ff4cc2e Forgot something! Comments on what the last change does. 2011-10-07 15:51:40 -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
05ed6c122d Updated some comments and fixed a bug in the new stepper logic.
- The stepper logic was not initiating the decelerations for certain
cases. Just re-arranged the logic to fix it.
2011-09-25 19:24:29 -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
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
d75ad82e49 Minor update for memory savings in ring buffer and fleshed out commenting.
No changes in functionality. Path vectors moved from ring buffer to
local planner static variables to save 3*(BUFFER_SIZE - 1) doubles in
memory. Detailed comments. Really need to stop micro-updating. Should be
the last until a planner optimization (ala Jens Geisler) has been
completed.
2011-09-04 18:53:25 -06:00
Sonny J
f1e5ff35ec More minor bug fixes in planner.
Reverse planner was over-writing the initial/buffer tail entry speed,
which reset the forward planner and caused it to lose track of its
speed. Should now accelerate into short linear segments much nicer now.
2011-09-04 11:19:08 -06:00
Sonny J
5e2e935bda Minor bug fixes in planner. 2011-09-03 23:22:27 -06:00
Sonny J
75bd4c5ac3 Add G02/03 arc conversion/pre-processor script and example streaming script
Beta pre-processor script used to clean and streamline g-code for
streaming and converts G02/03 arcs into linear segments. Allows for full
acceleration support if the pre-processed g-code is then streamed to
grill, sans G02/03 arcs. Added a simple example streaming script for
Python users.
2011-09-03 16:08:42 -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
Sonny J
badb638df9 Moved comment and block delete handling into protocol.c from gcode.c. Fixes bug when comment and block delete are not isolated. Blank lines ignored.
Comments, block delete characters, and blank lines are no longer passed
to the gcode parser and should free up some memory by ignoring these
characters. Gcode parser now expects clean gcode only. There was a bug
if there were block deletes or comments not in the first character (i.e.
spindle on/off for proofing geode without turning it on, or a NXX
followed by a comment). This should fix it by bypassing the problem.
Left a commented line for easily turning on and off block deletes for a
later feature, if desired.
2011-08-15 19:39:44 -06:00
Sonny J
ed5e5d1181 Revert ea5b8942db2616e93fc0478922010c3bab7c0481^..HEAD 2011-08-15 19:37:22 -06:00
Sonny J
896a6b9199 Moved comment and block delete handling into protocol.c from gcode.c. Fixes bug when comment and block delete are not isolated. Blank lines ignored.
Comments, block delete characters, and blank lines are no longer passed
to the gcode parser and should free up some memory by ignoring these
characters. Gcode parser now expects clean gcode only. There was a bug
if there were block deletes or comments not in the first character (i.e.
spindle on/off for proofing geode without turning it on, or a NXX
followed by a comment). This should fix it by bypassing the problem.
Left a commented line for easily turning on and off block deletes for a
later feature, if desired.
2011-08-15 19:28:14 -06:00
Sonny J
971e50aa9a Revert 517a0f659a06182c89cafe27ee371edccad777a4^..HEAD 2011-08-15 19:15:43 -06:00
Sonny J
a2837943c0 Revert "Moved comment and block delete handling to be done in protocol.c rather than gcode.c. Prevents these from being held in memory. Also, fixes bug when comments and block delete character are mixed with g-code."
This reverts commit ea5b8942db.
2011-08-15 19:14:39 -06:00
Sonny J
8b0556bcfd Revert fdc90f1821f1f5edb7756fcddce75b4b4fbf6bbf^..HEAD 2011-08-15 19:14:25 -06:00
chamnit
fdc90f1821 Removed comment and block delete handling from gcode.c. Parser expects clean gcode. 2011-08-15 17:10:08 -06:00
chamnit
ea5b8942db Moved comment and block delete handling to be done in protocol.c rather than gcode.c. Prevents these from being held in memory. Also, fixes bug when comments and block delete character are mixed with g-code. 2011-08-15 17:06:50 -06:00
Simen Svale Skogsrud
517a0f659a reordered a couple of functions for consistency 2011-08-02 22:44:32 +02:00
Simen Svale Skogsrud
5f09dba95d Merge pull request #34 from beardicus/pulse_error_msg
Step Pulse Error Message thanks to beardicus.
2011-07-19 04:04:55 -07:00
Brian Boucheron
d3f1f82e5f added error message for step pulses < 3 microseconds 2011-07-17 13:35:44 -04:00
Simen Svale Skogsrud
5466bc0c33 fixed a nil dereferencing bug in planner_forward_pass_kernel thanks to jv4779 2011-07-10 21:54:03 +02:00
Simen Svale Skogsrud
74576a8a0c Merge pull request #32 from jv4779/master
minor grbl code issues
2011-07-10 12:47:59 -07:00
Simen Svale Skogsrud
804837a111 corrected an outdated comment 2011-07-09 22:35:25 +02:00
jvangrin
d9a7fc4680 Make sure we don't accelerate above the nominal_rate 2011-07-05 16:57:03 -05:00
jvangrin
926d74fcb7 Reset the overflow flag to stop a queued overflow interrupt from resetting the step pulse right after sei() is called 2011-07-05 16:50:40 -05:00
jvangrin
d4f3fdd4bb fix sign of fractional part in printFloat 2011-07-04 13:07:32 -05:00
jvangrin
2be3a6cc61 fixed null pointer dereference in planner_forward_pass_kernel 2011-07-04 13:05:20 -05:00
Simen Svale Skogsrud
a9aa7d4d39 need to bump the version number because of the serial refactoring 2011-06-06 20:00:57 +02:00
Simen Svale Skogsrud
391efe37ed avoid line buffer overflow 2011-06-06 08:38:38 +02: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
9e09a502e9 updated readme to reflect real state of 168-compatibility 2011-06-05 21:12:56 +02:00
Simen Svale Skogsrud
bd336867a6 changed default fp decimal places to 3 2011-06-05 20:58:21 +02:00