Wykres commitów

397 Commity (015d5fa19105f90694ca46986fa264893bc7155a)

Autor SHA1 Wiadomość Data
Krzysztof Foltman 015d5fa191 Fixed atomic access to flags in sys.execute.
This seems to fix the bug that caused Grbl to hang during some operations,
especially jogging.
2014-06-26 23:06:26 +01:00
Sonny Jeon 8ed8005f6c Various minor g-code parser fixes.
- Updated the mantissa calculation that checks for non-integer values
and GXX.X commands that aren’t supported. There was a potential uint8
overflow issue.

- Fixed g-code parser bug related to not using the correct modal
struct. G10 P0 not selecting the current coordinate system when a
G55-59 is issued in the same line.

- Fixed g-code parser bug related to not using the correct modal
struct. Target position locations were not computed correctly when
G90/91 distance modes were changed in the same line. It was using the
previous state, rather than the current block.
2014-05-31 21:58:59 -06:00
Sonny Jeon 9439e43975 Fixed spindle/coolant/dwell state check. 2014-05-29 15:41:53 -06:00
Sonny Jeon 532c359a11 Major g-code parser overhaul. 100%* compliant. Other related updates.
- Completely overhauled the g-code parser. It’s now 100%* compliant. (*
may have some bugs). Being compliant, here are some of the major
differences.

- SMALLER and JUST AS FAST! A number of optimizations were found that
sped things up and allowed for the more thorough error-checking to be
installed without a speed hit. Trimmed a lot of ‘fat’ in the parser and
still was able to make it significantly smaller than it was.

- No default feed rate setting! Removed completely! This doesn’t exist
in the g-code standard. So, it now errors out whenever it’s undefined
for motions that require it (G1/2/3/38.2).

- Any g-code parser error expunges the ENTIRE block. This means all
information is lost and not passed on to the running state. Before some
of the states would remain, which could have led to some problems.

- If the g-code block passes all of the error-checks, the g-code state
is updated and all motions are executed according to the order of
execution.

- Changes in spindle speed, when already running, will update the
output pin accordingly. This fixes a bug, where it wouldn’t update the
speed.

- Update g-code parser error reporting. Errors now return detailed
information of what exact went wrong. The most common errors return a
short text description. For less common errors, the parser reports
‘Invalid gcode ID:20’, where 20 is a error ID. A list of error code IDs
and their descriptions will be documented for user reference elsewhere
to save flash space.

- Other notable changes:

- Added a print integer routine for uint8 variables. This saved
significant flash space by switching from a heavier universal print
integer routine.

- Saved some flash space with our own short hypotenuse calculation

- Some arc computation flash and memory optimizations.
2014-05-25 16:05:28 -06:00
Sonny Jeon 06432c9de9 Comment corrections and function call update. 2014-03-13 14:32:29 -06:00
Sonny Jeon 5310055408 Merge pull request #373 from EliteEng/dev
Added Probing to Mega2560 and fixed Shapeoko2 compile error
2014-03-13 14:29:42 -06:00
Rob Brown 60dd609b79 Added Probing to Mega2560 and fixed Shapeoko2 compile error 2014-03-11 09:23:39 +08:00
henols d3bf28f025 Probing command gets stuck in hold if several g38.2 are submitted
Ex.
G0 X0 Y0 Z0
G38.2 Z-10 F100
G10 L20 P0 Z0
G0 Z2
G38.2 Z-1 F50
G10 L20 P0 Z0
G0 Z2
G0 X0 Y0
G38.2 Z-1 F100
G0 Z2
2014-03-11 09:10:47 +08:00
Sonny Jeon 2168bb1cf9 Merge pull request #368 from henols/dev
Probing command gets stuck in hold if several g38.2 are submitted
2014-03-07 14:07:43 -07:00
henols 3d053d800c Probing command gets stuck in hold if several g38.2 are submitted
Ex.
G0 X0 Y0 Z0
G38.2 Z-10 F100
G10 L20 P0 Z0
G0 Z2
G38.2 Z-1 F50
G10 L20 P0 Z0
G0 Z2
G0 X0 Y0
G38.2 Z-1 F100
G0 Z2
2014-03-07 19:33:57 +01:00
Sonny Jeon 76ab1b6a42 G38.2 probe feature rough draft installed. Working but needs testing.
- G38.2 straight probe now supported. Rough draft. May be tweaked more
as testing ramps up.

