-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'tool' module #3995
Merged
Merged
Add 'tool' module #3995
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
cdc71da
Added 'tool' module to control PWM-tools like lasers or spindles via …
Cirromulus cda450e
Moved timeout functionality to output_pin
Cirromulus 3ba62ab
Added documentation for using powered tools
Cirromulus 40acc7c
Testing run without register_lookahead_callback
Cirromulus eadd811
Keep constant time offset, dont accumulate margin
Cirromulus 8ba87dd
Fixup: mcu_pin, not mcu_pwm
Cirromulus c57abb6
Reduced command wait duration
Cirromulus 6838763
Renamed timeout
Cirromulus 87a57e4
First update needs to be scheduled into the future
Cirromulus 7b9dd0e
Testing timer-self-rescheduling
Cirromulus 6b8cfb1
Use actual function
Cirromulus ec89378
Updated documentation
Cirromulus 84b2629
Code cleanup and rename of host_acknowledge_timeout to maximum_mcu_du…
Cirromulus d5892db
Added more documentation
Cirromulus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
This document describes how to setup a PWM-controlled laser or spindle | ||
using `output_pin` and some macros. | ||
|
||
|
||
## How does it work? | ||
With re-purposing the printhead's fan pwm output, you can control | ||
lasers or spindles. | ||
This is useful if you use switchable print heads, for example | ||
the E3D toolchanger or a DIY solution. | ||
Usually, cam-tools such as LaserWeb can be configured to use `M3-M5` | ||
commands, which stand for _spindle speed CW_ (`M3 S[0-255]`), | ||
_spindle speed CCW_ (`M4 S[0-255]`) and _spindle stop_ (`M5`). | ||
|
||
|
||
**Warning:** When driving a laser, keep all security precautions | ||
that you can think of! Diode lasers are usually inverted. | ||
This means, that when the MCU restarts, the laser will be | ||
_fully on_ for the time it takes the MCU to start up again. | ||
For good measure, it is recommended to _always_ wear appropriate | ||
laser-goggles of the right wavelength if the laser is powered; | ||
and to disconnect the laser when it is not needed. | ||
Also, you should configure a safety timeout, | ||
so that when your host or MCU encounters an error, the tool will stop. | ||
|
||
For an example configuration, see `config/sample-pwm-tool-cfg`. | ||
|
||
## Current Limitations | ||
|
||
There is a limitation of how frequent PWM updates may occur. | ||
While being very precise, a PWM update may only occur every 0.1 seconds, | ||
rendering it almost useless for raster engraving. | ||
However, there exists an [experimental branch](https://github.com/Cirromulus/klipper/tree/laser_tool) with its own tradeoffs. | ||
In long term, it is planned to add this functionality to main-line klipper. | ||
|
||
## Commands | ||
|
||
`M3/M4 S<value>` : Set PWM duty-cycle. Values between 0 and 255. | ||
`M5` : Stop PWM output to shutdown value. | ||
|
||
## Laserweb Configuration | ||
|
||
If you use Laserweb, a working configuration would be: | ||
|
||
GCODE START: | ||
M5 ; Disable Laser | ||
G21 ; Set units to mm | ||
G90 ; Absolute positioning | ||
G0 Z0 F7000 ; Set Non-Cutting speed | ||
|
||
GCODE END: | ||
M5 ; Disable Laser | ||
G91 ; relative | ||
G0 Z+20 F4000 ; | ||
G90 ; absolute | ||
|
||
GCODE HOMING: | ||
M5 ; Disable Laser | ||
G28 ; Home all axis | ||
|
||
TOOL ON: | ||
M3 $INTENSITY | ||
|
||
TOOL OFF: | ||
M5 ; Disable Laser | ||
|
||
LASER INTENSITY: | ||
S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this mention ok for you, or shall this be kept out until the PR is actually started?