Skip to content
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 M850 code for setting sheet label and offsets #2201

Merged
merged 6 commits into from
Feb 17, 2023

Conversation

vintagepc
Copy link
Contributor

@vintagepc vintagepc commented Sep 12, 2019

Per #2091 and #2153
This adds M-code support for reading and setting sheet labels and offsets to satisfy advanced user needs. Logic being, if you know how to manually send g-codes to your printer, you're advanced enough to handle the responsibility.
I chose 850 because it's near other first-layer/levelling parameters and appears to be unused in official marlin as well.

Usage:

  • M850 S[sheet] Z[offset] L[label] B[Bed temp] P[PINDA temp]
  • Z and L are optional, if one or both are missing the current values are reported instead.
  • If L and/or Z are specified, the sheet's values are updated.
  • Z range is validated
  • Sheet index is validated
  • Requesting info (no L or Z) on an uncalibrated sheet reports as such.

Note: Pronterface capitalizes anything sent. To use lowercase in your sheet names you'll need to use a different terminal program.

Closes #2091
Closes #2153
Closes #3534

@vertigo235
Copy link

ah, cool!

@DRracer
Copy link
Collaborator

DRracer commented Sep 13, 2019

@vintagepc very well ;) . Btw. there is already an M851 for setting z-offset: http://marlinfw.org/docs/gcode/M851.html - which in our terminology is live-adjust-z, aka sheet calibration value.
Do you see fit using/improving the M851?

@vintagepc
Copy link
Contributor Author

vintagepc commented Sep 13, 2019

@DRracer 🤦‍♂ Not sure how I missed that when looking for available gcodes. I'll update it to be M851 instead.

Also I see I left in a magic number in reading the sheet name; I'll change the 7 to a sizeof() too.
Can I ask what the intent of the additional sheet struct fields is? (bed temp, e.g.) I don't think they are currently used but I'd be happy to implement ability to specify those if it is planned to be relevant.

@DRracer
Copy link
Collaborator

DRracer commented Sep 13, 2019

@vintagepc don't worry, such things happen ;) .
The temperature will be used right away, we are preparing another long awaited/requested feature. Stay tuned ;)

@vintagepc
Copy link
Contributor Author

OK, I'll add optional arguments for those as well then.

@vintagepc
Copy link
Contributor Author

vintagepc commented Sep 13, 2019

Looking at the code, M851 doesn't look like something I want to interfere with; that sets cs.z_probe_offset which is something entirely different from the live Z value, and used in some critical places (MBL, for example). My printer has it currently set at -0.40. If I'm reading that right it is a correction factor applied to the distance of the nozzle below the edge of the PINDA (e.g., "zip tie" distance).

Edit: To clarify, the firmware has 851 already implemented, as
case CUSTOM_M_CODE_SET_Z_PROBE_OFFSET:

@vintagepc
Copy link
Contributor Author

(Updated to support B/P parameters for pinda and bed temp)

@vintagepc
Copy link
Contributor Author

Syncronized with latest MK3

@bbernhard
Copy link

Hi,

I just wanted to ask about the state of this PR here. I've already seen at least two open pull requests regarding a new gcode command, but unfortunately both of those seem to be stalled. As I am also a maintainer of several open source projects myself, I totally understand that there's only so much time to work on all the bugs and feature requests. But as the Prusa printers have such a nice sheet management system I would really love to see that somehow exposed via gcode - I think it opens a LOT of possibilities for automation and convenience features.

So, I wanted to kindly ask whether there's any chance to a feature like this merged?

Many thanks,
Bernhard

Copy link
Collaborator

@3d-gussner 3d-gussner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old but good

Fix use of removed function
Remove more stale code
@aaronevers
Copy link

Help article "Prusa-specific G-codes" needs to be updated with the M850 documentation (https://help.prusa3d.com/article/prusa-specific-g-codes_112173).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants