Commit Graph

349 Commits

Author SHA1 Message Date
Sonny Jeon
4402a9f74a Merge branch 'dev_2' into dev
Conflicts:
	README.md
	gcode.c
	motion_control.c
	planner.c
	planner.h
	protocol.c
	report.c
	settings.c
	settings.h
	stepper.c
	stepper.h
2013-10-29 19:12:09 -06:00
Sonny Jeon
4f9bcde40e Merge branch 'dev_2' into dev
Conflicts:
README.md
gcode.c
motion_control.c
planner.c
planner.h
protocol.c
report.c
settings.c
settings.h
stepper.c
stepper.h
2013-10-29 19:10:39 -06:00
Sonny Jeon
0ac6c87196 Planner function call fix. More clean up. 2013-10-29 18:55:55 -06:00
Sonny Jeon
27297d444b Updated comments. Changed stepper variable names to be more understandable. Added step locking note.
- Updated config comments and stepper code comments for the new changes.

- Changed stepper algorithm variable names to be more understandable in
what they actually do.

- Added a stepper lock note in default.h per user request.

- Started some code layout in handling feed holds and refactoring the
homing routine to use the main stepper algorithm instead of a seperate
version.
2013-10-29 08:31:48 -06:00
Sonny Jeon
f7429ec79b Cleaned up stepper and planner code.
- Added some compile-time error checking. Will add more in future
pushes to ensure settings are correct and within parameters that won't
break anything.

- Pushed some master branch changes with MEGA pin settings.

- Cleaned up planner code and comments to clarify some of the new
changes. Still much to do here.

- Cleaned up the new stepper code. May need to abstract some of the
segment buffer more to fix the feed holds (and integrate homing into
the main stepper routine). With what's planned, this should make the
stepper algorithm easier to attach other types of processes to it,
where it is now tightly integrated with the planner buffer and nothing
else.
2013-10-24 22:12:13 -06:00
Sonny Jeon
0cb5756b53 Fine tuning of new stepper algorithm with protected planner. Adaptive step prediction for segment buffer.
- Cleaned up the new stepper algorithm code with more commenting and
better logic flow.

- The new segment buffer now predicts the number of steps each segment
should have to execute over about 8 milliseconds each (based on the
ACCELERATION_TICKS_PER_SECOND setting). So, for when the whole segment
buffer is full, the stepper algorithm has roughly 40 milliseconds of
steps queued before it needs to refilled by the main program.

- Readjusted the max supported step rate back to 30kHz from the lower
development 20kHz. Everything still works amazing great and the test
CNC machine still runs twice as fast with the new stepper algorithm and
planner.

- Upped the standard serial baudrate to 115200 baud, as it is clear
that the bottleneck is the serial interface. Will now support this, as
well as the old 9600 baud, in new firmware builds.
2013-10-14 21:21:56 -06:00
Sonny Jeon
8a10654b1c New stepper subsystem bug fixes.
- New stepper algorithm with the new optimized planner seems to be
working nearly twice as fast as the previous algorithm.

- For one, the planner computation overhead is probably a fraction of
what it used to be with the worst case being about half still.

- Secondly, anytime the planner plans back to the first executing
block, it no longer overwrites the block conditions and allows it to
complete without lost steps. So no matter if the streams slows, the
protected planner should keep the steppers moving without risk of lost
steps (although this still needs to be tested thoroughly and may
audibly sound weird when this happens.)

- It now seems that the bottleneck is the serial baudrate (which is
good!)
2013-10-12 10:35:26 -06:00
Sonny Jeon
805f0f219c Protected buffer works! Vast improvements to planner efficiency. Many things still broken with overhaul.
Development push. Lots still broken.

- Protected planner concept works! This is a critical precursor to
enabling feedrate overrides in allowing the planner buffer and the
stepper execution operate atomically. This is done through a
intermediary segment buffer.

- Still lots of work to be done, as this was a complete overhaul of the
planner and stepper subsystems. The code can be cleaned up quite a bit,
re-enabling some of the broken features like feed holds, and finishing
up some of the concepts

- Pushed some of the fixes from the master and edge branch to here, as
this will likely replace the edge branch when done.
2013-10-09 09:33:22 -06:00
Sonny Jeon
7a175bd2db Push old dev_2 draft to work on other things.
- **NON-FUNCTIONAL**
- Contains an old draft of separating the stepper driver direct access
to the planner buffer. This is designed to keep the stepper and planner
modules independent and prevent overwriting or other complications. In
this way, feedrate override should be able to be installed as well.
- A number of planner optimizations are installed too.
- Not sure where the bugs are. Either in the new planner optimizations,
new stepper module updates, or in both. Or it just could be that the
Arduino AVR is choking with the new things it has to do.
2013-08-19 09:24:22 -06:00
Sonny Jeon
1fa3dad206 Updates to edge/dev. Line buffer increased/planner buffer decreased. Line overflow feedback.
- Increased g-code parser line buffer to 70 characters (from 50) to
prevent some long arc commands from getting truncated.

- Decreased planner buffer from 18 to 17 blocks to free up memory for
line buffer.

- Added a line buffer overflow feedback error (Thanks @BHSPitMonkey!)
2013-04-05 09:21:52 -06:00
Sonny Jeon
08baabc63c Minor updates to code and commenting. 2013-03-28 10:11:41 -06:00
Sonny Jeon
49f703bb2c Update README.md 2013-03-22 08:45:46 -06:00
Sonny Jeon
3c9c516a47 Untested! Soft limits, max travel, homing changes, new settings.
- WARNING: Completely untested. Will later when there is time. Settings
WILL be overwritten, as there are new settings.

- Soft limits installed. Homing must be enabled for soft limits to work
correctly. Errors out much like a hard limit, locking out everything
and bringing up the alarm mode. Only difference is it forces a feed
hold before doing so. Position is not lost.

- IMPORTANT: Homing had to be updated so that soft limits work better
with less CPU overhead. When homing completes, all axes are assumed to
exist in negative space. If your limit switch is other side, the homing
cycle with set this axis location to the max travel value, rather than
zero.

- Update mc_line() to accept an array, rather than individual variables.

- Added an mc_auto_cycle_start() function handle this feature.
Organization only.

-
2013-03-21 19:22:07 -06:00
Sonny Jeon
e3cfa93d97 G-code updates for G10 L2 and L20.
- LinuxCNC's g-code definitions changed for G10. Updated to their
descriptions.
2013-03-19 11:33:04 -06:00
Sonny Jeon
aae1089051 Pushed minor changes. Thanks @Protoneer! 2013-03-12 18:10:24 -06:00
Sonny Jeon
b06643a2e0 Bug fix to-do note on soft limit checks. Not yet completed. 2013-03-01 10:50:36 -07:00
Sonny Jeon
74b2af3c2f Minor changes and added notes to soft limits routines.
- Changed up mc_line to accept an array rather than individual x,y,z
coordinates. Makes some of the position data handling more effective,
especially for a 4th-axis later on.

- Changed up some soft limits variable names.
2013-03-01 09:55:10 -07:00
Sonny Jeon
7951b83294 Merge pull request #193 from bungao/soft_limts
integrating soft limits
2013-02-26 09:35:30 -08:00
Jens Geisler
a0f430d188 bugfix: uninitiallized curr_block->new_entry_speed_sqr lead to step loss
in some cases
2013-02-26 08:40:43 +01:00
bungao
b75e95c880 integrating soft limits 2013-02-26 13:55:12 +11:00
Sonny Jeon
74bdc32332 Added some prelimary notes to new changes. 2013-02-22 14:11:14 -07:00
Sonny Jeon
a85e1b80f7 Push additional updates from @jgeisler0303 2013-02-22 13:23:20 -07:00
Jens Geisler
ea09ddba99 changed atomic access for updating the acceleration profile
the stepper interrupt is only halted when necessary and for the shortest
time possible (8% cycle time)
2013-02-22 16:36:27 +01:00
Sonny Jeon
67608a5014 Merge pull request #188 from jgeisler0303/new_planner
New planner commits merge into dev branch.
2013-02-20 08:25:03 -08:00
Sonny Jeon
40d8b8bf66 Update README.md 2013-02-20 09:23:12 -07:00
Jens Geisler
87864cce19 added counter for planner steps 2013-02-20 15:04:26 +01:00
Jens Geisler
dba26eff91 implemented a mixture of Sonny's MATLAB and my previous grbl planner
ontop of the edge planner
examples run byte for byte identical old and new version
2013-02-20 14:56:47 +01:00
Sonny Jeon
97d18f0ffe Merge bug fixes from recent v0.8c push. Added readme for Grbl Sim. 2013-01-18 17:02:44 -07:00
Sonny Jeon
8a1720e1a1 Merge pull request #167 from tmpvar/simulator-mac
Fix sim makefile so it works on mac
2013-01-18 09:12:03 -08:00
Elijah Insua
d0d07b7b0c Fix sim makefile so it works on mac
These changes include a path separator fix and the removal of --gc-sections which causes ld failures, and is not needed on a pc.

This patch also changes how a compiler is selected.  The makefile will now select the system compiler , which should work fine
under mingw and linux.
2013-01-18 09:22:42 -07:00
Sonny Jeon
dd06268c3d Merge pull request #112 from jgeisler0303/simulator
Grbl Simulator. Oh yeah.
2013-01-17 12:01:37 -08:00
Jens Geisler
5e76136dd3 relaunch ontop of latest grbl edge
code very messy but tested
2013-01-17 13:06:51 +01:00
Sonny Jeon
aad8b0468d Merge pull request #160 from daapp/edge
Replace some constants with N_AXIS.
2013-01-09 14:55:31 -08:00
Alexander Danilov
7c6162b90a Replace some constants with N_AXIS. 2013-01-10 02:22:45 +04:00
Sonny Jeon
53286744d5 Minor changes.
- Changed some names up and removed a plan_reset() function that is
never used.
2013-01-06 12:04:02 -07:00
Sonny Jeon
5e7c25d480 Updated README. Max step rate back at 30kHz. Acceleration minor bug fix.
- Returned the max step rate to 30kHz. The new arc algorithm works uses
so much less CPU overhead, because the segments are longer, that the
planner has no problem computing through them.

- Fixed an issue with the acceleration independence scaling. Should now
work with accelerations above 400mm/sec^2 or so.

- Updated README
2012-12-21 08:51:36 -07:00
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
37549986df Moved compiled builds to different repo. 2012-12-12 16:46:35 -07:00
Sonny Jeon
47bfe18327 Added builds folder.
In light of the downloads section in Github being removed, added a
builds folder for all of the .hex files. Hopefully these won't be
removed either.
2012-12-11 20:47:53 -07:00
Sonny Jeon
2dc920a8e5 Planner optimizations.
- Improved planner execution speed by 5% or more. Re-factored most of
the calculations in terms of the square of velocity. This removed a lot
of sqrt() calculations for every planner_recalculate.
2012-12-11 17:42:29 -07:00
Sonny Jeon
4f273db805 (Another) Planner bug fix.
- Oops again. Thought the new planner changes made things much better,
but there was a bug. Improvements we on the order of 20% execution time
reduction, rather than half. The increase to 30kHz Ranade timer
frequency also increased the overall overhead, so the total planner
change? Zero. But, it's still better.
2012-12-10 20:11:08 -07:00
Sonny Jeon
b7b31df3af Planner bug fix.
- Oops! Misplace an if-then statement. Should work as advertised now.
(Hopefully)
2012-12-10 19:17:22 -07:00
Sonny Jeon
3082fdbb6d Planner execution time halved and bug fixes. Increased step rate limit to 30kHz.
- Planner execute speed has been more than halved from 4ms to 1.9ms
when computing a plan for a single line segment during arc generation.
This means that Grbl can now run through an arc (or complex curve)
twice as fast as before without starving the buffer. For 0.1mm arc
segments, this means about the theoretical feed rate limit is about
3000mm/min for arcs now.

- Increased the Ranade timer frequency to 30kHz, as there doesn't seem
to be any problems with increasing the frequency. This means that the
maximum step frequency is now back at 30kHz.

- Added Zen Toolworks 7x7 defaults.
2012-12-10 18:50:18 -07:00
Sonny Jeon
9ba117c1bb New stepper algorithm. Optimized planner.
- Brand-new stepper algorithm. Based on the Pramod Ranade inverse time
algorithm, but modified to ensure step events are exact. Currently
limited to about 15kHz step rates, much more to be done to enable 30kHz
again.

- Removed Timer1. Stepper algorithm now uses Timer0 and Timer2.

- Much improved step generation during accelerations. Smoother. Allows
much higher accelerations (and speeds) than before on the same machine.

- Cleaner algorithm that is more easily portable to other CPU types.

- Streamlined planner calculations. Removed accelerate_until and
final_rate variables from block buffer since the new stepper algorithm
is that much more accurate.

- Improved planner efficiency by about 15-20% during worst case
scenarios (arcs).

- New config.h options to tune new stepper algorithm.
2012-12-08 15:00:58 -07:00
Sonny Jeon
bba633101a G28/G30 post move bug fix. Altered file permissions. 2012-11-25 22:02:33 -07:00
Sonny Jeon
9e0ce55dbc Updated interface protocol. Fixed M2 bug.
- Updated interface protocol to play nicer with interface programs. All
Grbl responses beginning with '$' signifies a setting. Bracketed '[]'
responses are feedback messages containing either state, parameter, or
general messages. Chevron '<>' response are from the real-time status
messages, i.e. position.

- M2 Program end command was causing a system alarm. Fixed. Thanks
@blinkenlight !
2012-11-19 17:39:40 -07:00
Sonny Jeon
b3f5536530 Updated readme 2012-11-18 21:03:58 -07:00
Sonny Jeon
d85238cc9b Homing search sequence now compile-time option. New defaults.h file. Tidying up.
- The homing sequence is now a compile-time option, where a user can
choose which axes(s) move in sequence during the search phase. Up to 3
sequences. Works with the locating phase and the pull-off maneuver.

- New defaults.h file to store user generated default settings for
different machines. Mainly to be used as a central repo, but each set
may be select to be compiled in as a config.h define.
2012-11-18 19:52:16 -07:00