- G38.2 requires at least one axis word. Multiple axis words work too.
When commanded, the probe cycle will move at the last ‘F’ feed rate
specified in a straight line.

- During a probe cycle: If the probe pin goes low (normal high), Grbl
will record that immediate position and engage a feed hold. Meaning
that the CNC machine will move a little past the probe switch point, so
keep federates low to stop sooner. Once stopped, Grbl will issue a move
to go back to the recorded probe trigger point.

- During a probe cycle: If the probe switch does not engage by the time
the machine has traveled to its target coordinates, Grbl will issue an
ALARM and the user will be forced to reset Grbl. (Currently G38.3 probe
without error isn’t supported, but would be easy to implement later.)

- After a successful probe, Grbl will send a feedback message
containing the recorded probe coordinates in the machine coordinate
system. This is as the g-code standard on probe parameters specifies.

- The recorded probe parameters are retained in Grbl memory and can be
viewed with the ‘$#’ print parameters command. Upon a power-cycle, not
a soft-reset, Grbl will re-zero these values.

- Moved ‘$#’ command to require IDLE or ALARM mode, because it accesses
EEPROM to fetch the coordinate system offsets.

- Updated the Grbl version to v0.9d.

- The probe cycle is subject to change upon testing or user-feedback.
2014-02-28 22:03:26 -07:00
Sonny Jeon 4d7ca76f6c Probe cycle line numbers ifdef fixes to get it to compile.
- Updated some of the ifdefs when disabling line numbers feature.
Getting messy with this compile-time option. This will likely get
cleaned up later.

- This is just a push to get the new probing code to compile. Testing
and optimization of the code will soon follow and be pushed next.
2014-02-27 22:30:24 -07:00
Sonny Jeon 387a1b9f84 Merge pull request #362 from robgrz/dev
Minimal probing cycle working.  Supports both G38.2 for error and G38.3 ...
2014-02-27 20:51:38 -07:00
Sonny Jeon 8f8d8e2887 Added grbl planner Matlab simulator for test reference. Updated line number compile-time option.
- Added a grbl planner simulation tool that was written in Matlab and
Python. It was used to visualize the inner workings of the planner as a
program is streamed to it. The simulation assumes that the planner
buffer is empty, then filled, and kept filled. This is mainly for users
to see how the planner works.

- Updated some of the compile-time ifdefs when enabling line numbers.
The leaving the un-used line numbers in the function calls eats a
non-neglible amount of flash memory. So the new if-defs remove them.
2014-02-26 12:10:07 -07:00
Robert Grzesek 0a46dfe0b9 Minimal probing cycle working. Supports both G38.2 for error and G38.3 when no errors are desired. 2014-02-25 12:19:52 -08:00
Sonny Jeon 1fd45791a5 Minor updates to line number feature.
- Changed line number integer types from unsigned to signed int32.
G-code mandates values cannot exceed 99999. Negative values can be used
to indicate certain modes.

- Homing cycle line number changed to -1, as an indicator.

- Fixed a reporting define for the spindle states that was broken by
the last merge.
2014-02-19 07:48:09 -07:00
Sonny Jeon 9c95c1439f Merge pull request #356 from robgrz/dev
Line number reporting as compile-time option.
2014-02-19 07:32:51 -07:00
Sonny Jeon b332d6edbb Commenting updates. Minor bug fix with exit of soft limit event. 2014-02-19 07:21:40 -07:00
Robert Grzesek 2307563d8a Merge commit 'cd71a90ce8a770e0030ed6c9bac805b89724e275' into dev
Conflicts:
	limits.c
	motion_control.c
	report.c
2014-02-18 18:23:39 -08:00
Sonny Jeon 3df61e0ec5 Homing and feed hold bug fixes.
WARNING: Bugs may still exist. This branch is a work in progress and
will be pushed to the edge branch when at beta stability. Use at your
own risk.

- Homing freezing issue fixed. Had to do with the cycle stop flag being
set incorrectly after the homing cycles and before the pull-off
maneuver. Now resets the stepper motors before this can happen.

