-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
Add M3, M4 & M5 spindle/laser commands #6268
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 M3, M4 & M5 spindle/laser commands #6268
Conversation
Should I close 6221? |
Either close #6221, or you could replace the commits in #6221 with this…
If that works, it's an interesting way to update a PR. But then, in that case, this might as well be a PR to your branch (esp. since you know how to squash commits). |
Superseded by PR #6268 |
This is #6268 |
Apparently I'm not fully awake yet. I've made a couple of silly mistakes this morning. |
Marlin/pins_ULTIMAIN_2.h
Outdated
#define SPINDLE_DIR_PIN 16 | ||
#define SPINDLE_LASER_ENABLE_PIN 17 // should have a pull up | ||
#define SPINDLE_SPEED_LASER_POWER_PIN 8 // must have a pull up | ||
#else // Case light |
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.
I'd like to find a way to get rid of lines like these in the pins files. We've been trying to make the pins files as agnostic as possible about what features are enabled, so they simply supply the recommended (or required) pins for each feature. We aren't checking the presence of a pin to enable code (as the old Marlin code did). We just check for the enabled feature, and then use whatever pins are assigned.
We've tried some different approaches to this, but generally the idea is to make sure we don't need a lot of #if
clauses in the pins files that relate to features.
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.
Do you want me to go through the files & eliminate the added #if clauses?
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.
Yes, let's just set the most sensible default pins, remove the #if clauses referring to the spindle-laser feature, and see what we have left in the pins files after that. There was a movement against requiring too many pin assignments in the main configuration files, which is why we started making the pins files more "exhaustive" on their own.
I'd say, for these pins, wrap each one in an #ifndef
clause so they are easily override-able.
#ifndef SPINDLE_DIR_PIN
#define SPINDLE_DIR_PIN 16
#endif
…etc.
We still haven't settled on how best to handle pin overrides. One universal method would be to have every pin definition be conditional on #ifndef
, but that would add a lot of noise to the pins files. The extruder auto fan pins (E0_AUTO_FAN_PIN
, etc.) follow a pattern that gives more control from the configs (since these pins also act as enable switches), but it's not the kind of technique you'd want to use for all pins.
For reference, here's how I implemented laser (including software PWM) for the MakerArm branch: The branch has later commits expanding on the multi-tool idea. |
fe0955b
to
f5e1ec7
Compare
Split up the commit into 3 so it's easier to view the implementation by itself. |
c503204
to
7c6c621
Compare
@Bob-the-Kuhn I just did a rebase, so check the pins file and make sure it's intact, exactly what you want. Particularly the last several lines. |
7c6c621
to
f81d4e6
Compare
This past week I implemented |
98e5186
to
3023249
Compare
I'm getting this ready to merge. I moved the documentation from the lengthy comment in the configuration file to a Laser/Spindle page on the website. It's pretty much the same text, just reformatted with Markdown into a more readable form. The table, especially. I'd like to have your opinion on how we might combine this PR with multi-tool support, which I've reduced to the main skeleton in this commit: Mainly I want to include it because it implements the laser with some more options. It can be a simple on/off laser or one that operates with both a 12V on/off power pin plus a 5V 25KHz PWM signal pin. It also includes another simple "foam cutter" tool that operates with |
da792bd
to
6fdd7f5
Compare
d9acbd1
to
ebaabed
Compare
ebaabed
to
14dcc1a
Compare
FANTASTIC!!! |
Rebase, cleanup of #6221 by @Bob-the-Kuhn