- Fixed an issue with a rare feed hold failure. Had to do with feed
hold ending exactly at the end of a block. The runtime protocol now
sets the QUEUED and IDLE states appropriately when this occurs. Still
need to clean this code up however, as it’s patched rather than written
well.

- Updated version build via $I command.

- Forgot to comment on a new feature for the last commit. Since steps
are integers and millimeters traveled are floats, the old step segment
generator ignored the step fraction differences in generating the
segment velocities. Didn’t see like it would be much of a big deal, but
there were instances that this would be a problem, especially for very
slow feed rates. The stepper algorithm now micro-adjusts the segment
velocities based on the step fractions not executed from the previous
segment. This ensures that Grbl generates the velocity profiles EXACTLY
and noticeably improves overall acceleration performance.
2014-02-15 13:13:46 -07:00
Sonny Jeon 50fbc6e297 Refactoring and lots of bug fixes. Updated homing cycle.
WARNING: There are still some bugs to be worked out. Please use caution
if you test this firmware.

- Feed holds work much better, but there are still some failure
conditions that need to be worked out. This is the being worked on
currently and a fix is planned to be pushed next.

- Homing cycle refactoring: Slight adjustment of the homing cycle to
allow for limit pins to be shared by different axes, as long as the
shared limit pins are not homed on the same cycle. Also, removed the
LOCATE_CYCLE portion of the homing cycle configuration. It was
redundant.

- Limit pin sharing: (See above). To clear up one or two limit pins for
other IO, limit pins can now be shared. For example, the Z-limit can be
shared with either X or Y limit pins, because it’s on a separate homing
cycle. Hard limit will still work exactly as before.

- Spindle pin output fixed. The pins weren’t getting initialized
correctly.

- Fixed a cycle issue where streaming was working almost like a single
block mode. This was caused by a problem with the spindle_run() and
coolant_run() commands and issuing an unintended planner buffer sync.

- Refactored the cycle_start, feed_hold, and other runtime routines
into the runtime command module, where they should be handled here
only. These were redundant.

- Moved some function calls around into more appropriate source code
modules.

- Fixed the reporting of spindle state.
2014-02-09 10:46:34 -07:00
Robert Grzesek cd71a90ce8 Made line number reporting optional via config.h 2014-02-06 15:19:30 -08:00
Robert Grzesek 6fdb35a7da Initial line number reporting 2014-02-06 15:10:27 -08:00
Sonny Jeon cc9afdc195 Lots of re-organization and cleaning-up. Some bug fixes.
- Added a new source and header file called system. These files contain
the system commands and variables, as well as all of the system headers
and standard libraries Grbl uses. Centralizing some of the code.

- Re-organized the include headers throughout the source code.

- ENABLE_M7 define was missing from config.h. Now there.

- SPINDLE_MAX_RPM and SPINDLE_MIN_RPM now defined in config.h. No
uncommenting to prevent user issues. Minimum spindle RPM now provides
the lower, near 0V, scale adjustment, i.e. some spindles can go really
slow so why use up our 256 voltage bins for them?

- Remove some persistent variables from coolant and spindle control.
They were redundant.

- Removed a VARIABLE_SPINDLE define in cpu_map.h that shouldn’t have
been there.

- Changed the DEFAULT_ARC_TOLERANCE to 0.002mm to improve arc tracing.
Before we had issues with performance, no longer.

- Fixed a bug with the hard limits and the software debounce feature
enabled. The invert limit pin setting wasn’t honored.

- Fixed a bug with the homing direction mask. Now is like it used to
be. At least for now.

- Re-organized main.c to serve as only as the reset/initialization
routine. Makes things a little bit clearer in terms of execution
procedures.

- Re-organized protocol.c as the overall master control unit for
execution procedures. Not quite there yet, but starting to make a
little more sense in how things are run.

- Removed updating of old settings records. So many new settings have
been added that it’s not worth adding the code to migrate old user
settings.

- Tweaked spindle_control.c a bit and made it more clear and consistent
with other parts of Grbl.

- Tweaked the stepper disable bit code in stepper.c. Requires less
flash memory.
2014-01-10 20:22:10 -07:00
Sonny Jeon 7a85ab896d Updates to some stepper algorithm commenting 2014-01-05 11:54:59 -07:00
Sonny Jeon 3c3382ff75 New build info feature. (per @Analogreality request)
- New build info feature. Hidden command ‘$I’ will print the build info
for your Grbl firmware. Users may also write an identifying message
within it via ‘$I=‘ with up to 32 characters. (no more, or else it will
break).

- Adjusted the max number of startup lines to 3. Majority of people
will only need one.

- Fixed a compile error with spindle_control.c. A rogue #endif was
causing problems.
2014-01-05 10:27:34 -07:00
Sonny Jeon 1baff785f5 Variable spindle output. Resolved conflicts in last push.
Resolve conflicts.
2014-01-04 12:13:49 -07:00
Sonny Jeon 8b5f306851 Cleaned up variable spindle output (PWM). Code and config comments.
- Variable spindle speed output as a configuration option. Thanks
@EliteEng! When enabled, the Z-limit (D11) and spindle enable(D12) pins
switch to allow access to the hardware PWM output on pin D11.
Otherwise, everything should work as it does.

- Removed option for inverting the spindle and coolant enable pins.
This is a safety hazard, especially for the spindle. When Grbl
initializes, all pins are momentarily low until it finishes booting. If
an invert is enabled, this means the spindles can be energized briefly
during this time. If users need signal inversion, it’s recommended to
just wire in an inversion circuit instead.

- Cleared out references to spindle variable output in terms of step
signal. This isn’t complete and requires more deliberation before
installing.

- Cleared up and cleaned up some code and config comments.
2014-01-04 12:12:44 -07:00
Sonny Jeon 0104cad56a Merge pull request #322 from EliteEng/dev
Update to fix compile error
2014-01-03 06:23:39 -08:00
Rob Brown 1c4097352d Update to fix compile error
Update to fix compile error
2014-01-03 19:35:56 +08:00
Sonny Jeon e7cd94e2bc Merge pull request #318 from EliteEng/dev
PWM Spindle Control and Invert Spindle & Coolant Pins
2014-01-02 16:56:02 -08:00
Rob Brown ce5f94d675 Update spindle_control.c
Updated spindle_control.c due to compile error.
2014-01-03 07:42:22 +08:00
Sonny Jeon f8dd8fa54d Fix for M7/8/9 modal group checks. Updated AMASS frequency cutoffs and code cleaned.
- Updated Grbl version to 0.9c and build number.

- G-code parser was missing modal group violation checks for M7/8/9
commands. Added them.

- Updated the Adaptive Multi-Axis Step Smoothing (AMASS) cutoff
frequencies so that the trade between the 16-bit Timer1 accuracy and
the level step smoothing are somewhat better balanced. (Smoothing isn’t
free, but a higher accuracy timer would provide high cutoff
frequencies.)
2014-01-02 12:12:35 -07:00
Rob Brown c0381799eb PWM Spindle Control and Invert Spindle & Coolant Pins
PWM Spindle Control and Invert Spindle & Coolant Pins
2014-01-02 12:42:22 +08:00
Sonny Jeon f10bad43b2 Minor bug fixes: Homing travel calculations. Cycle resuming after spindle and dwell commands.
- Homing travel calculations fixed. It was computing the min travel
rather than max.

- Auto-start disable and pausing after spindle or dwell commands.
Related to plan_synchronize() function call. Now fixed, but still need
to work on the system state.

- Pushed a fix to make this branch more Arduino IDE compatible. Removed
extern call in nuts_bolts.c

- Updated the stepper configuration option of enabling or disabling the
new Adaptive Multi-Axis Step Smoothing Algorithm. Now works either way.

- Updated some copyright info.
2013-12-30 22:02:05 -07:00
Sonny Jeon 47cd40c8dc Incomplete push but working. Lots more stuff. More to come.
- NEW! An active multi-axis step smoothing algorithm that automatically
adjusts dependent on step frequency. This solves the long standing
issue to aliasing when moving with multiple axes. Similar in scheme to
Smoothieware, but more advanced in ensuring a more consistent CPU
overhead throughout all frequencies while maintaining step exactness.

- Switched from Timer2 to Timer0 for the Step Port Reset Interrupt.
Mainly to free up hardware PWM pins.

- Seperated the direction and step pin assignments, so we can now move
them to seperate ports. This means that we can more easily support 4+
axes in the future.

- Added a setting for inverting the limit pins, as so many users have
request. Better late than never.

- Bug fix related to EEPROM calls when in cycle. The EEPROM would kill
the stepper motion. Now protocol mandates that the system be either in
IDLE or ALARM to access or change any settings.

- Bug fix related to resuming the cycle after a spindle or dwell
command if auto start has been disabled. This fix is somewhat temporary
or more of a patch. Doesn’t work with a straight call-response
streaming protocol, but works fine with serial buffer pre-filling
streaming that most clients use.

- Renamed the pin_map.h to cpu_map.h to more accurately describe what
the file is.

- Pushed an auto start bug fix upon re-initialization.

- Much more polishing to do!
2013-12-30 18:44:46 -07:00
Sonny Jeon 5ab2bb7767 Incomplete dev code push, but working. Lots of updates/fixes/improvements. Much still to polish.
- Ugh. Github just erased my list of improvements and changes due to a
conflict and forcing me to resolve it. Hope this goes through.

- Major stepper algorithm change. Trashed the old v0.9 edge
branch-style stepper algorithm. It’s fine, but it was susceptible to
aliasing noise when moving very slow or very fast. It also had a bit of
CPU overhead. It was written to solve a standing issue with v0.8
master, where it couldn’t generate a smooth acceleration abocve
10-15kHz. But, with new step segment buffer in v0.9c, it inadvertently
fixed the acceleration problem with v0.8 stepper algorithm. So, what
does it mean for you? Smoother stepper pulses and likely higher step
frequencies.

- Stepper algorithm now uses Timer1 and Timer2, instead of Timer0 and
Timer2. Timers 0 and 2 can be swapped if there is an issue.

- With the old v0.8 stepper algorithm, the STEP_DELAY_PULSE
configuration option is also back.

- NEW! Hard limit software debouncing. Grbl now employs the AVR’s
watchdog timer as a way to monitor the hard limit pins and checking
their states after a delay. This is a simple software debouncing
technique and may help alleviate some of the false trigger some users
have been complaining about. BUT, this won’t fix electric noise issues!

- Fixed an issue with the new homing cycle routine where it wasn’t
honoring the acceleration and axis speed limits depending on the homing
cycle mask. Now does. Also, updated the homing direction mask code to
be a little cleaner.

- Moved the main part of the homing cycle control and execution to
motion_control.c, where it fits better.

- Removed the STATE_INIT system state as it was redundant. Made the
system states into bitflags so multiple system states can be checked
via one if statement.

- Reorganized the power-up routine to work with the new system states.
2013-12-29 20:51:48 -07:00
Sonny Jeon bfb8639606 Merge branch 'dev' of https://github.com/grbl/grbl into dev
Conflicts:
	limits.c
2013-12-29 20:36:00 -07:00
Sonny Jeon 903b462b2e Merge branch 'dev' of https://github.com/grbl/grbl into dev
Conflicts:
	limits.c
2013-12-29 20:34:51 -07:00
Sonny Jeon 8550d2c3f9 Merge pull request #312 from scottrcarlson/dev
Fixed homing_dir_mask functionality in the re-written homing_cycle.
2013-12-27 12:26:27 -08:00
Scott R Carlson eefc25be91 Hard Limits configured for active high.
Added the use of homing_dir_mask to homing_cycle
2013-12-27 15:09:00 -05:00
Sonny Jeon 3054b2df77 Revamped homing cycle. Axis limits and max travel bug fixes. Build info. Refactored config.h.
- Revamped and improved homing cycle. Now tied directly into the main
planner and stepper code, which enables much faster homing seek rates.
Also dropped the compiled flash size by almost 1KB, meaning 1KB more
for other features.

- Refactored config.h. Removed obsolete defines and configuration
options. Moved lots of “advanced” options into the advanced area of the
file.

- Updated defaults.h with the new homing cycle. Also updated the
Sherline 5400 defaults and added the ShapeOko2 defaults per user
submissions.

- Fixed a bug where the individual axes limits on velocity and
acceleration were not working correctly. Caused by abs() returning a
int, rather than a float. Corrected with fabs(). Duh.

- Added build version/date to the Grbl welcome message to help indicate
which version a user is operating on.

- Max travel settings were not being defaulted into the settings EEPROM
correctly. Fixed.

- To stop a single axis during a multi-axes homing move, the stepper
algorithm now has a simple axis lock mask which inhibits the desired
axes from moving. Meaning, if one of the limit switches engages before
the other, we stop that one axes and keep moving the other.
2013-12-10 22:33:06 -07:00
Sonny Jeon b562845d9d Deceleration to zero speed improvements. Update defaults.
- A minor issue with deceleration ramps when close to zero velocity.
Should be virtually unnoticeable for most CNC systems, but fixed in
this push and accurate to physics.

- Updated some of the junction deviation defaults. Because the new
stepper algorithm can easily maximize a CNC machine’s capabilities or
simply go much faster, this means the speed in which it enters
junctions has to be a little more constrained. Meaning that, we have to
slow a little bit down more so that we don’t exceed the acceleration
limits of the stepper motors.
2013-12-07 20:08:24 -07:00
Sonny Jeon a87f25773c Pushed limits active high option. Updated defaults.h. Misc bug fixes. Cleaned up codebase.
- Pushed limit switch active high option (i.e. NC switches).

- Updated defaults.h to be in-line with the new settings.

- Refactored feed hold handling and step segment buffer to be more
generalized in effort to make adding feedrate overrides easier in the
future. Also made it a little more clean.

- Fixed G18 plane select issue. Now ZX-plane, rather than XZ-plane, per
right hand rule.

- Cleaned some of the system settings by more accurately renaming some
of the variables and removing old obsolete ones.

- Declared serial.c rx_buffer_tail to be volatile. No effect, since
avr-gcc automatically does this during compilation. Helps with porting
when using other compilers.

- Updated version number to v0.9b.

- Updates to README.md
2013-12-07 08:40:25 -07:00
Sonny Jeon 2f6663a0b9 Reinstated feed holds into new stepper algorithm and planner. Rough draft, but working.
- Reinstated the feed hold feature with the new stepper algorithm and
new optimized planner. It works, but will be re-factored a bit soon to
clean up the code.

- At this point, feedrate overrides may need to be installed in the
v1.0 version of grbl, while this version will likely be pushed to the
edge branch soon and pushed to master after the bugs have been squashed.

- Measured the overall performance of the new planner and stepper
algorithm on an oscilloscope. The new planner is about 4x faster than
before, where it is completing a plan in around 1ms. The stepper
algorithm itself is minutely faster, as it is a little lighter. The
trade-off in the increased planner performance comes from the new step
segment buffer. However, even in the worse case scenario, the step
segment buffer generates a new segment with a typical 0.2 ms, and the
worse case is 1ms upon a new block or replanning the active block.
Added altogether, it’s argubly still twice as efficient as the old one.
2013-12-04 21:49:24 -07:00
Sonny Jeon b36e30de2e Yet another major stepper algorithm and planner overhaul.
- Overhauled the stepper algorithm and planner again. This time
concentrating on the decoupling of the stepper ISR completely. It is
now dumb, relying on the segment generator to provide the number of
steps to execute and how fast it needs to go. This freed up lots of
memory as well because it made a lot tracked variables obsolete.

- The segment generator now computes the velocity profile of the
executing planner block on the fly in floating point math, instead of
allowing the stepper algorithm to govern accelerations in the previous
code. What this accomplishes is the ability and framework to (somewhat)
easily install a different physics model for generating a velocity
profile, i.e. s-curves.

- Made some more planner enhancements and increased efficiency a bit.

- The changes also did not increase the compiled size of Grbl, but
decreased it slightly as well.

- Cleaned up a lot of the commenting.

- Still much to do, but this push works and still is missing feedholds
(coming next.)
2013-11-22 17:35:58 -07:00
Sonny Jeon 2eb5acaa33 Another merge fix. 2013-10-29 19:43:40 -06:00
Sonny Jeon b8f0a2399e Merge fixes. 2013-10-29 19:28:44 -06:00
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