Bestanden opgeschoond

This commit is contained in:
2024-06-02 14:34:39 +02:00
parent b7f6cc9f55
commit c6d6fbce99
24 changed files with 0 additions and 5969 deletions

View File

@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -1,995 +0,0 @@
# klipper-macros
This is a collection of macros for the
[Klipper 3D printer firmware](https://github.com/Klipper3d/klipper). I
originally created this repo just to have a consistent set of macros shared
between my own 3D printers. But since I've found them useful, I thought other
people might as well.
## What can I do with these?
Most of these macros improve basic functionality (e.g. [selectable build sheets
](#bed-surface)) and Klipper compatability with g-code targeting Marlin
printers. However, there are also some nice extras:
* **[Schedule commands at heights and layer changes](#layer-triggers)** -
This is similar to what your slicer can already do, but I find it simpler, and
you can schedule these commands while a print is active. As an example of
usage, I added an [LCD menu item](#lcd-menus) to pause the print at the next
layer change. This way the pause won't mar the print by e.g. pausing inside
an external perimeter.
* **Dynamically scale [heaters](#heaters) and [fans](#fans)** - This makes it
easy to do things like persistently adjust fan settings during a live print,
or maintain simpler slicer profiles by moving things like a heater bump for a
hardened steel nozzle into state stored on the printer.
* **Cleaner [LCD menu interface](#lcd-menus)** - I've simplified the menus and
provided a much easier way to customize materials in the LCD menu (or at least
I think so). I've also added confirmation dialogs for commands that would
abort an active print.
* **[Optimized mesh bed leveling](#bed-mesh-improvements)** - Probes only within
the printed area, which can save a lot of time on smaller prints.
* **[Automated purge lines](#draw_purge_line)** - Set the desired extrusion
length as `variable_start_purge_length` in your config and a correctly sized
set of purge lines will be extruded in front of the print area immediately
before the print starts.
## A few warnings...
* **BACK UP YOUR FULL CONFIG BEFORE MAKING ANY CHANGES!!!** I've seen so many
newcomers desperately looking for help on public forums because they didn't
have a good config to fall back to after messing up their current config while
experimenting with other people's macros. You'll save yourself and everyone
else a whole lot of time and nuisance if you just make sure you always have a
working config backed up.
* **You really should avoid custom macros like this until you're comfortable
using Klipper with a basic config.** Advanced Klipper macros tend to rely
extensively on [monkey patching](https://en.wikipedia.org/wiki/Monkey_patch),
which can lead to problems with unusual configurations or when mixing macros
from various sources. So, you really want to know what you're doing before
including someone else's macros—particularly when including macros with
overlapping functionality from different sources.
* You must have a `heater_bed`, `extruder`, and other [sections listed
below](#klipper-setup) configured, otherwise the macros will ***force a
printer shutdown at startup***. Unfortunately, the Klipper macro system
doesn't have a more graceful way of handling this sort of thing.
* The multi-extruder and chamber heater functionality is very under-tested and
may have bugs, since I haven't used it much at all. Patches welcome.
* There's probably other stuff I haven't used enough to test thoroughly, so use
these macros at your own risk.
# Troubleshooting
* Double check that you followed the [installation instructions](#installation)
and are not seeing any console or log errors.
* Ensure that you're running the most current version of stock Klipper, and not
a fork or otherwise altered or outdated copy.
* Ensure you're using the most current version of these macros and haven't
made changes to any files in the `klipper-macros` directory.
* Ensure that you've restarted Klipper after any updates or config changes.
* Run `CHECK_KM_CONFIG` in the Klipper console and fix any errors it reports
to the console and/or logs (it won't output anything if no config errors
were detected).
* Run `_INIT_SURFACES` in the Klipper console to validate that bed surfaces are
being initialized without any errors reported to the console and/or logs.
* Verify your slicer settings and review that the gcode output is correct. Pay
particular attention the initialization portions of the gcode and the
parameters passed to PRINT_START.
# Reporting Bugs
If you've followed the troubleshooting steps and were unable to resolve the
issue you can [report a bug via Github](
https://github.com/jschuh/klipper-macros/issues/new/choose). I will probably
respond within a few days (almost certainly within a week). I probably won't
respond through other channels (e.g. Discord, Twitter), because I don't find
them useful for handling bug reports.
Some important things to remember when reporting bugs:
* **Paste the full text of the command that triggered the error, along with any
error messages printed to the console** (and relevant sections of the klipper
logs if appropriate).
* **Attach your config to the bug report.** There's generally no way to diagnose
anything without the configs.
* **Verify that your issue reproduces on the current, stock installation of
Klipper and klipper-macros.** Non-stock configurations and outdated versions
make diagnosis nearly impossible.
* Please don't treat bug reports as a substitute for following the installation
and troubleshooting instructions.
* If you file a feature request I will most likely close it (unless it's
something I was already planning on adding). Sorry, but I wrote these macros
to meet my own needs, so that's what I work on.
> **Note:** Reports that do not follow the above guidelines _**will likely be
> closed without any other action taken.**_
# Contributing
I'm happy to accept bugfix PRs. I'm also potentially open to accepting new
features or additions. However, I may decline the PR if it's something I'm not
interested in or just looks like it would be a hassle for me to maintain.
## Formatting
There's no standard style for Klipper macros, so please just try to follow the
style in the files. That stated, here are a few rules to remember:
* Wrap at 80 characters if at all possible
* Indent 2 spaces, and in line with the logical block when wrapping (no tabs)
* Prefix internal macros with `_` or `_km_`
* Prefix any sort of global state with `_KM_` (e.g. `_KM_SAVE_GCODE_STATE`)
## Commit Messages
These are the rules for commit messages, but you can also just look at the
commit log and follow the observed pattern:
* Use the 50/72 rule for commit messages: No more than 50 characters in the
title and break lines in the description at 72 characters.
* Begin the title with the module name (usually the main file being modified,
minus any extension) followed by a colon.
* Title-only commit messages are fine for simple commits, but be sure to
include a blank line after the title.
* Squash multiple commits if what you're working on makes more sense as a
single logical commit. _This might require you to do a force push on an open
PR._
# Installation
To install the macros, first clone this repository inside of your
`printer_data/config` directory with the following command.
```
git clone https://github.com/jschuh/klipper-macros.git
```
Then paste the below sections into your `printer.cfg` to get started. Or even
better, paste all of it into a seperate file in the same path as your config,
and include that file. That will make it easier if you want to remove these
macros in the future.
You may need to customize some settings for your own config. All configurable
settings are in [globals.cfg](globals.cfg#L5), and can be overridden by creating
a corresponding variable with a new value in your `[gcode_macro _km_options]`
section. _**Do not directly modify the variable declarations in globals.cfg.**_
The macro initialization assumes certain default values, and direct
modifications are likely to break things in very unexpected ways.
> **Note:** The paths in this README follow [Moonraker's data folder structure.
> ](https://moonraker.readthedocs.io/en/latest/installation/#data-folder-structure)
> You may need to change them if you are using a different structure.
> **Note:** Make sure you don't currently have any macros that provide the same
> basic function as the macros in this repository (e.g. the default
> [Mainsail](https://docs.mainsail.xyz/configuration#macros) or
> [fluidd](https://docs.fluidd.xyz/configuration/initial_setup#macros) macros).
> As a rule, you should avoid using multiple sets of macros that override the
> same base macro (unless you really know what you're doing) because conflicting
> macros can cause all sorts of weird and frustrating problems.
> **Note:** If you have a `[homing_override]` section you will need to update
> any `G28` commands in the gcode part to use `G28.6245197` instead (which is
> the renamed version of Klipper's built-in `G28`). Failure to do this will
> cause `G28` commands to error out with the message ***Macro G28 called
> recursively***.
# Klipper Setup
```
# All customizations are documented in globals.cfg. Just copy a variable from
# there into the section below, and change the value to meet your needs.
[gcode_macro _km_options]
# These are examples of some likely customizations:
# Any sheets in the below list will be available with a configurable offset.
#variable_bed_surfaces: ['smooth_1','texture_1']
# Length (in mm) of filament to load (bowden tubes will be longer).
#variable_load_length: 90.0
# Hide the Octoprint LCD menu since I don't use it.
#variable_menu_show_octoprint: False
# Customize the filament menus (up to 10 entries).
#variable_menu_temperature: [
# {'name' : 'PLA', 'extruder' : 200.0, 'bed' : 60.0},
# {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0},
# {'name' : 'ABS', 'extruder' : 245.0, 'bed' : 110.0, 'chamber' : 60}]
# Length of filament (in millimeters) to purge at print start.
#variable_start_purge_length: 30 # This value works for most setups.
gcode: # This line is required by Klipper.
# Any code you put here will run at klipper startup, after the initialization
# for these macros. For example, you could uncomment the following line to
# automatically adjust your bed surface offsets to account for any changes made
# to your Z endstop or probe offset.
# ADJUST_SURFACE_OFFSETS
# This line includes all the standard macros.
[include klipper-macros/*.cfg]
# Uncomment to include features that require specific hardware support.
# LCD menu support for features like bed surface selection and pause next layer.
#[include klipper-macros/optional/lcd_menus.cfg]
# Optimized bed leveling
#[include klipper-macros/optional/bed_mesh.cfg]
# The sections below here are required for the macros to work. If your config
# already has some of these sections you should merge the duplicates into one
# (or if they are identical just remove one of them).
[idle_timeout]
gcode:
_KM_IDLE_TIMEOUT # This line must be in your idle_timeout section.
[pause_resume]
[respond]
[save_variables]
filename: ~/printer_data/variables.cfg # UPDATE THIS FOR YOUR PATH!!!
[virtual_sdcard]
path: ~/gcode_files # UPDATE THIS FOR YOUR PATH!!!
[display_status]
# Uncomment the sections below if Fluidd complains (because it's confused).
#[gcode_macro CANCEL_PRINT]
#rename_existing: CANCEL_PRINT_FAKE_BASE
#gcode: CANCEL_PRINT_FAKE_BASE {rawparams}
```
## Slicer Configuration
### PrusaSlicer / SuperSlicer
PrusaSlicer and its variants are fairly easy to configure. Just open **Printer
Settings → Custom G-code** for your Klipper printer and paste the below text
into the relevant sections.
#### Start G-code
```
M190 S0
M109 S0
PRINT_START EXTRUDER={first_layer_temperature[initial_tool]} BED=[first_layer_bed_temperature] MESH_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} MESH_MAX={first_layer_print_max[0]},{first_layer_print_max[1]} LAYERS={total_layer_count} NOZZLE_SIZE={nozzle_diameter[0]}
; This is the place to put slicer purge lines if you haven't set a non-zero
; variable_start_purge_length to have START_PRINT automatically purge (e.g. if
; using a Mosaic Palette, which requires the slicer to generate the purge).
```
#### End G-code
```
PRINT_END
```
#### Before layer change G-code
```
;BEFORE_LAYER_CHANGE
;[layer_z]
BEFORE_LAYER_CHANGE HEIGHT=[layer_z] LAYER=[layer_num]
```
#### After layer change G-code
```
;AFTER_LAYER_CHANGE
;[layer_z]
AFTER_LAYER_CHANGE
```
### Ultimaker Cura
Cura is a bit more difficult to configure, and it comes with the following known
issues:
- Cura doesn't have proper placeholders for before and after layer changes, so
the before triggers all fire and are followed immediately by the after
triggers, all of which happens inside the layer change. This probably doesn't
matter, but it does mean that you can't use the before and after triggers to
avoid running code in the layer change.
- Cura doesn't provide the Z-height of the current layer, so it's inferred from
the current nozzle position, which will include the Z-hop if the nozzle is
currently raised. This means height based gcode triggers may fire earlier than
expected.
- Cura's **Insert at layer change** fires the `After` trigger and then the
`Before` trigger (i.e before or after the *layer*, versus before or after the
*layer change*). These macros and PrusaSlicer do the opposite, which is
something to keep in mind if you're used to how Cura does it. Note that these
macros do use an **Insert at layer change** script to force `LAYER` comment
generation, but that doesn't affect the trigger ordering.
- Cura does not provide the first layer bounding rectangle, only the model
bounding volume. This means the XY bounding box used to speed up mesh probing
may be larger than it needs to be, resulting in bed probing that's not as fast
as it could be.
Accepting the caveats, the macros work quite well with Cura if you follow the
configuration steps listed below.
#### Start G-code
```
M190 S0
M109 S0
PRINT_START EXTRUDER={material_print_temperature_layer_0} BED={material_bed_temperature_layer_0} NOZZLE_SIZE={machine_nozzle_size}
; This is the place to put slicer purge lines if you haven't set a non-zero
; variable_start_purge_length to have START_PRINT automatically purge (e.g. if
; using a Mosaic Palette, which requires the slicer to generate the purge).
```
#### End G-code
```
PRINT_END
```
#### Post Processing Plugin
Use the menu item for **Extensions → Post Processing → Modify G-Code** to
open the **Post Processing Plugin** and add the following four scripts. *The
scripts must be run in the order listed below and be sure to copy the strings
exactly, with no leading or trailing spaces.*
##### Search and Replace
- Search: `(\n;(MIN|MAX)X:([^\n]+)\n;\2Y:([^\n]+))`
- Replace: `\1\nPRINT_START_SET MESH_\2=\3,\4`
- Use Regular Expressions: ☑️
##### Search and Replace
- Search: `(\n;LAYER_COUNT:([^\n]+))`
- Replace: `\1\nINIT_LAYER_GCODE LAYERS=\2\nPRINT_START_SET LAYERS=\2`
- Use Regular Expressions: ☑️
##### Insert at layer change
- When to insert: `Before`
- G-code to insert: `;BEFORE_LAYER_CHANGE`
##### Search and Replace
- Search: `(\n;LAYER:([^\n]+))`
- Replace: `\1\nBEFORE_LAYER_CHANGE LAYER=\2\nAFTER_LAYER_CHANGE`
- Use Regular Expressions: ☑️
## Moonraker Configuration
Once you have the macros working and are comfortable using them, you can have
Moonraker keep them up to date by adding the following into your
`moonraker.conf`.
```
[update_manager klipper-macros]
type: git_repo
origin: https://github.com/jschuh/klipper-macros.git
path: ~/printer_data/config/klipper-macros # UPDATE THIS FOR YOUR PATH!!!
primary_branch: main
is_system_service: False
managed_services: klipper
```
> **Note:** I'd advise against adding the auto-update entries to Moonraker until
> you have everything working well, because it can make uninstallation a bit
> harder due to how Moonraker's autoupdate behavior.
## Removal
If you choose to uninstall these macros you basically need to reverse the
installation steps. However, the most critical parts are listed below.
### Klipper Configuration Removal
Ensure that you remove the following from your Klipper config (and any included
configs):
* The full `[gcode_macro _km_options]` section
* Any `include` sections with `klipper-macros` in the path
* `_KM_IDLE_TIMEOUT` in the `[idle_timeout]` section
If you do not have Moonraker autoupdates configured you can delete the
`klipper-macros` directory with something like the following command (adjusted
for your own paths):
```
rm -rf ~/printer_data/config/klipper-macros
```
### Slicer Configuration Removal
If you do not want to change your slicer config, you should be able to leave
it as is, because it generates only a small amount of additional gcode, and the
basic parameters should work with any other `PRINT_START` macros.
## Moonraker Configuration Removal
If you've configured Moonraker auto-updates you will need to remove the entire
`[update_manager klipper-macros]` section and restart moonraker prior to
deleting the `klipper-macros` directory, otherwise Moonraker may attempt to
recreate it. You may also find that it takes a few Moonraker update checks and
restarts before the klipper-macros section disappears from the UI.
# Command Reference
## Customization
All features are configured by setting `variable_` values in the
`[gcode_macro _km_options]` section. All available variables and their purpose
are listed in [globals.cfg](globals.cfg#L5).
> **Note:** `PRINT_START` specific customizations are [covered in more detail
below](#print-start-and-end).
### Bed Mesh Improvements
`BED_MESH_CALIBRATE_FAST`
Wraps the Klipper `BED_MESH_CALIBRATE` command to scale and redistribute the
probe points so that only the appropriate area in `MESH_MIN` and `MESH_MAX` is probed. This can dramatically reduce probing times for anything that doesn't
fill the first layer of the bed. `PRINT_START` will automatically use this for
bed mesh calibration if a `[bed_mesh]` section is detected in your config.
The following additional configuration options are available from
[globals.cfg](globals.cfg#L5).
* `variable_probe_mesh_padding` - Extra padding around the rectangle defined by
`MESH_MIN` and `MESH_MAX`.
* `variable_probe_min_count` - Minimum number of probes for partial probing of a
bed mesh.
* `variable_probe_count_scale` - Scaling factor to increase probe count for
partial bed probes.
> **Note:** See the [optional section](#bed-mesh) for additional macros.
> **Note:** The bed mesh optimizations are silently disabled for delta printers
and when the mesh parameters include a [`RELATIVE_REFERENCE_INDEX`
](https://www.klipper3d.org/Bed_Mesh.html#the-relative-reference-index)
(which is icnompatible with dynamic mesh generation).
`BED_MESH_CHECK`
Checks the `[bed_mesh]` config and warns if `mesh_min` or `mesh_max` could allow
a move out of range during `BED_MESH_CALIBRATE`. This is run implictily at
Klipper startup and at the start of `BED_MESH_CALIBRATE`.
### Bed Surface
Provides a set of macros for selecting different bed surfaces with
correspdonding Z offset adjustments to compensate for their thickness. All
available surfaces must be listed in the `variable_bed_surfaces` array.
Corresponding LCD menus for sheet selection and babystepping will be added to
*Setup* and *Tune* if [`lcd_menus.cfg`](#lcd-menus) is included. Any Z offset
adjustments made in the LCD menus, console, or other clients (e.g. Mainsail,
Fluidd) will be applied to the current sheet and persisted across restarts.
#### `SET_SURFACE_ACTIVE`
Sets the provided surface active (from one listed in listed in
`variable_bed_surfaces`) and adjusts the current Z offset to match the
offset for the surface. If no `SURFACE` argument is provided the available
surfaces are listed, with active surface preceded by a `*`.
* `SURFACE` - Bed surface with an associated offset.
#### `SET_SURFACE_OFFSET`
Directly sets the the Z offset of `SURFACE` to the value of `OFFSET`. If no
argument for `SURFACE` is provided the current active surface is used. If no
argument for `OFFSET` is provided the current offset is displayed.
* `OFFSET` - New Z offset for the given surface.
* `SURFACE` *(default: current surface)* - Bed surface.
> **Note:** The `SET_GCODE_OFFSET` macro is overridden to update the
> offset for the active surface. This makes the bed surface work with Z offset
> adjustments made via any interface or client.
#### `ADJUST_SURFACE_OFFSETS`
Adjusts surface offsets to account for changes in the Z endstop position or
probe Z offset. A message to invoke this command will be shown in the console
when a relevant change is made to `printer.cfg`.
* `IGNORE` - Set to 1 to reset the saved offsets without adjusting the surfaces.
### Beep
Implements the M300 command (if a corresponding `[output_pin beeper]` section is
present). This command causes the speaker to emit an audible tone.
#### `M300`
Emits an audible tone.
* `P` *(default: `variable_beep_duration`)* - Duration of tone.
* `S` *(default: `variable_beep_frequency`)* - Frequency of tone.
### Draw
Provides convenience methods for extruding along a path and drawing purge lines.
> **Note:** The drawing macros require every `extruder` config(s) to have
> correct `nozzle_diameter` and `filament_diameter` settings.
#### DRAW_LINE_TO
Extrudes a line of filament at the specified height and width from the current
coordinate to the supplied XY coordinate (using the currently active extruder).
* `X` *(default: current X position)* - Absolute X coordinate to draw to.
* `Y` *(default: current Y position)* - Absolute Y coordinate to draw to.
* `HEIGHT` *(default: set via `SET_DRAW_PARAMS`)* - Height (in mm) used to
calculate extrusion volume.
* `WIDTH` *(default: set via `SET_DRAW_PARAMS`)* - Extrusion width in mm.
* `FEEDRATE` *(default: set via `SET_DRAW_PARAMS`)* - Drawing feedrate in mm/m.
> **Note:** The Z axis position must be set prior to caling this macro. The
> `HEIGHT` parameter is used only to calculate the extrusion volume.
#### SET_DRAW_PARAMS
Sets the default parameters used by DRAW_LINE_TO. This is helpful in reducing
`DRAW_LINE_TO` command line lengths (particluarly important when debugging in
the console).
* `HEIGHT` *(optional; 0.2mm at startup)* - Height (in mm) used to
calculate extrusion volume.
* `WIDTH` *(optional; nozzle diameter at startup)* - Extrusion width in mm.
* `FEEDRATE` *(optional; 1200mm/m at startup)* - Drawing feedrate in mm/m.
#### DRAW_PURGE_LINE
Moves to a position at the front edge of the first print layer and purges the
specified length of filament as a line (or rows of lines) in front of the
supplied print area. If no print area is specified the purge lines are drawn at
the front edge of the maximum printable area. If no printable area is set it
defaults to the respective axis limits.
* `PRINT_MIN` *(default: `variable_print_min`)* - Upper boundary of print.
* `PRINT_MAX` *(default: `variable_print_max`)* - Lower boundary of print.
* `HEIGHT` *(default: 62.5% of nozzle diameter)* - Extrusion height in mm.
* `WIDTH` *(default: 125% of nozzle diameter)* - Extrusion width in mm.
* `LENGTH` *(default: `variable_start_purge_length`)* - Length of filament
to purge. *The default in `variable_start_purge_length` is also the amount
that is automatically purged at print start.*
> **Note:** You must set `variable_print_min` and `variable_print_max` if the
> X and Y axis limits in your config allow your toolhead to move outside the
> printable area (e.g. for dockable probes or purge buckets).
> **Note:** If your print touches the front edge of the bed it will overlap with
> with the extrusions from `DRAW_PURGE_LINE`.
### Fans
Implements scaling parameters that alter the behavior of the M106 command. Once
set, these parameters apply to any fan speed until they are cleared (by default
this happens at the start and end of the print).
#### `SET_FAN_SCALING`
Sets scaling parameters for the extruder fan.
* `BOOST` *(default: `0`)* - Added to the fan speed.
* `SCALE` *(default: `1.0`)* - The `BOOST` value is added an then the fan
speed is multiplied by `SCALE`.
* `MAXIMUM` *(default: `255`)* - The fan speed is clamped to no larger
than `MAXIMUM`.
* `MINIMUM` *(default: `0`)* - The fan speed is clamped to no less
than `MINIMUM`; if this is a non-zero value the fan can be stopped only via
the M107 command.
* `SPEED` *(optional)* - This specifies a new speed target, otherwise any new
adjustments will be applied to the unadjusted value of the last set fan speed.
#### `RESET_FAN_SCALING`
* Clears all existing fan scaling factors.
### Filament
#### `LOAD_FILAMENT` / `UNLOAD_FILAMENT`
Loads or unloads filament to the nozzle.
* `LENGTH` *(default: `variable_load_length`)* - The length of filament to load
or unload.
* `SPEED` *(default: `variable_load_speed`)* - Speed (in mm/m) to feed the
filament.
* `MINIMUM` *(default: `min_extrude_temp` + 5)* - Ensures the extruder is heated
to at least the specified temperature.
#### Marlin Compatibility
* The `M701` and `M702` commands are implemented with a default filament length
of `variable_load_length`.
### Heaters
Adds scaling parameters that can alter the behavior of the specified heater.
Once set, these parameters apply to any temperature target on that heater until
the scalaing parameters are cleared. A zero target temperature will turn the
heater off regardless of scaling parameters.
#### `SET_HEATER_SCALING`
Sets scaling parameters for the specified heater. If run without any arguments
any currently scaled heaters and thier scaling parameters will be listed. By
default the scaling is cleared at the start and end of a print.
* `HEATER` - The name of the heater to scale.
* `BOOST` *(default: `0.0`)* - Added to a non-zero target temperature.
* `SCALE` *(default: `1.0`)* - Multiplied with the boosted target
temperature.
* `MAXIMUM` *(default: `max_temp`)* - The target temperature is clamped
to no larger than `MAXIMUM`. This value must be between `min_temp` and
`min_temp`, inclusive.
* `MINIMUM` *(default: `min_temp`)* - A non-zero target temperature is
clamped to no less than `MINIMUM`. This value must be between `min_temp` and
`min_temp`, inclusive.
* `TARGET` *(optional)* - This specifies a new target temperature, otherwise any
new adjustments will be applied to the unadjusted value of the last set target
temperature.
> **Note:** a zero target temperature will turn the heater off regardless of
> scaling parameters.
#### `RESET_HEATER_SCALING`
Clears current heater scaling.
* `HEATER` *(optional)* - The name of the heater to reset.
> **Note:** if no HEATER argument is specified scaling parameters will be reset
> for all heaters.
#### `SET_HEATER_TEMPERATURE_SCALED`
The scaled version of Klipper's `SET_HEATER_TEMPERATURE`. All arguments are the
same and the function is identical, except that scaling values are applied.
#### `TEMPERATURE_WAIT_SCALED`
The scaled version of Klipper's `TEMPERATURE_WAIT`. All arguments are the
same and the function is identical, except that scaling values are applied.
#### Marlin Compatibility
* The chamber heating commands `M141` and `M191` are implemented if a
corresponding `[heater_generic chamber]` section is defined in the config.
* The `R` temperature parameter from Marlin is implemented for the `M109` and
`M190` commands. This parameter will cause a wait until the target temperature
stabilizes (i.e. the normal Klipper behavior for `S`).
* The `S` parameter for the `M109` and `M190` commands is altered to behave as
it does in Marlin. Rather than causing a wait until the temperature
stabilizes, the wait will complete as soon as the temperature target is
exceeded.
* The `M109`, `M190`, `M191`, `M104`, `M140`, and `M141` are all overridden to
implement the heater scaling described above.
> **Note:** Both `SET_HEATER_TEMPERATURE` and `TEMPERATURE_WAIT` are **not**
> overriden and will not scale values. This means that heater scaling
> adjustments made in clients like Mainsail and Fluidd will not be scaled
> (because that seemed like the clearest behavior). The
> [custom LCD menus](#lcd-menus) will also replace the temperature controls
> with non-scaling versions. If you use the stock menus you'll get scaled
> values.
### Kinematics
#### `G28`
Extends the `G28` command to add lazy homing by not re-homing already homed axes
when the `O` argument is included (equivalent to the same argument in Marlin).
See Klipper `G28` documentation for general information and detail on the other
arguments.
* `O` - Omits axes from the homing procedure if they are already homed.
> **Note:** If you have a `[homing_override]` section you will need to update
> any `G28` commands in the gcode part to use `G28.6245197` instead (which is
> the renamed version of Klipper's built-in `G28`). Failure to do this will
> cause `G28` commands to error out with the message ***Macro G28 called
> recursively***.
### Layer Triggers
Provides the capability to run user-specified g-code commands at arbitrary layer
changes.
#### `GCODE_AT_LAYER`
Runs abritrary, user-provided g-code commands at the user-specified layer or
height. If no arguments are specified it will display all currently scheduled
g-code commands along with their associated layer or height.
* `HEIGHT` - Z height (in mm) to run the command. Exactly one of `HEIGHT` or
`LAYER` must be specified.
* `LAYER` - Layer number (zero indexed) to run the command. Exactly one of
`HEIGHT` or `LAYER` must be specified. The special value `next` may be
specified run the command at the next layer change.
* `COMMAND` - The command to run at layer change. Take care to properly quote
spaces and escape any special characters.
* `BEFORE` *(default: `0`)* - Set to 1 run the command before the layer
change (i.e. immediately following completion of the previous layer). By
default commands run after the layer change (i.e. immediately preceding the
next layer). In most cases this distinction here doesn't matter, but it can
be important when dealing with toolchangers or other multi-material printing.
#### `CANCEL_ALL_LAYER_GCODE`
Cancels all g-code commands previously scheduled at any layer or height.
#### Convenient Layer Change Macros
* `PAUSE_NEXT_LAYER ...`
* Schedules the current print to pause at the next layer change. See
[`PAUSE`](#pause) macro for additional arguments.
* `PAUSE_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } ...`
* Schedules the current print to pause at the specified layer change.
See [`PAUSE`](#pause) for additional arguments.
* `SPEED_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } SPEED=<percentage>`
* Schedules a feedrate adjustment at the specified layer change. (`SPEED`
parameter behaves the same as the `M220` `S` parameter.)
* `FLOW_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } FLOW=<percentage>`
* Schedules a flow-rate adjustment at the specified layer change. (`FLOW`
parameter behaves the same as the `M221` `S` parameter.)
* `FAN_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } ...`
* Schedules a fan adjustment at the specified layer change. See
[`SET_FAN_SCALING`](#set_fan_scaling) for additional arguments.
* `HEATER_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } ...`
* Schedules a heater adjustment at the specified layer change. See
[`SET_HEATER_SCALING`](#set_heater_scaling) for additional arguments.
> **Note:** If any triggers cause an exception the current print will
> abort. The convenience macros above validate their arguments as much as is
> possible to reduce the chances of an aborted print, but they cannot entirely
> eliminate the risk of a macro doing something that aborts the print.
### Park
Implements toolhead parking.
#### `PARK`
Parks the toolhead.
* `P` *(default: `2`)* - Parking mode
* `P=0` - If current Z-pos is lower than Z-park then the nozzle will be raised
to reach Z-park height
* `P=1` - No matter the current Z-pos, the nozzle will be raised/lowered to
reach Z-park height.
* `P=2` - The nozzle height will be raised by Z-park amount but never going
over the machines Z height limit.
* `X` *(default: `variable_park_x`)* - Absolute X parking coordinate.
* `Y` *(default: `variable_park_y`)* - Absolute Y parking coordinate.
* `Z` *(default: `variable_park_z`)* - Z parking coordinate applied according
to the `P` parameter.
* `LAZY` *(default: 1)* - Will home any unhomed axes if needed and will not
move any axis if already homed and parked (even if `P=2`).
> **Note:** If a print is in progress the larger of the tallest printed layer or
> the current Z position will be used as the current Z position, to avoid
> collisions with already printed objects during a sequential print.
#### Marlin Compatibility
* The `G27` command is implemented with a default `P0` argument.
### Pause, Resume, Cancel
#### `PAUSE`
Pauses the current print.
* `X` *(default: `variable_park_x`)* - Absolute X parking coordinate.
* `Y` *(default: `variable_park_y`)* - Absolute Y parking coordinate.
* `Z` *(default: `variable_park_z`)* - Relative Z parking coordinate
* `E` *(default: `5`)* - Retraction length to prevent ooze.
* `B` *(default: `10`)* - Number of beeps to emit (if `M300` is enabled).
#### `RESUME`
* `E` *(default: `5`)* - Retraction length to prevent ooze.
#### `CANCEL_PRINT`
Cancels the print and performs all the same functions as `PRINT_END`.
#### Marlin Compatibility
* The `M24`, `M25`, `M600`, `M601`, and `M602` commands are all implemented by
wrapping the above commands.
### Print Start and End
#### `PRINT_START`
Sets up the printer prior to starting a print (called from the slicer's print
start g-code). A target `CHAMBER` temperature may be provided if a
`[heater_generic chamber]` section is present in the klipper config.
If `MESH_MIN` and `MESH_MAX` are provided, then `BED_MESH_CALIBRATE` will probe
only the area within the specified rectangle, and will scale the number of
probes to the appropriate density (this can dramatically reduce probe times for
smaller prints).
* `BED` - Bed heater starting temperature.
* `EXTRUDER` - Extruder heater starting temperature.
* `CHAMBER` *(optional)* - Chamber heater starting temperature.
* `MESH_MIN` *(optional)* - Minimum x,y coordinate of the first layer.
* `MESH_MAX` *(optional)* - Maximum x,y coordinate of the first layer.
* `NOZZLE_SIZE` *(default: nozzle_diameter)* - Nozzle diameter of the primary
extruder.
* `LAYERS` *(optional)* - Total number of layers in the print.
These are the customization options you can add to your
`[gcode_macro _km_options]` section to alter `PRINT_START` behavior:
* `variable_start_bed_heat_delay` *(default: 2000)* - This delay (in
microseconds) is used to allow the bed to stabilize after it reaches it's
target temperature. This is present to account for the fact that the
temperature sensors for most beds are located close to the heating element,
and thus will register as being at the target temperature before the surface
of the bed is. For larger or thicker beds you may want to increase this value.
For smaller or thinner beds you may want to disable this entirely by setting
it to `0`.
* `variable_start_bed_heat_overshoot` *(default: 2.0)* - This value (in degrees
Celsius) is added to the supplied target bed temperature and use as the
initial target temperature when preheating the bed. After the bed preheats to
this target it there is a brief delay before the final target is set. This
allows the bed to stabilize at it's final temperature more quickly. For
smaller or thinner beds you may want to reduce this value or disable it
entirely by setting it to `0.0`.
* `variable_start_end_park_y` *(default: `print_max` Y coordinate)* - The final
Y position of the toolhead in the `PRINT_END` macro, to ensure that the
toolhead is out of the way when the bed is presented for print removal.
* `variable_start_extruder_preheat_scale` *(default: 0.5)* - This value is
multiplied by the target extruder temperature and the result is used as the
preheat value for the extruder while the bed is heating. This is done to
reduce oozing from the extruder while the bed is heating or being probed. Set
to `1.0` to preheat the extruder to the full target temperature, or to `0.0`
to not preheat the extruder at all until the bed reaches temperature.
* `variable_start_extruder_set_target_before_level` *(default: True)* - If
`True` the extruder is set to its target temperature before bed leveling
begins. If `False` the target is set after bed level completes. Setting `True`
warms up the extruder faster and `False` prevents oozing during bed level.
The extruder preheat is applied independent of this setting.
* `variable_start_gcode_before_print` *(default: None)* - Optional user-supplied
gcode run after any leveling operations are complete and the bed, extruder,
and chamber are all stabilized at their target temperatures. Immediately after
this gcode executes the purge line will be printed (if specified) and then the
file from the virtual sdcard will begin printing. This is a useful to add any
probe docking commands, loading from a multi-material unit, or other
operations that must occur before any filament is extruded.
* `variable_start_level_bed_at_temp` *(default: True if `bed_mesh` configured
)* - If true the `PRINT_START` macro will run [`BED_MESH_CALIBRATE_FAST`](
#bed-mesh-improvements) after the bed has stabilized at its target
temperature.
* `variable_start_home_z_at_temp` *(default: True if `probe:z_virtual_endstop`
configured)* - Rehomes the Z axis once the bed reaches its target temperature,
to account for movement during heating.
* `variable_start_clear_adjustments_at_end` *(default: True)* - Clears temporary
adjustments after the print completes or is cancelled (e.g. feedrate,
flow percentage).
* `variable_start_purge_clearance` *(default: 5.0)* Distance (in millimeters)
between the purge lines and the print area (if a `start_purge_length` is
provided).
* `variable_start_purge_length` *(default: 0.0)* - Length of filament (in
millimeters) to purge after the extruder finishes heating and prior to
starting the print. For most setups `30` is a good starting point.
* `variable_start_purge_prime_length` *(default: 10.0)* Length of filament (in
millimeters) to prime the extruder before drawing the purge lines.
* `variable_start_quad_gantry_level_at_temp` *(default: True if
`quad_gantry_level` configured)* - If true the `PRINT_START` macro will run
`QUAD_GANTRY_LEVEL` after the bed has stabilized at its target temperature.
* `variable_start_z_tilt_adjust_at_temp` *(default: True if `z_tilt`
configured)* - If true the `PRINT_START` macro will run `Z_TILT_ADJUST` after
the bed has stabilized at its target temperature.
You can further customize the `PRINT_START` macro by declaring your own override
wrapper. This can be useful for things like loading mesh/skew profiles, or any
other setup that may need to be performed prior to printing.
Here's a skeleton of a `PRINT_START` override wrapper:
```
[gcode_macro PRINT_START]
rename_existing: KM_PRINT_START
gcode:
# Put macro code here to run before PRINT_START.
KM_PRINT_START {rawparams}
# Put macro code here to run after PRINT_START but before the print gcode
```
> **Note:** You can use this same pattern to wrap other macros in order to
account for customizations specific to your printer. E.g. If you have a
dockable probe you may choose to wrap `BED_MESH_CALIBRATE` with the
appropriate docking/undocking commands.
#### `PRINT_END`
Parks the printhead, shuts down heaters, fans, etc, and performs general state
housekeeping at the end of the print (called from the slicer's print end
g-code).
### Velocity
These are some basic wrappers for Klipper's analogs to some of Marlin's velocity
related commands, such as accelleration, jerk, and linear advance.
#### Marlin Compatibility
* The `M201`, `M203`, `M204`, and `M205` commands are implemented by calling
Klipper's `SET_VELOCITY_LIMIT` command. For calls that set the `ACCEL`
parameter, the `ACCEL_TO_DECEL` parameter is also set and scaled by
`variable_velocity_decel_scale` *(default: `0.5`)*.
* The `M900` command is implemented by calling Klipper's `SET_PRESSURE_ADVANCE`
command. The `K` factor is scaled by `variable_pressure_advance_scale`
*(default: `-1.0`)*. If the scaling value is negative the `M900` command has no
effect.
## Optional Configs
### Bed Mesh
`BED_MESH_CALIBRATE` and `G20`
Overrides the default `BED_MESH_CALIBRATE` to use `BED_MESH_CALIBRATE_FAST`
instead, and adds the `G20` command.
***Configuration:***
```
[include klipper-macros/optional/bed_mesh.cfg]
```
***Requirements:** A properly configured `bed_mesh` section.*
### LCD Menus
Adds relevant menu items to an LCD display and improves some existing
functionality. See the [customization](#customization) section above for more
information on how to configure specific behaviors.
* Confirmation added for cancelling the print or disabling steppers during a
print.
* Several temperature menu changes:
* Up to 10 filaments and their corresponding temperatures can be set via
`variable_menu_temperature`.
* Per filament chamber temperature controls are available if a
`[heater_generic chamber]` section is configured.
* The cooldown commands are moved to the top level temperature menu.
* The filament loading commands are replaced with macros that use the lengths
and speeds specified in `variable_load_length` and `variable_load_speed`,
which includes a priming phase at the end of the load (controlled via
`variable_load_priming_length` and `variable_load_priming_speed`).
* [Bed surface](#bed-surface) management is integrated into the setup and tuning
menus.
* The SD card menu has been streamlined for printing and non-printing modes.
* The setup menu includes host shutdown, host restart, speed, and flow controls.
* You can hide the Octoprint or SD card menus if you don't use them
(via `variable_menu_show_octoprint` and `variable_menu_show_sdcard`,
respectively).
***Configuration:***
```
[include klipper-macros/optional/lcd_menus.cfg]
```
***Requirements:** A properly configured `display` section.*

View File

@@ -1,135 +0,0 @@
[gcode_macro bed_mesh_calibrate_fast]
description: Wraps BED_MESH_CALIBRATE, scaling probe count to specified area.
Usage: See Klipper documentation.
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% set probe_mesh_padding = km.probe_mesh_padding %}
{% set probe_min_count = km.probe_min_count %}
{% set probe_count_scale = km.probe_count_scale %}
{% set bed_mesh = printer.configfile.config.bed_mesh %}
# Don't have the math functions available to work on a delta bed, and
# not sure how to make relative reference index work.
{%if "mesh_radius" not in bed_mesh and
"MESH_RADIUS" not in params and
"relative_reference_index" not in bed_mesh and
"RELATIVE_REFERENCE_INDEX" not in params %}
{% set safe_min_x = bed_mesh.mesh_min.split(",")[0]|float %}
{% set safe_min_y = bed_mesh.mesh_min.split(",")[1]|float %}
{% set safe_max_x = bed_mesh.mesh_max.split(",")[0]|float %}
{% set safe_max_y = bed_mesh.mesh_max.split(",")[1]|float %}
# Always bound MESH_MIN and MESH_MAX.
{% if "MESH_MIN" in params %}
{% set mesh_min_x = (params.MESH_MIN.split(",")[0]|float -
probe_mesh_padding, safe_min_x)|max %}
{% set mesh_min_y = (params.MESH_MIN.split(",")[1]|float -
probe_mesh_padding, safe_min_y)|max %}
{% else %}
{% set mesh_min_x = safe_min_x %}
{% set mesh_min_y = safe_min_y %}
{% endif %}
{% if "MESH_MAX" in params %}
{% set mesh_max_x = (params.MESH_MAX.split(",")[0]|float +
probe_mesh_padding, safe_max_x)|min %}
{% set mesh_max_y = (params.MESH_MAX.split(",")[1]|float +
probe_mesh_padding, safe_max_y)|min %}
{% else %}
{% set mesh_max_x = safe_max_x %}
{% set mesh_max_y = safe_max_y %}
{% endif %}
{% set probe_count = (params.PROBE_COUNT |
default(bed_mesh.probe_count)).split(",") %}
# Don't scale the probe count if one was explicitly provided.
{% if "PROBE_COUNT" not in params %}
{% set max_x_probes = probe_count[0]|int %}
{% set max_y_probes = probe_count[1]|default(max_x_probes)|int %}
{% set x_probes = (max_x_probes * (mesh_max_x - mesh_min_x) /
(safe_max_x - safe_min_x) * probe_count_scale)
| round(0) | int %}
{% set x_probes = ((x_probes, probe_min_count)|max, max_x_probes)|min %}
{% set y_probes = (max_y_probes * (mesh_max_y - mesh_min_y ) /
(safe_max_y - safe_min_y) * probe_count_scale )
| round(0) | int %}
{% set y_probes = ((y_probes, probe_min_count)|max, max_y_probes)|min %}
# Add probes for bicubic if one axis has too many probes for lagrange.
{% if x_probes > 6 and y_probes < 4 %}
{% set y_probes = 4 %}
{% elif y_probes > 6 and x_probes < 4 %}
{% set x_probes = 4 %}
{% endif %}
{% set probe_count = [x_probes,y_probes] %}
{% endif %}
{% set dummy = params.__setitem__("MESH_MIN", mesh_min_x~","~mesh_min_y) %}
{% set dummy = params.__setitem__("MESH_MAX", mesh_max_x~","~mesh_max_y) %}
{% set dummy = params.__setitem__("PROBE_COUNT", probe_count|join(',')) %}
# Force bicubic if we've exceeded the max for lagrange.
{% if probe_count[0]|int > 6 or probe_count[1]|default(0)|int > 6 %}
{% set dummy = params.__setitem__("ALGORITHM", "bicubic") %}
{% endif %}
{% endif %}
{% if printer["gcode_macro bed_mesh_calibrate"].km_override|default(False) %}
{% set calibrate_cmd = "_km_bed_mesh_calibrate_base" %}
{% else %}
{% set calibrate_cmd = "BED_MESH_CALIBRATE" %}
{% endif %}
BED_MESH_CHECK
{calibrate_cmd}{%for k in params%}{' '~k~'="'~params[k]~'"'}{%endfor%}
[gcode_macro bed_mesh_check]
description: Warns if bed_mesh config may generate an invalid mesh.
Usage: See Klipper documentation.
gcode:
{% if printer.bed_mesh is defined %}
{% set x_min = printer.configfile.settings.stepper_x.position_min %}
{% set y_min = printer.configfile.settings.stepper_y.position_min %}
{% set x_max = printer.configfile.settings.stepper_x.position_max %}
{% set y_max = printer.configfile.settings.stepper_y.position_max %}
{% set mesh_min_x = printer.configfile.settings.bed_mesh.mesh_min[0] %}
{% set mesh_min_y = printer.configfile.settings.bed_mesh.mesh_min[1] %}
{% set mesh_max_x = printer.configfile.settings.bed_mesh.mesh_max[0] %}
{% set mesh_max_y = printer.configfile.settings.bed_mesh.mesh_max[1] %}
{% if "bltouch" in printer.configfile.settings %}
{% set x_offset = printer.configfile.settings.bltouch.x_offset %}
{% set y_offset = printer.configfile.settings.bltouch.y_offset %}
{% set probe = "bltouch" %}
{% elif "probe" in printer.configfile.settings %}
{% set x_offset = printer.configfile.settings.probe.x_offset %}
{% set y_offset = printer.configfile.settings.probe.y_offset %}
{% set probe = "probe" %}
{% else %}
{% set x_offset = 0.0 %}
{% set y_offset = 0.0 %}
{% endif %}
{% set output = [] %}
{% set warn =
"* bed_mesh.mesh_%s (%f, %f) does not account for " ~ probe ~
".%s_offset (%f) and can move out of range for "
"stepper_%s.position_%s (%f)." %}
{% if x_offset > 0 and (mesh_min_x - x_offset) < x_min %}
{% set dummy = output.append(warn % ('min', mesh_min_x, mesh_min_y,
'x', x_offset, 'x', 'min', x_min)) %}
{% elif x_offset < 0 and (mesh_max_x - x_offset) > x_max %}
{% set dummy = output.append(warn % ('max', mesh_max_x, mesh_max_y,
'x', x_offset, 'x', 'max', x_max)) %}
{% endif %}
{% if y_offset > 0 and (mesh_min_y - y_offset) < y_min %}
{% set dummy = output.append(warn % ('min', mesh_min_x, mesh_min_y,
'y', y_offset, 'y', 'min', y_min)) %}
{% elif y_offset < 0 and (mesh_max_y - y_offset) > y_max %}
{% set dummy = output.append(warn % ('max', mesh_max_x, mesh_max_y,
'y', y_offset, 'y', 'max', y_max)) %}
{% endif %}
{% if output %}
{ action_respond_info(
"Warning: The following issue(s) were detected in your [bed_mesh] "
" config:\n" ~ output|join("\n")) }
{% endif %}
{% endif %}

View File

@@ -1,184 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
#
# Credit to original source:
# https://klipper.discourse.group/t/saving-and-adjusting-per-build-surface-z-offsets/696
[gcode_macro _apply_bed_surface_offset]
gcode:
{% set surfaces = printer.save_variables.variables.bed_surfaces %}
{% if surfaces.active %}
SET_SURFACE_ACTIVE SURFACE={surfaces.active}
{% endif %}
[gcode_macro _init_surfaces]
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% if "bed_surfaces" in printer.save_variables.variables %}
{% set old_surfaces = printer.save_variables.variables.bed_surfaces %}
{% else %}
{% set old_surfaces = { 'active' : '', 'available' : {} } %}
{% endif %}
{% set settings = printer.configfile.settings %}
{% set new_probe_z = (settings.probe | default(settings.bltouch) |
default(settings.smart_effector) | default({})
).z_offset|default(0.0)|float %}
{% set new_endstop_z = (settings.stepper_z | default({})).position_endstop |
default(0.0)|float %}
{% if 'endstop_z' not in old_surfaces %}
{% set dummy = old_surfaces.__setitem__('endstop_z', new_endstop_z) %}
{% endif %}
{% if 'probe_z' not in old_surfaces %}
{% set dummy = old_surfaces.__setitem__('probe_z', new_probe_z) %}
{% endif %}
{% set surfaces = { 'active' : '', 'available' : {},
'endstop_z' : old_surfaces.endstop_z,
'probe_z' : old_surfaces.probe_z } %}
{% for s in km.bed_surfaces %}
{% set s = s.split()|join(' ')|lower %}
{% if s|length > km.bed_surface_max_name_length or
s|list|select("in", " \r\n\"\'")|list %}
{action_raise_error('Invalid surface name "%s". Name must be %d or fewer '
'characters and must not include space or quotation characters'
| format(s, km.bed_surface_max_name_length))}
{% endif %}
{% if s in old_surfaces.available %}
{% set dummy = surfaces.available.__setitem__(s,
old_surfaces.available[s]) %}
{% else %}
{% set dummy = surfaces.available.__setitem__(s, {'offset' : 0.0}) %}
{% endif %}
{% endfor %}
{% if old_surfaces.active in surfaces.available %}
{% set dummy = surfaces.__setitem__('active', old_surfaces.active) %}
{% elif km.bed_surfaces %}
{% set dummy = surfaces.__setitem__('active', km.bed_surfaces[0]|lower) %}
{% endif %}
SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}"
_APPLY_BED_SURFACE_OFFSET
{% if new_probe_z != surfaces.probe_z or
new_endstop_z != surfaces.endstop_z %}
{ action_respond_info(
'Z probe offset or endstop position changed. Run ADJUST_SURFACE_OFFSETS '
'to adjust the offset for all saved surfaces by the change differential, '
'or run ADJUST_SURFACE_OFFSETS IGNORE=1 to hide this message without '
'making changes.') }
{% endif %}
[gcode_macro adjust_surface_offsets]
description: Adjusts surface offsets to account for changes in the Z endstop position or probe Z offset.
Usage: ADJUST_SURFACE_OFFSETS [IGNORE]
gcode:
{% set surfaces = printer.save_variables.variables.bed_surfaces %}
{% set settings = printer.configfile.settings %}
{% set new_probe_z = (settings.probe | default(settings.bltouch) |
default(settings.smart_effector) | default({})
).z_offset|default(0.0)|float %}
{% set new_endstop_z = (settings.stepper_z | default({})).position_endstop |
default(0.0)|float %}
{% set diff = (surfaces.probe_z - new_probe_z +
surfaces.endstop_z - new_endstop_z)|round(6) %}
{% if not params.IGNORE|default(0)|int %}
{% for s in surfaces.available %}
{% set offset = (surfaces.available[s].offset - diff)|round(6) %}
{% set dummy = surfaces.available.__setitem__(s, {'offset' : offset}) %}
{% endfor %}
{ action_respond_info("All bed surfaces now adjusted by %1.4f"|
format(diff))}
{% elif diff != 0 %}
{ action_respond_info("Status cleared without adjustment") }
{% endif %}
{% set dummy = surfaces.__setitem__('endstop_z', new_endstop_z| round(6)) %}
{% set dummy = surfaces.__setitem__('probe_z', new_probe_z|round(6)) %}
SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}"
[gcode_macro set_surface_offset]
description: Sets the offset for a surface and moves the toolhead (if homed).
Usage: SET_SURFACE_OFFSET [OFFSET=<offset>] [SURFACE=<surface>]
gcode:
{% set surfaces = printer.save_variables.variables.bed_surfaces %}
{% set SURFACE = params.SURFACE|default(surfaces.active)|lower %}
{% if SURFACE not in surfaces.available %}
{ action_raise_error("Bed surface %s does not exist." | format(SURFACE)) }
{% endif %}
{% set active = surfaces.available[SURFACE] %}
# If no offset is provided just print out the current offset.
{% set OFFSET = params.OFFSET|default(active.offset)|float %}
{% if OFFSET != active.offset %}
{% set dummy = surfaces.available[SURFACE].__setitem__("offset", OFFSET) %}
SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}"
{% if SURFACE == surfaces.active %}
_km_set_gcode_offset_base Z="{OFFSET}" MOVE={
1 if printer.toolhead.homed_axes == 'xyz' else 0}
{% endif %}
{% endif %}
{ action_respond_info("Bed surface: %s Offset: %.3f"
| format(SURFACE, OFFSET)) }
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.SURFACE|default(active surface) %}
{% set dummy = params.OFFSET|default(none)|float %}
" %} # End argument block for Mainsail
[gcode_macro set_surface_active]
description: Sets the active bed surface and moves the toolhead (if homed). If no SURFACE argument is present the available surfaces are listed and the active one is preceded by a "*".
Usage: SET_SURFACE_ACTIVE [SURFACE=<surface>]
gcode:
{% set surfaces = printer.save_variables.variables.bed_surfaces %}
{% if "SURFACE" in params %}
{% set SURFACE = params.SURFACE|lower %}
{% if SURFACE not in surfaces.available %}
{ action_raise_error("Bed surface %s does not exist." | format(SURFACE)) }
{% endif %}
{% if SURFACE != surfaces.active %}
{% set dummy = surfaces.__setitem__("active", SURFACE) %}
SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}"
{% endif %}
{% if surfaces.available[SURFACE].offset !=
printer.gcode_move.homing_origin.z %}
_km_set_gcode_offset_base Z="{surfaces.available[SURFACE].offset
}" MOVE={1 if printer.toolhead.homed_axes == 'xyz' else 0}
{% endif %}
{action_respond_info("Active bed surface: %s; offset: %.3f"
| format(SURFACE, surfaces.available[SURFACE].offset))}
{% else %}
{% set output = [] %}
{% for s in surfaces.available|list|sort %}
{% set dummy = output.append("%s&nbsp;%s - offset: %.3f"
| format("*" if s == surfaces.active else "&nbsp;",
s, surfaces.available[s].offset)) %}
{% endfor %}
{action_respond_info(output|join('\n'))}
{% endif %}
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.SURFACE|default(none) %}
" %} # End argument block for Mainsail
[gcode_macro set_gcode_offset]
description: Wraps SET_GCODE_OFFSET to update the current bed sheet offset.
Usage: SET_GCODE_OFFSET [X=<pos>|X_ADJUST=<adjust>]
[Y=<pos>|Y_ADJUST=<adjust>]
[Z=<pos>|Z_ADJUST=<adjust>]
[MOVE=1 [MOVE_SPEED=<speed>]]
rename_existing: _KM_SET_GCODE_OFFSET_BASE
gcode:
{% set surfaces = printer.save_variables.variables.bed_surfaces %}
{% if surfaces.active and
not printer["gcode_macro _km_save_state"].is_ephemeral %}
{% set Z = params.Z|default(0.0)|float|round(6) %}
{% set Z_ADJUST = params.Z_ADJUST|default(0.0)|float %}
{% if 'Z' in params and
Z != surfaces.available[surfaces.active].offset %}
{% set dummy = surfaces.available[surfaces.active].__setitem__("offset",
Z) %}
SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}"
{% elif Z_ADJUST != 0.0 %}
{% set dummy = surfaces.available[surfaces.active].__setitem__(
"offset", (Z_ADJUST + printer.gcode_move.homing_origin.z)|round(6)) %}
SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}"
{% endif %}
{% endif %}
_km_set_gcode_offset_base{% for k in params%}{' '~k~'="'~params[k]~'"'
}{% endfor %}

View File

@@ -1,22 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro m300]
description: Emits and audible beep.
Usage: M300 [P<duration>] [S<frequency>]
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% set settings = printer.configfile.settings %}
{% if "output_pin beeper" in printer %}
{% set P = (params.P|default(km.beep_duration)|int, 0)|max %}
{% set S = (params.S|default(km.beep_frequency)|int, 1)|max %}
SET_PIN PIN=beeper VALUE={
settings["output_pin beeper"].scale|default(1.0) * 0.5
}{% if settings["output_pin beeper"].pwm %} CYCLE_TIME={
1.0 / S }{% endif %}
G4 P{P}
SET_PIN PIN=beeper VALUE=0
{% else %}
{action_respond_info(
"M300 is disabled. To enable create an [output_pin beeper] config.")}
{% endif %}

View File

@@ -1,117 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro set_draw_params]
description: Sets the default parameters used by DRAW_LINE_TO.
Usage: SET_DRAW_PARAMS [HEIGHT=<mm>] [WIDTH=<mm>] [FEEDRATE=<mm/m>]
variable_height: 0.2
variable_width: 0.0 # Set to nozzle_diameter at startup
variable_feedrate: 1200
gcode:
{% set dparams = printer["gcode_macro set_draw_params"] %}
{% for k in params %}
{% set kl = k|lower %}
{% if kl in dparams %}
{% if dparams[kl] is float %}
{% set v = params[k]|float %}
{% elif dparams[kl] is integer %}
{% set v = params[k]|int %}
{% endif %}
SET_GCODE_VARIABLE MACRO=set_draw_params VARIABLE={kl} VALUE="{v}"
{% endif %}
{% endfor %}
[gcode_macro draw_line_to]
description: Extrudes a line of filament at the specified height and width from the current coordinate to the supplied XY coordinate. (The height is used only to calculate the extrusion volume.)
Usage: DRAW_LINE_TO [X=<pos>] [Y=<pos>] [HEIGHT=<mm>] [WIDTH=<mm>]
[FEEDRATE=<mm/m>]
gcode:
{% set dparams = printer["gcode_macro set_draw_params"] %}
{% set position = printer.gcode_move.position %}
{% set X = params.X|default(position.x)|float %}
{% set Y = params.Y|default(position.y)|float %}
{% set HEIGHT = params.HEIGHT|default(dparams.height)|float %}
{% set WIDTH = params.WIDTH|default(dparams.width)|float %}
{% set FEEDRATE = params.FEEDRATE|default(dparams.feedrate)|int %}
{% set distance = ((X - position.x) ** 2 + (Y - position.y) ** 2) ** 0.5 %}
{% set filament_area = 3.14159 *
(printer.configfile.settings[
printer.toolhead.extruder].filament_diameter ** 2) / 4 %}
{% set E = distance * ((WIDTH * HEIGHT) / filament_area) %}
# Use the base state call here so offset adjustments get persisted.
_KM_SAVE_GCODE_STATE NAME=_KM_PURGE
G90
G92 E0.0
G1 X{"%.3f" % X} Y{"%.3f" % Y} E{"%.5f" % E} F{FEEDRATE}
_KM_RESTORE_GCODE_STATE NAME=_KM_PURGE MOVE=0
[gcode_macro draw_purge_line]
description: Purges the specified length of filament as a line (or rows of lines) in front of the supplied print area. If no print area is specified the purge lines are drawn at the front edge of the maximum printable area. If no printable area is set it defaults to the XY axis limits.
Usage: DRAW_PURGE_LINE [PRINT_MIN=<X,Y>] [PRINT_MAX=<X,Y>] [HEIGHT=<mm>]
[WIDTH=<mm>] [LENGTH=<mm>]
gcode:
# TODO: Make this work for delta printers.
{% set km = printer["gcode_macro _km_globals"] %}
{% if "PRINT_MIN" in params %}
{% set PRINT_MIN = (
(params.PRINT_MIN.split(",")[0]|float, km.print_min[0])|max,
(params.PRINT_MIN.split(",")[1]|float, km.print_min[1])|max
) %}
{% else %}
{% set PRINT_MIN = km.print_min %}
{% endif %}
{% if "PRINT_MAX" in params %}
{% set PRINT_MAX = (
(params.PRINT_MAX.split(",")[0]|float, km.print_max[0])|min,
(params.PRINT_MAX.split(",")[1]|float, km.print_max[1])|min
) %}
{% else %}
{% set PRINT_MAX = km.print_max %}
{% endif %}
{% set extruder = printer.toolhead.extruder|string %}
{% set HEIGHT = params.HEIGHT|default(
printer.configfile.settings[extruder].nozzle_diameter * 0.625)|float %}
{% set WIDTH = params.WIDTH|default(
printer.configfile.settings[extruder].nozzle_diameter * 1.25)|float %}
{% set LENGTH = params.LENGTH|default(km.start_purge_length)|float %}
{% set dparams = printer["gcode_macro set_draw_params"] %}
{% set filament_area = 3.14159 *
(printer.configfile.settings[extruder].filament_diameter ** 2) / 4 %}
{% set purge_length = (LENGTH * filament_area) / (WIDTH * HEIGHT) %}
{% set printable_length = PRINT_MAX[0] - PRINT_MIN[0] %}
{% set purge_rows = (purge_length / printable_length)|round(0,'ceil')|int %}
{% set printable_inset = (printable_length - purge_length / purge_rows) / 2 %}
{% set PRINT_MIN = (PRINT_MIN[0] + printable_inset, PRINT_MIN[1]) %}
{% set PRINT_MAX = (PRINT_MAX[0] - printable_inset, PRINT_MAX[1]) %}
# This will purge into the print area when the bed is filled to the front.
{% set y_start = (km.print_min[1], PRINT_MIN[1] - km.start_purge_clearance -
(purge_rows + 0.5) * WIDTH )|max %}
G90
# Jog to the front left corner to get strings out of the print area.
G1 X{"%.3f" % (PRINT_MIN[0] - 30, km.print_min[0])|max} Y{
"%.3f" % (y_start - 10, km.print_min[1])|max} F{km.travel_speed_xy}
# Move to the starting corner.
G1 X{"%.3f" % (PRINT_MIN[0] - 2, km.print_min[0])|max} Y{"%.3f" % y_start} Z{
"%.4f" % HEIGHT} F{km.travel_speed_xy}
# Prime the extruder before beginning the purge lines.
G92 E0.0
G1 E{"%.3f" % km.start_purge_prime_length} F{km.load_priming_speed}
G92 E0.0
# Purge.
G1 X{"%.3f" % PRINT_MIN[0]} F{km.travel_speed_xy}
{% for n in range(purge_rows - 1) %}
{% set x_pos = PRINT_MIN[0] if n % 2 else PRINT_MAX[0] %}
DRAW_LINE_TO HEIGHT="{HEIGHT}" WIDTH="{WIDTH}" X="{x_pos}" Y="{
WIDTH * n + y_start}"
DRAW_LINE_TO HEIGHT="{HEIGHT}" WIDTH="{WIDTH}" X="{x_pos}" Y="{
WIDTH * (n + 1) + y_start}"
{% endfor %}
{% set x_pos = PRINT_MAX[0] if purge_rows % 2 else PRINT_MIN[0] %}
DRAW_LINE_TO HEIGHT="{HEIGHT}" WIDTH="{WIDTH}" X="{x_pos}" Y="{
WIDTH * (purge_rows - 1) + y_start}"
G92 E0.0

View File

@@ -1,90 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
# Sets optional scaling factor, minimum, and maximum applied to M106 commmand.
# If a MINIMUM greater than 0 is specified the fan will not stop unless an
# M107 command is issued. SET_FAN_SCALING always displays the current paramaters
# if scaling is active. SET_FAN_SCALING without any arguments will display the
# current scaling parameters without changing them.
[gcode_macro _check_fan_params]
gcode:
{% set MAXIMUM = params.MAXIMUM|default(
printer["gcode_macro set_fan_scaling"].maximum)|int %}
{% set MINIMUM = params.MINIMUM|default(
printer["gcode_macro set_fan_scaling"].minimum)|int %}
{% if params.SCALE and params.SCALE|float <= 0 %}
{ action_raise_error("SCALE must be a positive value.") }
{% elif MINIMUM < 0 or MINIMUM > 255 %}
{ action_raise_error("MINIMUM must be between 0 and 255.") }
{% elif MAXIMUM < 0 or MAXIMUM > 255 %}
{ action_raise_error("MAXIMUM must be between 0 and 255.") }
{% elif params.SPEED and (params.SPEED|int < 0 or params.SPEED|int > 255) %}
{ action_raise_error("SPEED must be between 0 and 255.") }
{% elif params.BOOST and (params.BOOST|int < 0 or params.BOOST|int > 255) %}
{ action_raise_error("BOOST must be between 0 and 255.") }
{% elif MINIMUM > MAXIMUM %}
{ action_raise_error("MINIMUM must be less than or equal to MAXIMUM.") }
{% endif %}
[gcode_macro set_fan_scaling]
description: Sets fan scaling factors applied to M106 command. If a speed is provided it will be adjusted according to the scaling parameters.
Usage: SET_FAN_SCALING [SCALE=<scale>] [BOOST=<boost>] [MAXIMUM=<max>]
[MINIMUM=<min>] [SPEED=<speed>]
variable_scale: 1.0
variable_boost: 0
variable_minimum: 0
variable_maximum: 255
variable_real_speed: 0
gcode:
_CHECK_FAN_PARAMS{% for k in params %}{' '~k~'='~params[k]}{% endfor %}
{% set SCALE = params.SCALE|default(scale)|float %}
{% set BOOST = params.BOOST|default(boost)|float %}
{% set MAXIMUM = params.MAXIMUM|default(maximum)|int %}
{% set MINIMUM = params.MINIMUM|default(minimum)|int %}
{% set SPEED = params.SPEED|default(real_speed)|int %}
{% if SCALE != 1.0 or BOOST != 0 or MAXIMUM != 255 or MINIMUM != 0 %}
{action_respond_info("Fan: Scale: %.2f Minimum:%i Maximum: %i Speed: %i"|
format(SCALE, MINIMUM, MAXIMUM, SPEED))}
{% endif %}
# Update parameters on change.
{% if params|length > 0 %}
SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=scale VALUE="{SCALE}"
SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=boost VALUE="{BOOST}"
SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=minimum VALUE="{MINIMUM}"
SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=maximum VALUE="{MAXIMUM}"
# Run fan at adusted speed
M106 S{SPEED}
{% endif %}
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.SCALE|default(1.0)|float %}
{% set dummy = params.BUMP|default(0)|int %}
{% set dummy = params.MAXIMUM|default(255)|int %}
{% set dummy = params.MINIMUM|default(0)|int %}
{% set dummy = params.SPEED|default(current speed)|int %}
" %} # End argument block for Mainsail
[gcode_macro reset_fan_scaling]
description: Clears all fan scaling factors.
Usage: RESET_FAN_SCALING
gcode:
SET_FAN_SCALING SCALE=1.0 BOOST=0 MAXIMUM=255 MINIMUM=0
[gcode_macro m106]
description: Wraps M106 to implement scaling overrides.
rename_existing: M106.6245197
gcode:
{% set S = params.S|default(255)|int %}
{% if S > 255 or S < 0 %}
{ action_raise_error("S[%i] out of range.") | format(S) }
{% endif %}
{% set scale = printer["gcode_macro set_fan_scaling"] %}
SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=real_speed VALUE="{S}"
M106.6245197 S{((((S + scale.boost) * scale.scale) | round | int,
scale.minimum) | max, scale.maximum) | min}

View File

@@ -1,140 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro _load_unload]
variable_is_printing: 1
gcode:
# Klipper think we're printing if parking homed first, so this is a hack to
# prevent that from happening. The caller sets the value and we clear it.
SET_GCODE_VARIABLE MACRO=_load_unload VARIABLE=is_printing VALUE="{1}"
{% set saved_extruder = printer.toolhead.extruder %}
{% set EXTRUDER = params.EXTRUDER|default(saved_extruder)|lower %}
{% if 'MINIMUM' in params %}
{% set MINIMUM = params.MINIMUM|int %}
# This is the special case for a filament change after an idle timeout.
{% elif printer.pause_resume.is_paused and printer[EXTRUDER].target == 0 and
printer["gcode_macro resume"].saved_extruder_temp %}
{% set MINIMUM = printer["gcode_macro resume"].saved_extruder_temp %}
{% else %}
{% set MINIMUM =
printer.configfile.settings[EXTRUDER].min_extrude_temp + 5.0 %}
{% endif %}
{% if MINIMUM < printer.configfile.settings[EXTRUDER].min_extrude_temp %}
{ action_raise_error("Extrude below minimum temp.") }
{% elif printer.pause_resume.is_paused %}
# Clear the saved E if we're (un-)loading while paused.
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_e VALUE="{0.0}"
{% elif printer.idle_timeout.state == "Printing" and is_printing %}
{ action_raise_error("Command not valid during printing.") }
{% endif %}
{% set km = printer["gcode_macro _km_globals"] %}
{% set SPEED = params.SPEED|default(km.load_speed)|int %}
{% set priming_length = km.load_priming_length %}
{% set LENGTH = params.LENGTH|default(km.load_length)|float - priming_length%}
{% if LENGTH < 0 %}
{% set priming_length = (priming_length + LENGTH, 0)|max %}
{% set LENGTH = 0 %}
{% endif %}
SAVE_GCODE_STATE NAME=_KM_LOAD_UNLOAD
{% if EXTRUDER != saved_extruder%}
ACTIVATE_EXTRUDER EXTRUDER={EXTRUDER}
{% endif %}
{% if printer[EXTRUDER].target < MINIMUM %}
M109 S{MINIMUM}
{% endif %}
M83
{% if params.LOAD|int %}
G1 E{LENGTH} F{SPEED}
G1 E{priming_length} F{(km.load_priming_speed, SPEED)|min}
G1 E{'%.4f' % -printer["gcode_macro resume"].saved_e} F{km.load_speed}
{% else %}
G1 E3.0 F{SPEED}
G4 P500
G1 E{'%.4f' % -priming_length} F{(km.load_priming_speed, SPEED)|min}
G1 E{'%.4f' % -LENGTH} F{SPEED}
{% endif %}
RESTORE_GCODE_STATE NAME=_KM_LOAD_UNLOAD
[gcode_macro load_filament]
description: Loads filament to the extruder.
Usage: LOAD_FILAMENT [LENGTH=<distance>] [SPEED=<speed>]
[EXTRUDER=<extruder>] [MINIMUM=<temperature>]
gcode:
_LOAD_UNLOAD LOAD=1{% for k in params
%}{' '~k~'="'~params[k]~'"'}{% endfor %}
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.LENGTH|default(variable_load_length)|float %}
{% set dummy = params.SPEED|default(variable_load_speed)|float %}
{% set dummy = params.EXTRUDER|default(current extruder) %}
{% set dummy = params.MINIMUM|default(min_extrude_temp)|int %}
" %} # End argument block for Mainsail
[gcode_macro unload_filament]
description: Unloads filament from the extruder.
Usage: UNLOAD_FILAMENT [LENGTH=<distance>] [SPEED=<speed>]
[EXTRUDER=<extruder>] [MINIMUM=<temperature>]
gcode:
_LOAD_UNLOAD LOAD=0{% for k in params
%}{' '~k~'="'~params[k]~'"'}{% endfor %}
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.LENGTH|default(variable_load_length)|float %}
{% set dummy = params.SPEED|default(variable_load_speed)|float %}
{% set dummy = params.EXTRUDER|default(default extruder) %}
{% set dummy = params.MINIMUM|default(min_extrude_temp)|int %}
" %} # End argument block for Mainsail
[gcode_macro _pause_inner_m700]
gcode:
{% set extruder = "extruder" ~ params.T|replace('0', '')
if "T" in params else printer.toolhead.extruder %}
{% if extruder != printer.toolhead.extruder%}
ACTIVATE_EXTRUDER EXTRUDER={extruder}
{% endif %}
{% set z_param = (' Z="%f"' % params.Z) if 'Z' in params else "" %}
{% if printer.idle_timeout.state|string == "Printing" %}
PAUSE P=2{z_param}
{% elif not printer.pause_resume.is_paused%}
SET_GCODE_VARIABLE MACRO=_load_unload VARIABLE=is_printing VALUE="{0}"
PARK P=2{z_param}
{% endif %}
[gcode_macro m701]
description: Pauses/parks the toolhead then loads filament to the extruder.
Usage: M701 [L<distance>] [Z<pos>] [T<extruder>]
gcode:
{% if 'U' in params %}
{% if not 'L' in params %}
RESPOND TYPE=error MSG="Argument \"U\" substituted for missing \"L\"."
{% set dummy = params.__setitem__("L", params.U) %}
{% else %}
RESPOND TYPE=error MSG="Invalid argument \"U\" ignored."
{% endif %}
{% endif %}
_PAUSE_INNER_M700 {% for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %}
LOAD_FILAMENT LENGTH={
params.L|default(printer["gcode_macro _km_globals"].load_length)|float}
[gcode_macro m702]
description: Pauses/parks the toolhead then unloads filament from the extruder.
Usage: M702 [U<distance>] [Z<pos>] [T<extruder>]
gcode:
{% if 'L' in params %}
{% if not 'U' in params %}
RESPOND TYPE=error MSG="Argument \"L\" substituted for missing \"U\"."
{% set dummy = params.__setitem__("U", params.L) %}
{% else %}
RESPOND TYPE=error MSG="Invalid argument \"L\" ignored."
{% endif %}
{% endif %}
_PAUSE_INNER_M700 {% for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %}
UNLOAD_FILAMENT LENGTH={
params.U|default(printer["gcode_macro _km_globals"].load_length)|float}

View File

@@ -1,357 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
################################################################################
#
# Declare any of the below variables in your own [gcode_macro _km_options] to
# to override the values here.
#
# DO NOT CHANGE ANYTHING IN THIS FILE!!!
#
# This file handles the initialization for all the macros, and difficult to
# diagnose errors will result from unexpected values or code changes.
#
################################################################################
[gcode_macro _km_globals]
# Available bed surfaces for offset adjustments.
variable_bed_surface_max_name_length: 10
# Available bed surfaces for offset adjustments.
variable_bed_surfaces: ['default']
# Default beep frequency (in Hz) for M300 command.
variable_beep_frequency: 1000
# Default beep duration (in ms) for M300 command.
variable_beep_duration: 100
# Length (in mm) of filament to load (bowden tubes will be longer).
variable_load_length: 90.0
# Filament loading speed (in mm/m).
variable_load_speed: 300
# Length (in mm) of the filament loading that feeds at priming speed.
variable_load_priming_length: 25.0
# Filament priming speed (in mm/m).
variable_load_priming_speed: 150
# Set to False to hide the Octoprint LCD menus.
variable_menu_show_octoprint: True
# Set to False to hide the SD Card LCD menus.
variable_menu_show_sdcard: True
# List up to 10 pre-heat settings in order for the LCD "Temperature" menu
variable_menu_temperature: [
{'name' : 'PLA', 'extruder' : 200, 'bed' : 60},
{'name' : 'PETG', 'extruder' : 230, 'bed' : 85},
{'name' : 'ABS', 'extruder' : 245, 'bed' : 110}]
# X position to park the toolhead.
variable_park_x: 0.0
# Y position to park the toolhead.
variable_park_y: 0.0
# Z position to park the toolhead.
variable_park_z: 20.0
# Minimum printable XY coordinate. Defaults to X and Y position_min.
variable_print_min: () # example: (0, 0)
# Maximum printable XY coordinate. Defaults to X and Y position_max.
variable_print_max: () # example: (220, 220)
# Scaling factor for M900 command (negative values make M900 a no-op).
variable_pressure_advance_scale: -1.0
# Additional padding around the specified print area for a bed mesh.
variable_probe_mesh_padding : 5.0
# Minimum number of probes for partial probing of a bed mesh.
variable_probe_min_count: 3
# Scaling factor to increase probe count for partial bed probes.
variable_probe_count_scale: 1.0
# Additional delay (in ms) during bed heating, to allow the bed to stabilize.
variable_start_bed_heat_delay: 2000
# Amount (in degrees C) to overshoot bed target temp before stabilizing.
variable_start_bed_heat_overshoot: 2.0
# Set to clear adjustments (e.g. feedrate, extrusion, heater) at end of print.
variable_start_clear_adjustments_at_end: True
# Final Y position of toolhead in PRINT_END. Defaults to print_max Y.
variable_start_end_park_y: 0.0
# Extruder scale factor during pre-warmup in PRINT_START.
variable_start_extruder_preheat_scale: 0.5
# Set the extruder target temp before bed level in PRINT_START.
variable_start_extruder_set_target_before_level: True
# Optional gcode run after all prep is complete, immediately before purge/print.
variable_start_gcode_before_print: ''
# Set to rehome Z in PRINT_START after bed temp stabilizes; False to disable.
variable_start_home_z_at_temp: True
# Set to level bed in PRINT_START after bed temp stabilizes; False to disable.
variable_start_level_bed_at_temp: True
# Distance (in millimeters) between the purge lines and the print area.
variable_start_purge_clearance: 2.0
# Length of filament (in millimeters) to purge at print start.
variable_start_purge_length: 0.0 # 30 is a good starting point.
# Length of filament (in millimeters) to prime before drawing purge lines.
variable_start_purge_prime_length: 15.0
# Level gantry in PRINT_START after bed temp stabilizes; False to disable.
variable_start_quad_gantry_level_at_temp: True
# Adjust Z tilt in PRINT_START after bed temp stabilizes; False to disable.
variable_start_z_tilt_adjust_at_temp: True
# X and Y travel speed (in mm/m) for movement macros.
variable_travel_speed_xy: 3000
# Z travel speed in (mm/m) for movement macros.
variable_travel_speed_z: 600
# Value to scale acceleration by when setting ACCEL_TO_DECEL in M204, etc.
variable_velocity_decel_scale: 0.5
################################################################################
description: Initializes our globals, including any _km_options overrides.
gcode:
# Doing a shutdown here is a bit aggressive, but if we're missing required
# sections then a lot of things could go very bad later.
# To minimize the annoyance we try to identify all the fatal errors at once.
# format is:
# key = required config section
# value[0] = required field in section
# value[1] = required string in field
# A "None" value means there's no required field
{% set required_sections = {"heater_bed" : None,
"extruder" : None,
"gcode_macro _km_options" : None,
"idle_timeout" : ("gcode", "_KM_IDLE_TIMEOUT"),
"pause_resume" : None,
"respond" : None,
"save_variables" : None,
"virtual_sdcard" : None
} %}
{% set output = [] %}
{% for s in required_sections %}
{% set f = required_sections[s][0] if required_sections[s] else None %}
{% set v = required_sections[s][1] if required_sections[s] else None %}
{% if s not in printer.configfile.config %}
{% set dummy = output.append("Missing [%s] section.\n" | format(s)) %}
{% elif f and
(v not in printer.configfile.config[s][f]|default("")|upper) %}
{% set dummy = output.append("Missing %s in %s for [%s] section.\n"
| format(v, f, s)) %}
{% endif %}
{% endfor %}
{% if output %}
{ action_emergency_stop((
"required printer.cfg section(s) missing:\n"
~ output | join("\n")) ~
"See readme: https://github.com/jschuh/klipper-macros\x23klipper-setup")
}
{% endif %}
# These are all set to their defaults based on config options:
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_level_bed_at_temp VALUE="{
1 if printer.bed_mesh is defined else 0}"
BED_MESH_CHECK
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_quad_gantry_level_at_temp VALUE="{
1 if printer.quad_gantry_level is defined else 0}"
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_z_tilt_adjust_at_temp VALUE="{
1 if printer.z_tilt is defined else 0}"
{% set toolhead = printer.toolhead %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=print_min VALUE="{
(toolhead.axis_minimum.x, toolhead.axis_minimum.y)}"
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=print_max VALUE="{
(toolhead.axis_maximum.x, toolhead.axis_maximum.y)}"
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_end_park_y VALUE="{
toolhead.axis_maximum.y}"
{% set settings = printer.configfile.settings %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_home_z_at_temp VALUE="{
1 if ("stepper_z" in settings and
settings.stepper_z.endstop_pin.split()|join("")|lower ==
"probe:z_virtual_endstop") else 0}"
{% set options = printer["gcode_macro _km_options"] %}
{% set km = printer["gcode_macro _km_globals"] %}
# Force overrides to use the original types in _KM_GLOBALS.
{% for k in options %}
{% if k not in km %}
{action_raise_error("%s is not valid for _KM_OPTIONS." | format(k))}
{% endif %}
{% if km[k] is string %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k
} VALUE="'{options[k]|replace('\\','\\\\')|replace('\'','\\\'')
|replace('\"','\\\"')}'"
{% elif km[k] is float %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k
} VALUE="{options[k]|float}"
{% elif km[k] is integer or km[k] is boolean %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k} VALUE="{options[k]|int}"
{% elif km[k] is mapping %}
{% if options[k] is not mapping %}
{action_raise_error("%s requires a mapping type." | format(k))}
{% endif %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k
} VALUE="{options[k]|replace('\"','\\\"')}"
{% elif km[k] is sequence %}
{% if options[k] is not sequence %}
{action_raise_error("%s requires a sequence type." | format(k))}
{% endif %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k
} VALUE="{options[k]|replace('\"','\\\"')}"
{% else %}
{action_raise_error("%s is not a valid type for _KM_OPTIONS."|format(k))}
{% endif %}
{% endfor %}
# Defaults that can alias to a user override.
{% if "print_max" in options and "start_end_park_y" not in options %}
SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_end_park_y VALUE="{
options.print_max[1] }"
{% endif %}
{% if "homing_override" in printer.configfile.config %}
{% for l in printer.configfile.config.homing_override.gcode.split("\n") %}
{% if " g28 " in (" " ~ l.split("\x23")[0].split(";")[0]|lower ~ " ") %}
{ action_raise_error(
"G28 in [homing_override] gcode. Replace with G28.6245197 to "
"fix recursive macro call.\n"
"See readme: https://github.com/jschuh/klipper-macros\x23g28") }
{% endif %}
{% endfor %}
{% endif %}
M400
[delayed_gcode INIT_GLOBALS]
# This runs once at startup and initializes all macros.
initial_duration: 1
gcode:
_KM_GLOBALS
# This needs to be its own macro so it gets evaluated after _KM_GLOBALS runs.
CHECK_KM_CONFIG
_INIT_SURFACES
# Sets the default drawing parameters.
SET_DRAW_PARAMS WIDTH="{printer.configfile.settings.extruder.nozzle_diameter}"
# This is any end-user gcode that need to run after macro initialization.
_KM_OPTIONS
[gcode_macro check_km_config]
description: Checks global variables and throws an error on any invalid values.
Does nothing if the config has no errors.
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% set toolhead = printer.toolhead %}
{% set output = [] %}
{% if km.park_x > toolhead.axis_maximum.x or
km.park_x < toolhead.axis_minimum.x %}
{% set dummy = output.append("park_x is invalid.") %}
{% endif %}
{% if km.park_y > toolhead.axis_maximum.y or
km.park_y < toolhead.axis_minimum.y %}
{% set dummy = output.append("park_y is invalid.") %}
{% endif %}
{% if km.park_z > toolhead.axis_maximum.z or
km.park_z < toolhead.axis_minimum.z %}
{% set dummy = output.append("park_z is invalid.") %}
{% endif %}
{% if km.print_max[0] > toolhead.axis_maximum.x or
km.print_max[1] > toolhead.axis_maximum.y %}
{% set dummy = output.append("print_max is invalid.") %}
{% endif %}
{% if km.print_min[0] < toolhead.axis_minimum.x or
km.print_min[1] < toolhead.axis_minimum.y %}
{% set dummy = output.append("print_min is invalid.") %}
{% endif %}
{% if km.start_extruder_preheat_scale > 1.0 or
km.start_extruder_preheat_scale < 0.0 %}
{% set dummy = output.append("extruder_preheat_scale is invalid.") %}
{% endif %}
{% if km.load_length >
printer.configfile.settings["extruder"].max_extrude_only_distance %}
{% set dummy = output.append(
"load_length exceeds max_extrude_only_distance.") %}
{% endif %}
{% if km.load_length < km.load_priming_length %}
{% set dummy = output.append(
"load_length is shorter than load_priming_length.") %}
{% endif %}
{% if km.load_length < 0.0 %}
{% set dummy = output.append("load_length is negative.") %}
{% endif %}
{% if km.load_priming_length < 0.0 %}
{% set dummy = output.append("load_priming_length is negative.") %}
{% endif %}
# Emit all the config errors.
{% if output %}
{ action_raise_error(output|sort|join('\n')) }
{% endif %}
M400
[gcode_macro kmvars]
description: Lists global variables used by klipper-macros.
Usage: KMVARS [SEARCH=<search_string>]
gcode:
{% set SEARCH = params.SEARCH|default(params.S|default(""))|lower %}
{% set km = printer["gcode_macro _km_globals"] %}
{% set output = [] %}
{% for k in km %}
{% if SEARCH in k %}
{% set dummy = output.append(k ~ ": " ~ km[k]) %}
{% endif %}
{% endfor %}
{ action_respond_info(output|sort|join('\n')) }
[gcode_macro check_macro_docs]
description: Lists macros lacking proper documentation.
Usage: CHECK_MACRO_DOCS [USAGE=<0|1>] [HIDDEN=<1|0>] [RENAMED=<1|0>]
gcode:
{% set USAGE = params.USAGE|default(0)|int %}
{% set HIDDEN = params.HIDDEN|default(0)|int %}
{% set RENAMED = params.RENAMED|default(0)|int %}
{% set output = [] %}
{%set config = printer.configfile.config %}
{% for k in config|sort %}
{% if k.startswith("gcode_macro") %}
{% set name = k.split()[1] %}
{% set desc = config[k].description|default("") %}
{% set is_renamed = config[k].rename_existing|default("") %}
{% if (not desc or (USAGE and not "Usage: "~name.upper() in desc)) and
(HIDDEN or not name.startswith('_')) and (RENAMED or is_renamed) %}
{% set dummy = output.append("%s&nbsp;%s: missing %s."
| format("*" if is_renamed else "&nbsp;", name,
"description" if not desc else "usage")) %}
{% endif %}
{% endif %}
{% endfor %}
{action_respond_info(output|join("\n"))}
# The below macro is a lightly edited version of the one found here:
# https://klipper.discourse.group/t/example-search-printer-objects/164
[gcode_macro listvars]
description: Lists per-macro variables with a name containing SEARCH. This is
useful for debugging macros by allowing you to probe printer state. Be very
careful, however, as an overly broad SEARCH parameter can take a long time
to process and potentially hang or crash klipper.
Usage: LISTVARS SEARCH=<search_string>
gcode:
{% if 'SEARCH' not in params and 'S' not in params %}
{ action_raise_error("Must provide a SEARCH parameter.") }
{% endif %}
{% set SEARCH = params.SEARCH|default(params.S)|lower %}
{% set ns = namespace() %}
{% set output = [] %}
{% for item in printer %}
{% if ' ' in item %}
{% set ns.path = ['printer', "['%s']" % (item), ''] %}
{% else %}
{% set ns.path = ['printer.', item, ''] %}
{% endif %}
{% if SEARCH in ns.path|lower %}
{% set dummy = output.append(ns.path|join) %}
{% endif %}
{% if printer[item].items() %}
{% for childkey, child in printer[item].items() recursive %}
{% set ns.path = ns.path[:loop.depth|int + 1] %}
{% if ' ' in childkey %}
{% set null = ns.path.append("['%s']" % (childkey)) %}
{% else %}
{% set null = ns.path.append(".%s" % (childkey)) %}
{% endif %}
{% if child is mapping %}
{loop(child.items())}
{% else %}
{% if SEARCH in ns.path|lower %}
{% set dummy = output.append("%s : %s" % (ns.path|join, child)) %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{ action_respond_info(output|join("\n")) }

View File

@@ -1,235 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro set_heater_temperature_scaled]
gcode:
{% set HEATER = params.HEATER.lower() %}
{% set TARGET = params.TARGET|default(0.0)|float %}
{% set scaled_heaters =
printer["gcode_macro set_heater_scaling"].scaled_heaters %}
{% if HEATER in scaled_heaters %}
{% set scales = scaled_heaters[HEATER] %}
{% set dummy = scales.__setitem__("real_target", TARGET) %}
{%if TARGET > 0.0 %}
{% set TARGET = (((TARGET + scales.bump) * scales.scale, scales.minimum)
| max, scales.maximum)|min %}
{% endif %}
{% endif %}
SET_HEATER_TEMPERATURE HEATER="{HEATER}" TARGET={TARGET}
[gcode_macro temperature_wait_scaled]
gcode:
{% set SENSOR = params.SENSOR.lower() %}
{% set heater = SENSOR if not SENSOR.startswith("heater_generic") else
SENSOR.split()[1] %}
{% set scaled_heaters =
printer["gcode_macro set_heater_scaling"].scaled_heaters %}
{% if heater in scaled_heaters %}
{% set scales = scaled_heaters[heater] %}
{% if "MINIMUM" in params and MINIMUM > 0.0 %}
{% set MINIMUM = (((MINIMUM + scales.bump) * scales.scale, scales.minimum)
| max, scales.maximum)|min %}
{% endif %}
{% if "MAXIMUM" in params and MINIMUM > 0.0 %}
{% set MAXIMUM = (((MAXIMUM + scales.bump) * scales.scale, scales.minimum)
| max, scales.maximum)|min %}
{% endif %}
{% else %}
{% set settings = printer.configfile.settings[SENSOR] %}
{% set MINIMUM = params.MINIMUM|default(settings.min_temp) %}
{% set MAXIMUM = params.MAXIMUM|default(settings.max_temp) %}
{% endif %}
{% if printer[sensor].temperature < MINIMUM or
printer[sensor].temperature > MAXIMUM %}
TEMPERATURE_WAIT SENSOR="{SENSOR}" MINIMUM={MINIMUM} MAXIMUM={MAXIMUM}
{% endif %}
[gcode_macro _gcode_wait_wrapper_inner]
gcode:
# Macro variables are evaluated at instantiation, so this inner macro is what
# gets us a scaled target value.
{% set sensor = params.HEATER if params.HEATER in
printer.heaters.available_heaters
else ("heater_generic " ~ params.HEATER) %}
{% set target = printer[sensor].target %}
{% if 'R' in params and target > 0.0 %}
{% set T = params.T|default("") %}
M{params.M}.6245197 S{target} { (" T"~T) if T else "" }
{% elif printer[sensor].temperature < target %}
TEMPERATURE_WAIT SENSOR="{sensor}" MINIMUM={target}
{% endif %}
[gcode_macro _gcode_wait_wrapper]
gcode:
{% set target = params.S | default(params.R | default(0))| float %}
SET_HEATER_TEMPERATURE_SCALED HEATER="{params.HEATER}" TARGET={target}
_GCODE_WAIT_WRAPPER_INNER{%
for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %}
[gcode_macro m109]
rename_existing: M109.6245197
gcode:
{% set extruder = "extruder" ~ params.T|replace('0', '')
if "T" in params else printer.toolhead.extruder %}
_GCODE_WAIT_WRAPPER HEATER={extruder}{%
for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %}
[gcode_macro m190]
rename_existing: M190.6245197
gcode:
_GCODE_WAIT_WRAPPER HEATER=heater_bed {%
for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %}
[gcode_macro m191]
description: Sets chamber temperature (with wait for heating).
Usage: M191 [S<temp>]
gcode:
# Just fake the R parameter for the chamber.
{% if "R" in params %}
{% set dummy = params.__setitem__("S", params.R) %}
{% endif %}
_GCODE_WAIT_WRAPPER HEATER=chamber {%
for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %}
[gcode_macro m104]
rename_existing: M104.6245197
gcode:
{% set extruder = "extruder" ~ params.T|replace('0', '')
if "T" in params else printer.toolhead.extruder %}
SET_HEATER_TEMPERATURE_SCALED HEATER={extruder} TARGET={params.S|default(0)}
[gcode_macro m140]
rename_existing: M140.6245197
gcode:
SET_HEATER_TEMPERATURE_SCALED HEATER=heater_bed TARGET={params.S|default(0)}
[gcode_macro m141]
description: Sets chamber temperature.
Usage: M141 [S<temp>]
gcode:
SET_HEATER_TEMPERATURE_SCALED HEATER=chamber TARGET={params.S|default(0)}
[gcode_macro _check_heater_params]
gcode:
{% set HEATER = params.HEATER|lower %}
{% set sensor = params.HEATER %}
{% if HEATER not in printer.heaters.available_heaters %}
{% set sensor = "heater_generic " ~ HEATER %}
{% if sensor not in printer.heaters.available_heaters %}
{ action_raise_error("The value '%s' is not valid for HEATER"
| format(HEATER)) }
{% endif %}
{% endif %}
{% set settings = printer.configfile.settings[sensor] %}
{% set scaled_heaters =
printer["gcode_macro set_heater_scaling"].scaled_heaters %}
{% if HEATER is in scaled_heaters %}
{% set scales = scaled_heaters[HEATER] %}
{% else %}
{% set scales = { "scale": 1.0, "bump": 0.0, "minimum": settings.min_temp,
"maximum": settings.max_temp,
"real_target": printer[sensor].target} %}
{% endif %}
{% set SCALE = params.SCALE|default(scales.scale)|float %}
{% set BUMP = params.BUMP|default(scales.bump)|float %}
{% set MINIMUM = params.MINIMUM|default(scales.minimum)|float %}
{% set MAXIMUM = params.MAXIMUM|default(scales.maximum)|float %}
{% if SCALE <= 0 %}
{ action_raise_error("SCALE must be a positive value.") }
{% elif MINIMUM < settings.min_temp or MINIMUM > settings.max_temp %}
{ action_raise_error("MINIMUM must be between %.1f and %.1f" |
format(settings.min_temp, settings.max_temp)) }
{% elif MAXIMUM < settings.min_temp or MAXIMUM > settings.max_temp %}
{ action_raise_error("MAXIMUM must be between %.1f and %.1f" |
format(settings.min_temp, settings.max_temp)) }
{% elif MINIMUM >= MAXIMUM %}
{ action_raise_error("MINIMUM must be less than MAXIMUM.") }
{% elif "TARGET" in params and (params.TARGET|float < MINIMUM or
params.TARGET|float > MAXIMUM) %}
{ action_raise_error("TARGET must be between %.1f and %.1f" |
format(settings.min_temp, settings.max_temp)) }
{% endif %}
[gcode_macro set_heater_scaling]
description: Sets scaling parameters for heater. If a new target temperature is passed it will be adjusted to the scaling parameters.
Usage: SET_HEATER_SCALING [HEATER=<heater>] [SCALE=<scale_factor>]
[BUMP=<degrees>] [MAXIMUM=<degrees>]
[MINIMUM=<degrees>] [TARGET=<temp>]
variable_scaled_heaters: {}
gcode:
# If no heater is supplied just list out all the scaled heaters.
{% if "HEATER" is not in params %}
{% set output = [] %}
{% for h in scaled_heaters %}
{% set dummy = output.append(
"%s: Scale: %.2f Bump: %.1f Minimum:%.1f Maximum: %.1f"
| format(h, scaled_heaters[h].scale, scaled_heaters[h].bump,
scaled_heaters[h].minimum, scaled_heaters[h].maximum)) %}
{% endfor %}
{% if output %}}{action_respond_info(output|join('\n'))}{% endif %}
{% else %}
# See if we need a new scaling entry for this heater.
{% set HEATER = params.HEATER.lower() %}
{% set settings = printer.configfile.settings[HEATER] %}
{% if HEATER is not in scaled_heaters %}
{% set dummy = scaled_heaters.__setitem__(HEATER, {"scale": 1.0,
"bump": 0.0, "minimum": settings.min_temp,
"maximum": settings.max_temp,
"real_target": printer[HEATER].target}) %}
{% endif %}
_CHECK_HEATER_PARAMS{% for k in params %}{' '~k~'='~params[k]}{% endfor %}
{% set scales = scaled_heaters[HEATER] %}
{% set SCALE = params.SCALE|default(scales.scale)|float %}
{% set BUMP = params.BUMP|default(scales.bump)|float %}
{% set MAXIMUM = params.MAXIMUM|default(scales.maximum)|float %}
{% set MINIMUM = params.MINIMUM|default(scales.minimum)|float %}
{% set TARGET = params.TARGET|default(scales.real_target)|float %}
{% set dummy = scales.__setitem__("scale", SCALE) %}
{% set dummy = scales.__setitem__("bump", BUMP) %}
{% set dummy = scales.__setitem__("maximum", MAXIMUM) %}
{% set dummy = scales.__setitem__("minimum", MINIMUM) %}
{% set dummy = scales.__setitem__("real_target", TARGET) %}
{% set settings = printer.configfile.settings[HEATER] %}
{% if SCALE != 1.0 or BUMP != 0.0 or MINIMUM != settings.min_temp or
MAXIMUM != settings.max_temp %}
{% set dummy = scaled_heaters.__setitem__(HEATER, scales) %}
{% else %} # Remove a redundant scaling entry.
{% set dummy = scaled_heaters.__delitem__(HEATER) %}
{% endif %}
SET_HEATER_TEMPERATURE_SCALED HEATER={HEATER} TARGET={TARGET}
{action_respond_info(
"%s: Scale: %.2f Bump: %.1f Minimum:%.1f Maximum: %.1f Target: %.1f"
| format(HEATER, SCALE, BUMP, MINIMUM, MAXIMUM, TARGET))}
{% endif %}
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.HEATER|default(e.g. extruder) %}
{% set dummy = params.SCALE|default(1.0)|float %}
{% set dummy = params.BUMP|default(0.0)|float %}
{% set dummy = params.MAXIMUM|default(max_temp)|float %}
{% set dummy = params.MINIMUM|default(min_temp)|float %}
{% set dummy = params.TARGET|default(current target)|float %}
" %} # End argument block for Mainsail
[gcode_macro reset_heater_scaling]
description: Clears scaling for heater (or all heaters if none specified).
Usage: RESET_HEATER_SCALING [HEATER=<heater>]
gcode:
{% if "HEATER" in params %}
{% set HEATER = params.HEATER.lower() %}
{% if HEATER not in printer.heaters.available_heaters %}
{ action_raise_error("The value '%s' is not valid for HEATER"
| format(HEATER)) }
{% endif %}
{% set settings = printer.configfile.settings[HEATER] %}
SET_HEATER_SCALING HEATER={HEATER
} SCALE=1.0 BUMP=0.0 MINIMUM={settings.min_temp
} MAXIMUM={settings.max_temp}
{% else %}
# Clear everything if no heater was provided.
SET_GCODE_VARIABLE MACRO=set_heater_scaling VARIABLE=scaled_heaters VALUE={
"{}"}
{% endif %}

View File

@@ -1,16 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro _km_idle_timeout]
gcode:
{% if printer.pause_resume.is_paused %}
{action_respond_info("Extruder powered down on idle timeout.")}
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_extruder_temp VALUE="{
printer[printer.toolhead.extruder].target}"
M104; Turn off extruder but leave the bed on.
{% else %}
TURN_OFF_HEATERS
M107; turn off fan
M84
{% endif %}

View File

@@ -1,57 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro _check_kinematic_limits]
gcode:
{% set toolhead = printer.toolhead %}
{% if params.X and (params.X|float < toolhead.axis_minimum.x or
params.X|float > toolhead.axis_maximum.x) %}
{action_raise_error("X[%.3f] must be between %.3f and %.3f."
| format(params.X|float, toolhead.axis_minimum.x,
toolhead.axis_maximum.x))}
{% elif params.Y and (params.Y|float < toolhead.axis_minimum.y or
params.Y|float > toolhead.axis_maximum.y) %}
{action_raise_error("Y[%.3f] must be between %.3f and %.3f."
| format(params.Y|float, toolhead.axis_minimum.y,
toolhead.axis_maximum.y))}
{% elif params.Z and (params.Z|float < toolhead.axis_minimum.z or
params.Z|float > toolhead.axis_maximum.z) %}
{action_raise_error("Z[%.3f] must be between %.3f and %.3f."
| format(params.Z|float, toolhead.axis_minimum.z,
toolhead.axis_maximum.z))}
{% elif params.E and (params.E|float|abs > printer.configfile.settings[
"extruder"].max_extrude_only_distance) %}
{action_raise_error("E[%.4f] exceeds max_extrude_only_distance[%.4f]."
| format(params.E|float|abs, printer.configfile.settings[
"extruder"].max_extrude_only_distance))}
{% endif %}
[gcode_macro g28]
description: Wraps the G28 command to add the Marlin "O" parameter so that already homed axes will not be homed again. See the Klipper documentation on G28 for the behavior of the other parameters.
Usage: G28 [O] ...
rename_existing: G28.6245197
gcode:
{% set do_homing = True %}
{% if 'O' in params %}
# No axes means home them all, so add the list in before pruning.
{% if params|select('in', 'XYZ')|list|length == 0 %}
{% for k in 'XYZ' %}
{% set dummy = params.__setitem__(k, '') %}
{% endfor %}
{% endif %}
# Prune out the already homed axes.
{% for k in params|select('in', 'XYZ')|list %}
{% if k|lower in printer.toolhead.homed_axes %}
{% set dummy = params.__delitem__(k) %}
{% endif %}
{% endfor %}
{% set dummy = params.__delitem__('O') %}
# If we don't have anything left we can skip homing.
{% set do_homing = params|select('in', 'XYZ')|list|length > 0 %}
{% else %}
{% endif %}
{% if do_homing %}
G28.6245197{% for k in params %}{' ' ~ k ~ params[k]}{% endfor %}
{% endif %}

View File

@@ -1,281 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro before_layer_change]
description: Add this to the "before layer change" input box in the slicer.
Usage: BEFORE_LAYER_CHANGE HEIGHT=<current_height> LAYER=<current_layer>
gcode:
{% set height = params.HEIGHT|default(printer.toolhead.position.z)|float %}
{% set layer = params.LAYER|default(-1)|int + 1 %}
{% if height >= 0.0 and layer >= 0 %}
SET_PRINT_STATS_INFO CURRENT_LAYER="{layer}"
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=cur_height VALUE="{height}"
{% if printer["gcode_macro _km_layer_run"].clearance_z < height %}
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=clearance_z VALUE="{
height}"
{% endif %}
{% endif %}
_KM_LAYER_RUN BEFORE=1
[gcode_macro after_layer_change]
description: Add this to the "after layer change" input box in the slicer.
Usage: AFTER_LAYER_CHANGE
gcode:
_KM_LAYER_RUN BEFORE=0
[gcode_macro gcode_at_layer]
description: Schedules the specified g-code command to be run at the specified layer. LAYER=next will cause the command to run at the next layer change.
Usage: GCODE_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } COMMAND=<gcode>
[BEFORE=<0|1>] [ALLOW_DUPLICATE=<0|1>]
gcode:
{% set commands = printer["gcode_macro _km_layer_run"].commands %}
{% set tot_layers = printer.print_stats.info.total_layer %}
{% if params|length > 0 %}
{% if not printer.pause_resume.is_paused and
printer.idle_timeout.state|string != "Printing" %}
{action_raise_error("No active print.")}
{% endif %}
{% set when = "before" if (params.BEFORE|default(0)|int) else "after" %}
{% if "LAYER" in params %}
{% set cur_layer = printer.print_stats.info.current_layer %}
{% if "HEIGHT" in params %}
{action_raise_error("Conflicting HEIGHT and LAYER arguments provided.")}
{% elif params.LAYER|string|lower == "next" %}
{% set LAYER = cur_layer + 1 %}
{% else %}
{% set LAYER = params.LAYER|int %}
{% endif %}
{% if LAYER <= cur_layer %}
{action_raise_error("LAYER[%i] must be above current print layer[%i]."
| format(LAYER, cur_layer))}
{% elif tot_layers and LAYER >= tot_layers %}
{action_raise_error("LAYER[%i] must be below top layer[%i]."
| format(LAYER, tot_layers))}
{% endif %}
{% set key = "%12i_layer_%s"|format(LAYER, when)%}
{% elif "HEIGHT" in params %}
{% set HEIGHT = params.HEIGHT|float %}
{% set cur_height = printer["gcode_macro _km_layer_run"].cur_height %}
{% if HEIGHT <= cur_height %}
{action_raise_error(
"HEIGHT[%.3f] must be above current print height[%.3f].")
| format(HEIGHT, cur_height)}
{% elif HEIGHT >= printer.toolhead.axis_maximum.z %}
{action_raise_error(
"HEIGHT[%.3f] must be below maximum Z height[%.3f].")
| format(HEIGHT, printer.toolhead.axis_maximum.z)}
{% endif %}
{% set key = "%12.3f_height_%s"|format(HEIGHT, when)%}
{% else %}
{action_raise_error("No HEIGHT or LAYER argument provided.")}
{% endif %}
{% set COMMAND = params.COMMAND %}
{% if key not in commands %}
{% set dummy = commands.__setitem__(key, []) %}
{% endif %}
{% if COMMAND in commands[key] or params.ALLOW_DUPLICATE|default(0)|int %}
{action_raise_error("Duplicate command previously scheduled.")}
{% else %}
{% set dummy = commands[key].append(COMMAND) %}
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands VALUE="{
commands|replace('\"','\\\"')}"
{% set args = key.split('_') %}
{% set pos = ("%i"|format(args[0]|int)) if args[1] == "layer" else
("%.3fmm"|format(args[0]|float)) %}
{action_respond_info("%s %s (%s):\n* %s" |
format(args[1], pos, args[2], COMMAND))}
{% endif %}
# No arguments means just list all the triggers.
{% else %}
{% set layers = [] %}
{% set heights = [] %}
{% for k in commands|list|sort %}
{% set args = k.split('_') %}
{% if args[1] == "layer" %}
{% set dummy = layers.append("layer %i (%s):"
| format(args[0]|int, args[2])) %}
{% for c in commands[k] %}
{% set dummy = layers.append("* %s" | format(c)) %}
{% endfor %}
{% else %}
{% set dummy = heights.append("height %.3fmm (%s):"
| format(args[0]|float, args[2])) %}
{% for c in commands[k] %}
{% set dummy = heights.append("* %s" | format(c)) %}
{% endfor %}
{% endif %}
{% endfor %}
{% set dummy = layers.extend(heights) %}
{action_respond_info(layers|join('\n'))}
{% endif %}
[gcode_macro init_layer_gcode]
description: Clears scheduled gcode commands and state for all layers.
Usage: INIT_LAYER_GCODE LAYERS=<num>
gcode:
SET_PRINT_STATS_INFO TOTAL_LAYER="{params.LAYERS|int}"
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=cur_height VALUE="{0.0}"
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=clearance_z VALUE="{0.0}"
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands VALUE="{{}}"
[gcode_macro _reset_layer_gcode]
description: Clears scheduled gcode commands and state for all layers.
Usage: _RESET_LAYER_GCODE
gcode:
SET_PRINT_STATS_INFO TOTAL_LAYER="0"
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=cur_height VALUE="{0.0}"
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=clearance_z VALUE="{0.0}"
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands VALUE="{{}}"
[gcode_macro cancel_all_layer_gcode]
description: Clears all scheduled gcode commands.
Usage: CANCEL_ALL_LAYER_GCODE
gcode:
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands VALUE="{{}}"
[gcode_macro pause_next_layer]
description: Convenience macro to schedule the current print to pause at the next layer change. See PAUSE for additional arguments.
Usage: PAUSE_NEXT_LAYER ...
gcode:
_CHECK_KINEMATIC_LIMITS{% for k in params%}{' ' ~k~ '=' ~ params[k]
}{% endfor %}
GCODE_AT_LAYER LAYER=NEXT COMMAND="PAUSE{% for k in params %}{
' ' ~ k ~ '=' ~ params[k]}{% endfor %}"
[gcode_macro _km_layer_run]
description: Runs pending commands for the current layer change.
Usage: _KM_LAYER_RUN BEFORE=<0|1>
variable_cur_height: 0.0
variable_clearance_z: 0.0
variable_commands: {}
gcode:
{% set BEFORE = params.BEFORE|int %}
{% set cur_layer = printer.print_stats.info.current_layer %}
{% for k in commands | list | sort %}
{% set args = k.split('_') %}
{% set cmd_pos = args[0]|float %}
{% set cmd_type = args[1] %}
{% set cmd_before = 1 if args[2] == "before" else 0 %}
{% if cmd_before == BEFORE and (
(cmd_type == "layer" and cmd_pos|int <= cur_layer) or
(cmd_type == "height" and cmd_pos <= cur_height)) %}
{action_respond_info("Executing scheduled commands at %s %s:\n%s" |
format(args[1], args[0].strip(), commands[k]|join('\n')))}
{% for c in commands[k] %}
{c}
{% endfor %}
{% set dummy = commands.__delitem__(k) %}
{% endif %}
{% endfor %}
SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands VALUE="{
commands|replace('\"','\\\"')}"
[gcode_macro pause_at_layer]
description: Convenience macro to schedule the current print to pause at the specified layer change. LAYER=next will cause the command to run at the next layer change. See PAUSE for additional arguments.
Usage: PAUSE_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } ...
gcode:
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.LAYER|default(layer number)|float %}
{% set dummy = params.HEIGHT|default(Z height)|int %}
" %} # End argument block for Mainsail
{% set filtered_params = params|reject('in',['HEIGHT','LAYER'])|list|sort %}
_CHECK_KINEMATIC_LIMITS{% for k in filtered_params%}{' ' ~k~ '=' ~ params[k]
}{% endfor %}
GCODE_AT_LAYER {% for k in params|select('in',['HEIGHT','LAYER'])|list %}{
' ' ~ k ~ '=' ~ params[k] }{% endfor
%} COMMAND="PAUSE{% for k in filtered_params %}{
' ' ~ k ~ '=' ~ params[k]}{% endfor %}"
[gcode_macro speed_at_layer]
description: Convenience macro to schedule a feedrate adjustment at the specified layer change. LAYER=next will cause the command to run at the next layer change. (SPEED parameter behaves the same as the M220 S parameter.)
Usage: SPEED_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } SPEED=<percentage>
gcode:
{% set SPEED = params.SPEED|default(0)|int %}
{% if SPEED < 1 or SPEED > 500 %}
{action_raise_error("SPEED[%i] parameter between 1 and 500 is required."
% SPEED)}
{% endif %}
GCODE_AT_LAYER {% for k in params|select('in',['HEIGHT','LAYER'])|list %}{
' ' ~ k ~ '=' ~ params[k] }{% endfor %} COMMAND="M220 S{SPEED|int}"
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.LAYER|default(layer number)|float %}
{% set dummy = params.HEIGHT|default(Z height)|int %}
{% set dummy = params.SPEED|default(percentage)|int %}
" %} # End argument block for Mainsail
[gcode_macro flow_at_layer]
description: Convenience macro to schedule a flow percentage adjustment at the specified layer change. LAYER=next will cause the command to run at the next layer change. (FLOW parameter behaves the same as the M221 S parameter.)
Usage: FLOW_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } FLOW=<percentage>
gcode:
{% set FLOW = params.FLOW|default(0)|int %}
{% if FLOW < 1 or FLOW > 500 %}
{action_raise_error("FLOW[%i] parameter between 1 and 500 is required."
% FLOW)}
{% endif %}
GCODE_AT_LAYER {% for k in params|select('in',['HEIGHT','LAYER'])|list %}{
' ' ~ k ~ '=' ~ params[k] }{% endfor %} COMMAND="M221 S{FLOW|int}"
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.LAYER|default(layer number)|float %}
{% set dummy = params.HEIGHT|default(Z height)|int %}
{% set dummy = params.FLOW|default(percentage)|int %}
" %} # End argument block for Mainsail
[gcode_macro fan_at_layer]
description: Convenience macro to schedule a fan adjustment at the specified layer change. LAYER=next will cause the command to run at the next layer change. See SET_FAN_SCALING for additional arguments.
Usage: FAN_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } ...
gcode:
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.LAYER|default(layer number)|float %}
{% set dummy = params.HEIGHT|default(Z height)|int %}
{% set dummy = params.SCALE|default(1.0)|float %}
{% set dummy = params.BUMP|default(0)|int %}
{% set dummy = params.MAXIMUM|default(0)|int %}
{% set dummy = params.MINIMUM|default(255)|int %}
{% set dummy = params.SPEED|default(current speed)|int %}
" %} # End argument block for Mainsail
{% set filtered_params = params|reject('in',['HEIGHT','LAYER'])|list|sort %}
{% if filtered_params|length == 0 %}
{action_raise_error("No fan parameters provided.")}
{% endif %}
_CHECK_FAN_PARAMS{% for k in filtered_params %}{' '~k~'='~params[k]
}{% endfor %}
GCODE_AT_LAYER {% for k in params|select('in',['HEIGHT','LAYER'])|list %}{
' ' ~ k ~ '=' ~ params[k] }{% endfor
%} COMMAND="SET_FAN_SCALING{% for k in filtered_params %}{
' ' ~ k ~ '=' ~ params[k]}{% endfor %}"
[gcode_macro heater_at_layer]
description: Convenience macro to schedule a heater adjustment at the specified layer change. LAYER=next will cause the command to run at the next layer change. See SET_HEATER_SCALING for additional arguments.
Usage: HEATER_AT_LAYER { HEIGHT=<pos> | LAYER=<layer> } ...
gcode:
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.LAYER|default(layer number)|float %}
{% set dummy = params.HEIGHT|default(Z height)|int %}
{% set dummy = params.HEATER|default(e.g. extruder) %}
{% set dummy = params.SCALE|default(1.0)|float %}
{% set dummy = params.BUMP|default(0.0)|float %}
{% set dummy = params.MAXIMUM|default(max_temp)|float %}
{% set dummy = params.MINIMUM|default(min_temp)|float %}
{% set dummy = params.TARGET|default(current target)|float %}
" %} # End argument block for Mainsail
{% set filtered_params = params|reject('in',['HEIGHT','LAYER'])|list|sort %}
_CHECK_HEATER_PARAMS{% for k in filtered_params%}{' ' ~ k ~ '=' ~ params[k]
}{% endfor %}
GCODE_AT_LAYER{% for k in params|select('in',['HEIGHT','LAYER'])|list %}{
' ' ~ k ~ '=' ~ params[k] }{% endfor
%} COMMAND="SET_HEATER_SCALING{% for k in filtered_params %}{
' ' ~ k ~ '=\\\"' ~ params[k]|replace('\\','\\\\')|replace('\'','\\\'')
|replace('\"','\\\"') ~ '\\\"'
}{% endfor %}"

View File

@@ -1,18 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
#
# Credit to original source:
# https://gist.github.com/ChipCE/95fdbd3c2f3a064397f9610f915f7d02
[gcode_macro bed_mesh_calibrate]
rename_existing: _KM_BED_MESH_CALIBRATE_BASE
variable_km_override: True
description: Wraps BED_MESH_CALIBRATE, scaling probe count to specified area.
Usage: See Klipper documentation.
gcode:
BED_MESH_CALIBRATE_FAST{%for k in params%}{' '~k~'="'~params[k]~'"'}{%endfor%}
[gcode_macro g29]
gcode:
BED_MESH_CALIBRATE

View File

@@ -1,969 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
################################################################################
# Existing menu refinements.
################################################################################
# Hide unused menus
[menu __main __octoprint]
type: list
name: OctoPrint
enable: {printer["gcode_macro _km_globals"].menu_show_octoprint}
# Get the file list out of the SD card menu while printing.
[menu __main __sdcard]
type: list
enable: {'virtual_sdcard' in printer and
printer["gcode_macro _km_globals"].menu_show_sdcard}
name: SD Card
[menu __main __sdcard __start]
type: command
enable: {printer.virtual_sdcard.file_path and
not printer.virtual_sdcard.is_active and
printer.print_stats.state != "printing" and
printer.print_stats.state != "paused"}
name: Print: {printer.virtual_sdcard.file_path.split('/')|last}
gcode:
M24
{menu.back()}
[menu __main __sdcard __select]
type: vsdlist
enable: {not printer.virtual_sdcard.is_active and
printer.print_stats.state != "printing" and
printer.print_stats.state != "paused"}
name: Select file
index: 1
[menu __main __sdcard __select __start]
type: command
enable: {printer.virtual_sdcard.file_path and
not printer.virtual_sdcard.is_active}
name: Print: {printer.virtual_sdcard.file_path.split('/')|last}
gcode:
M24
{menu.back()}
[menu __main __setup __calib __delta_calib_auto]
type: command
enable: {'delta_calibrate' in printer.configfile.settings and
not printer.idle_timeout.state == "Printing"}
name: Delta cal. auto
gcode:
G28
DELTA_CALIBRATE
[menu __main __setup __calib __delta_calib_man]
type: list
enable: {'delta_calibrate' in printer.configfile.settings and
not printer.idle_timeout.state == "Printing"}
name: Delta cal. man
# Require confirmation for anything that would abort an in-progress print.
# Steppers off
[menu __main __control __disable]
type: command
name: Steppers off
enable: {printer.idle_timeout.state != "Printing"}
gcode:
M84
M18
[menu __main __control __disable_printing]
type: list
index: 3
enable: {printer.idle_timeout.state == "Printing"}
name: Steppers off
[menu __my_main __control __disable_printing __confirm]
type: command
name: Confirm steppers off
gcode:
M84
M18
{menu.back()}
# Add a park menu item.
[menu __main __control __park]
type: command
name: Park toolhead
enable: {printer.idle_timeout.state != "Printing" or
printer.pause_resume.is_paused}
index: 1
gcode:
G28 O ; Lazy home first.
PARK
# Octoprint abort
[menu __main __octoprint __abort]
type: list
enable: {printer.idle_timeout.state == "Printing"}
name: Abort printing
[menu __main __octoprint __abort __confirm]
type: command
name: Confirm abort printing
gcode:
{action_respond_info('action:cancel')}
{menu.back()}
# SD card cancel
[menu __main __sdcard __cancel]
type: list
enable: {('virtual_sdcard' in printer) and
(printer.print_stats.state == "printing" or
printer.print_stats.state == "paused")}
name: Cancel printing
[menu __main __sdcard __cancel __confirm]
type: command
name: Confirm cancel printing
gcode:
{% if 'pause_resume' in printer %}
CANCEL_PRINT
{% else %}
M25
M27
M26 S0
TURN_OFF_HEATERS
G91
G0 Z{(printer.toolhead.position.z, printer.toolhead.axis_maximum.z - 5)|min
} F1000
G90
{% endif %}
{menu.back()}
# Extra setup menu options
# Shutdown and reboot
[menu __main __setup __restart]
type: list
name: Restart/Shutdown
[menu __main __setup __restart __reboot]
type: command
name: Reboot host
gcode:
M117 Rebooting host
M118 Rebooting host
{menu.exit()}
G4 S2 ; Let the user see the console message.
{action_call_remote_method("reboot_machine")} ; Try Moonraker.
G4 S1 ; give Moonraker a chance to finish.
{action_respond_info('action:poweroff')} ; Try Octoprint.
[menu __main __setup __restart __shutdown]
type: command
name: Shutdown host
gcode:
M117 Shutting down
M118 Shutting down
{menu.exit()}
G4 S2 ; Let the user see the console message.
{action_call_remote_method("shutdown_machine")} ; Try Moonraker.
G4 S1 ; give Moonraker a chance to finish.
{action_respond_info('action:poweroff')} ; Try Octoprint.
# Speed and flow
[menu __main __setup __speed]
type: input
name: Speed: {'%3d' % (menu.input*100)}%
input: {printer.gcode_move.speed_factor}
input_min: 0.01
input_max: 5
input_step: 0.01
realtime: True
index: 4
gcode:
M220 S{'%d' % (menu.input*100)}
[menu __main __setup __flow]
type: input
name: Flow: {'%3d' % (menu.input*100)}%
input: {printer.gcode_move.extrude_factor}
input_min: 0.01
input_max: 2
input_step: 0.01
realtime: True
index: 5
gcode:
M221 S{'%d' % (menu.input*100)}
################################################################################
# Replace filament loading with our own macros.
################################################################################
[menu __main __filament]
type: list
name: Filament
enable: {printer.idle_timeout.state != "Printing" or
printer.pause_resume.is_paused}
# Hide the old load/unload commands.
[menu __main __filament __loadf]
type: command
name: Load Fil. fast
enable: False
[menu __main __filament __loads]
type: command
name: Load Fil. slow
enable: False
[menu __main __filament __unloadf]
type: command
name: Unload Fil.fast
enable: False
[menu __main __filament __unloads]
type: command
name: Unload Fil.slow
enable: False
# Add new load/unload using our macros.
[menu __main __filament __load]
type: command
index: 1
name: Load Filament
gcode:
LOAD_FILAMENT
[menu __main __filament __unload]
type: command
index: 2
name: Unload Filament
gcode:
UNLOAD_FILAMENT
[menu __main __filament __feed]
type: input
name: Feed: {'%.1f' % menu.input}
input: 0.0
input_min: -50.0
input_max: 50.0
input_step: 1.0
gcode:
SAVE_GCODE_STATE NAME=_KM_FILAMENT_LOAD
M83
G1 E{'%.1f' % menu.input
} F{printer["gcode_macro _km_globals"].load_priming_speed}
RESTORE_GCODE_STATE NAME=_KM_FILAMENT_LOAD
################################################################################
# Layer triggers.
################################################################################
[menu __main __sdcard __pause_layer]
type: input
index: 4
enable: {('virtual_sdcard' in printer) and
printer.print_stats.state == "printing"}
name: Pause {% set layer = printer["gcode_macro _km_layer_run"].cur_layer %}{%
if layer >= menu.input|int %}layer{%
elif layer + 1 == menu.input|int %}at: next{%
else %}at: {menu.input|int}{% endif %}
input: {printer["gcode_macro _km_layer_run"].cur_layer}
input_min: {printer["gcode_macro _km_layer_run"].cur_layer}
input_max: {printer["gcode_macro _km_layer_run"].tot_layers}
input_step: 1
gcode:
{% set layers = printer["gcode_macro _km_layer_run"] %}
{% if menu.input|int > layers.cur_layer %}
PAUSE_AT_LAYER LAYER={menu.input}
{% endif %}
[menu __main __octoprint __pause_layer]
type: input
index: 1
enable: {printer.idle_timeout.state == "Printing"}
name: Pause {% set layer = printer["gcode_macro _km_layer_run"].cur_layer %}{%
if layer >= menu.input|int %}layer{%
elif layer + 1 == menu.input|int + 1 %}at: next{%
else %}at: {menu.input|int}{% endif %}
input: {printer["gcode_macro _km_layer_run"].cur_layer}
input_min: {printer["gcode_macro _km_layer_run"].cur_layer}
input_max: {printer["gcode_macro _km_layer_run"].tot_layers}
input_step: 1
gcode:
{% set layers = printer["gcode_macro _km_layer_run"] %}
{% if menu.input|int > layers.cur_layer %}
GCODE_AT_LAYER LAYER={menu.input|int
} COMMAND="RESPOND TYPE=command MSG=action:pause"
{% endif %}
################################################################################
# Bed surface.
################################################################################
[menu __main __setup __bed_surface]
type: input
name: Bed: {(printer.save_variables.variables.bed_surfaces.available
| list | sort)[menu.input|int]}
input: {% set surfaces = printer.save_variables.variables.bed_surfaces
%}{(surfaces.available | list | sort).index(surfaces.active) | int}
input_min: 0
input_max: {((printer.save_variables.variables.bed_surfaces.available
| length) - 1)}
input_step: 1
index: 4
gcode:
SET_SURFACE_ACTIVE SURFACE={
(printer.save_variables.variables.bed_surfaces.available
| list | sort)[menu.input|int]}
[menu __main __setup __offsetz]
type: input
name: Offset Z:{ '%05.3f' % menu.input }
input: {% set surfaces = printer.save_variables.variables.bed_surfaces
%}{ surfaces.available[surfaces.active].offset | float }
input_min: -5
input_max: 5
input_step: 0.005
index: 5
realtime: True
gcode:
SET_SURFACE_OFFSET OFFSET={menu.input}
[menu __main __tune __offsetz]
type: input
name: Offset Z:{ '%05.3f' % menu.input }
input: { printer.gcode_move.homing_origin.z }
input_min: -5
input_max: 5
input_step: 0.005
realtime: True
gcode:
SET_SURFACE_OFFSET OFFSET={menu.input}
################################################################################
# Heater overrides.
################################################################################
### menu temperature ###
# Hide the original menu
[menu __main __temp]
type: list
name: Temperature
enable: False
[menu __main __temp_km]
type: list
name: Temperature
index: 4
[menu __main __temp_km __hotend0_target]
type: input
enable: {'extruder' in printer}
name: {"Ex0:%3.0f (%4.0f)" % (menu.input, printer.extruder.temperature)}
input: {printer.extruder.target}
input_min: 0
input_max: {printer.configfile.config.extruder.max_temp}
input_step: 1
gcode: SET_HEATER_TEMPERATURE HEATER=extruder TARGET={'%.0f' % menu.input}
[menu __main __temp_km __hotend1_target]
type: input
enable: {'extruder1' in printer}
name: {"Ex1:%3.0f (%4.0f)" % (menu.input, printer.extruder1.temperature)}
input: {printer.extruder1.target}
input_min: 0
input_max: {printer.configfile.config.extruder1.max_temp}
input_step: 1
gcode: SET_HEATER_TEMPERATURE HEATER=extruder1 TARGET={'%.0f' % menu.input}
[menu __main __temp_km __hotbed_target]
type: input
enable: {'heater_bed' in printer}
name: {"Bed:%3.0f (%4.0f)" % (menu.input, printer.heater_bed.temperature)}
input: {printer.heater_bed.target}
input_min: 0
input_max: {printer.configfile.config.heater_bed.max_temp}
input_step: 1
gcode: SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={'%.0f' % menu.input}
# We just create 10 preheat placeholders below, and dynamically enable and fill
# them in from the dictionary in variable_menu_temperature.
## Pre-heat [0] ##
[menu __main __temp_km __preheat_0]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[0].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 0}
[menu __main __temp_km __preheat_0 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[0] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[0] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_0 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[0]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[0].extruder}
[menu __main __temp_km __preheat_0 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[0]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[0].bed}
[menu __main __temp_km __preheat_0 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[0]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[0].chamber}
## Pre-heat [1] ##
[menu __main __temp_km __preheat_1]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[1].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 1}
[menu __main __temp_km __preheat_1 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[1] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[1] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_1 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[1]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[1].extruder}
[menu __main __temp_km __preheat_1 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[1]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[1].bed}
[menu __main __temp_km __preheat_1 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[1]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[1].chamber}
## Pre-heat [2] ##
[menu __main __temp_km __preheat_2]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[2].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 2}
[menu __main __temp_km __preheat_2 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[2] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[2] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_2 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[2]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[2].extruder}
[menu __main __temp_km __preheat_2 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[2]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[2].bed}
[menu __main __temp_km __preheat_2 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[2]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[2].chamber}
## Pre-heat [3] ##
[menu __main __temp_km __preheat_3]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[3].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 3}
[menu __main __temp_km __preheat_3 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[3] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[3] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_3 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[3]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[3].extruder}
[menu __main __temp_km __preheat_3 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[3]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[3].bed}
[menu __main __temp_km __preheat_3 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[3]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[3].chamber}
## Pre-heat [4] ##
[menu __main __temp_km __preheat_4]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[4].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 4}
[menu __main __temp_km __preheat_4 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[4] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[4] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_4 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[4]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[4].extruder}
[menu __main __temp_km __preheat_4 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[4]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[4].bed}
[menu __main __temp_km __preheat_4 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[4]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[4].chamber}
## Pre-heat [5] ##
[menu __main __temp_km __preheat_5]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[5].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 5}
[menu __main __temp_km __preheat_5 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[5] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[5] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_5 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[5]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[5].extruder}
[menu __main __temp_km __preheat_5 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[5]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[5].bed}
[menu __main __temp_km __preheat_5 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[5]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[5].chamber}
## Pre-heat [6] ##
[menu __main __temp_km __preheat_6]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[6].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 6}
[menu __main __temp_km __preheat_6 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[6] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[6] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_6 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[6]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[6].extruder}
[menu __main __temp_km __preheat_6 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[6]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[6].bed}
[menu __main __temp_km __preheat_6 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[6]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[6].chamber}
## Pre-heat [7] ##
[menu __main __temp_km __preheat_7]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[7].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 7}
[menu __main __temp_km __preheat_7 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[7] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[7] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_7 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[7]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[7].extruder}
[menu __main __temp_km __preheat_7 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[7]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[7].bed}
[menu __main __temp_km __preheat_7 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[7]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[7].chamber}
## Pre-heat [8] ##
[menu __main __temp_km __preheat_8]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[8].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 8}
[menu __main __temp_km __preheat_8 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[8] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[8] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_8 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[8]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[8].extruder}
[menu __main __temp_km __preheat_8 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[8]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[8].bed}
[menu __main __temp_km __preheat_8 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[8]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[8].chamber}
## Pre-heat [9] ##
[menu __main __temp_km __preheat_9]
type: list
name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[9].name}
enable: {printer.idle_timeout.state != "Printing" and
printer["gcode_macro _km_globals"].menu_temperature|length > 9}
[menu __main __temp_km __preheat_9 __all]
type: command
enable: {printer["gcode_macro _km_globals"].menu_temperature[9] | list |
select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Preheat all
gcode:
{% set targets = printer["gcode_macro _km_globals"].menu_temperature[9] %}
{% if 'chamber' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber}
{% endif %}
{% if 'bed' in targets and 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed}
{% endif %}
{% if 'extruder' in targets and 'extruder' in printer %}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
targets.extruder}
{% endif %}
[menu __main __temp_km __preheat_9 __hotend]
type: command
enable: {'extruder' in printer and
'extruder' in printer["gcode_macro _km_globals"].menu_temperature[9]}
name: Preheat hotend
gcode:
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={
printer["gcode_macro _km_globals"].menu_temperature[9].extruder}
[menu __main __temp_km __preheat_9 __hotbed]
type: command
enable: {'heater_bed' in printer and
'bed' in printer["gcode_macro _km_globals"].menu_temperature[9]}
name: Preheat bed
gcode:
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={
printer["gcode_macro _km_globals"].menu_temperature[9].bed}
[menu __main __temp_km __preheat_9 __chamber]
type: command
enable: {'heater_generic chamber' in printer.heaters.available_heaters and
'chamber' in printer["gcode_macro _km_globals"].menu_temperature[9]}
name: Preheat chamber
gcode:
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={
printer["gcode_macro _km_globals"].menu_temperature[9].chamber}
## Cooldown ##
[menu __main __temp_km __cooldown_all]
type: command
enable: {printer.idle_timeout.state != "Printing" and
(('extruder' in printer) + ('heater_bed' in printer) +
('heater_generic chamber' in printer.heaters.available_heaters)) > 1}
name: Cooldown all
gcode:
{% if 'heater_generic chamber' in printer.heaters.available_heaters %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET=0
{% endif %}
{% if 'heater_bed' in printer %}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET=0
{% endif %}
{% if 'extruder' in printer%}
SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET=0
{% endif %}
[menu __main __temp_km __cooldown_hotend]
type: command
enable: {printer.idle_timeout.state != "Printing" and 'extruder' in printer}
name: Cooldown hotend
gcode: M104 S0
[menu __main __temp_km __cooldown_hotbed]
type: command
enable: {printer.idle_timeout.state != "Printing" and 'heater_bed' in printer}
name: Cooldown bed
gcode: M140 S0
[menu __main __temp_km __cooldown_chamber]
type: command
enable: {printer.idle_timeout.state != "Printing" and
'heater_generic chamber' in printer.heaters.available_heaters}
name: Cooldown chamber
gcode: M141 S0

View File

@@ -1,90 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro park]
description: Park the toolhead
Usage: PARK [P=<0|1|2>] [X=<pos>] [Y=<pos>] [Z=<pos>] [LAZY=<1|0>]
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% set LAZY = params.LAZY|default(1)|int %}
{% if printer.toolhead.homed_axes != "xyz" %}
{% if LAZY %}
M118 checkpoint PARK G28 01
G28 O
M118 checkpoint PARK G28 1
{% else %}
{action_raise_error("Must home axes first.")}
{% endif %}
{% endif %}
# Z position type from G27 (if below, absolute, relative)
{% set P = (params.P|default(2))|int %} # Default to 2 because it's sanest.
{% set X = params.X|default(km.park_x)|float %}
{% set Y = params.Y|default(km.park_y)|float %}
{% set Z = params.Z|default(km.park_z)|float %}
_CHECK_KINEMATIC_LIMITS X="{X}" Y="{Y}" Z="{Z}"
_PARK_INNER X="{X}" Y="{Y}" Z="{Z}" P="{P}" LAZY="{LAZY}"
# Dummy argument block for Mainsail
{% set dummy = None if True else "
{% set dummy = params.P|default(mode=<0|1|2>)|int %}
{% set dummy = params.X|default(X position)|int %}
{% set dummy = params.Y|default(Y position)|int %}
{% set dummy = params.Z|default(Z position)|int %}
" %} # End argument block for Mainsail
[gcode_macro _park_inner]
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% set travel_speed_xy = km.travel_speed_xy %}
{% set travel_speed_z = km.travel_speed_z %}
{% set position = printer.gcode_move.gcode_position %}
# Use the taller of the highest printed layer or the current Z height, which
# should helps crashes e.g. when a sequential print in progress.
{% set clearance_z = (printer["gcode_macro _km_layer_run"].clearance_z,
position.z) | max %}
{% set P = params.P|int %}
{% set X = params.X|float %}
{% set Y = params.Y|float %}
{% set Z = params.Z|float %}
{% set LAZY = params.LAZY|int %}
# Convert everything to absolute coordinates.
# P == 1 is absolute, so needs no adjustment.
{% if P == 0 %} # Move absolute to Z if below current Z
{% if clearance_z > Z %}
{% set Z = clearance_z %}
{% endif %}
{% elif P == 2 %} # Move Z relative
{% set Z = Z + clearance_z %}
{% elif P != 1 %}
{action_raise_error("Invalid parameter P=%i. Value must be 0, 1, or 2." |
format(P)) }
{% endif %}
# Clamp to the printer limits.
{% set Z = ((Z, printer.toolhead.axis_maximum.z)|min,
printer.toolhead.axis_minimum.z)|max %}
# Don't move if it's a lazy park and we're already in position.
{% if (not LAZY) or P != 2 or X != position.x or Y != position.y
or Z < clearance_z %}
SAVE_GCODE_STATE NAME=_KM_PARK
G90
G0 Z{Z} F{travel_speed_z}
G0 X{X} Y{Y} F{travel_speed_xy}
RESTORE_GCODE_STATE NAME=_KM_PARK MOVE=0
{% endif %}
[gcode_macro g27]
description: Parks the toolhead.
Usage: G27 [P=<0|1|2>]
gcode:
# Wraps any arguments for the PARK macro and defaults P=0 for Marlin compat.
PARK P={params.P|default(0)} {% for k in params|reject("in", "GP") %}{
' '~k~'="'~params[k]~'"'
}{% endfor %}

View File

@@ -1,144 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
# Enables pause/resume functionality
[gcode_macro pause]
description: Pauses the current print.
Usage: PAUSE [X=<pos>] [Y=<pos>] [Z=<pos>] [E=<retract_length>] [B=<beeps>]
rename_existing: _KM_PAUSE_BASE
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
# Retract length (negative)
{% set E = (params.E|default(5))|float %}
# Beeps
{% set B = (params.B|default(10))|float %}
{% if printer.virtual_sdcard.is_active %}
{% set position = printer.gcode_move.gcode_position %}
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_x VALUE="{position.x}"
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_y VALUE="{position.y}"
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_z VALUE="{position.z}"
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_e VALUE="{E}"
SAVE_GCODE_STATE NAME=_KM_PAUSE_OVERRIDE_STATE
_KM_PAUSE_BASE
M83
G1 E{'%.4f' % -E} F{km.load_speed}
PARK P=2{% for k in params|select("in", "XYZ") %}
{' '~k~'="'~params[k]~'"'}
{% endfor %}
# Beep on pause if there's an M300 macro.
{% if "output_pin beeper" in printer %}
{% for i in range(B|int) %}
M300 P100
G4 P200
{% endfor %}
{% endif %}
{% else %}
{ action_respond_info("Print from SD card is not in progress.") }
{% endif %}
[gcode_macro m600]
description: Pauses the current print.
Usage: M600 [B<beeps>] [E<pos>] [L<pos>] [R<temp>] [U<pos>] [X<pos>] [Y<pos>]
[Z<pos>]
gcode:
PAUSE P=2{% for k in params|select("in", "BEXYZ") %}{
' '~k~'="'~params[k]~'"'}{% endfor %}
SET_GCODE_VARIABLE MACRO=_load_unload VARIABLE=is_printing VALUE="{0}"
UNLOAD_FILAMENT{% if 'U' in params %} LENGTH={params.U}{% endif %}
{% if 'R' in params %}M109 S{params.R}{% endif %}
[gcode_macro m601]
description: Pauses the current print.
Usage: M601
gcode:
PAUSE
[gcode_macro m602]
description: Resumes the currently paused print.
Usage: M602
gcode:
RESUME
[gcode_macro m24]
rename_existing: M24.6245197
gcode:
{% if printer.pause_resume.is_paused %}
RESUME
{% else %}
M24.6245197
{% endif %}
[gcode_macro m25]
rename_existing: M25.6245197
gcode:
PAUSE
[gcode_macro resume]
description: Resumes the currently paused print.
Usage: RESUME [E<pos>]
rename_existing: _KM_RESUME_BASE
variable_saved_extruder_temp: 0
variable_saved_x: 0.0
variable_saved_y: 0.0
variable_saved_z: 0.0
variable_saved_e: 0.0
gcode:
{% if printer.pause_resume.is_paused %}
{% set km = printer["gcode_macro _km_globals"] %}
# Warm the extruder back up if needed.
{% set extruder = printer[printer.toolhead.extruder] %}
{% if extruder.target <= printer.configfile.settings[
printer.toolhead.extruder].min_temp
| float + 0.5 %}
M109 S{saved_extruder_temp}
{% endif %}
# If there's no saved_e assume we're completing a filament change and
# retract enough to avoid drooling on the model.
{% if 'E' not in params and not saved_e %}
{% set saved_e = 5.0 %}
G1 E{'%.4f' % -saved_e } F{km.load_speed}
{% endif %}
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_extruder_temp VALUE="{0}"
G90
# Move back to last position before unretracting.
G0 X{saved_x} Y{saved_y} F{km.travel_speed_xy}
G0 Z{saved_z} F{km.travel_speed_z}
G91
# Unretract
G1 E{'%.4f' % (params.E|default(saved_e))} F{km.load_speed}
RESTORE_GCODE_STATE NAME=_KM_PAUSE_OVERRIDE_STATE MOVE=1
_KM_RESUME_BASE
{% else %}
{ action_respond_info("Printer is not paused.") }
{% endif %}
[gcode_macro cancel_print]
description: Cancels the current print.
Usage: CANCEL_PRINT
rename_existing: _KM_CANCEL_PRINT_BASE
gcode:
{% set was_paused = printer.pause_resume.is_paused %}
{% if was_paused or printer.idle_timeout.state|string == "Printing" %}
PRINT_END
SDCARD_RESET_FILE
{% else %}
{ action_respond_info("No print from SD card in progress.") }
{% endif %}
_KM_CANCEL_PRINT_BASE
{% if was_paused %}
RESTORE_GCODE_STATE NAME=_KM_PAUSE_OVERRIDE_STATE MOVE=0
{% endif %}
CLEAR_PAUSE
[gcode_macro clear_pause]
description: Clears the current pause state.
Usage: CLEAR_PAUSE
rename_existing: _KM_CLEAR_PAUSE
gcode:
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_e VALUE="{0.0}"
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_extruder_temp VALUE="{0}"
_KM_CLEAR_PAUSE

View File

@@ -1,178 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro print_start]
description: Inserted by slicer at start of print.
Usage: PRINT_START BED=<temp> EXTRUDER=<temp> [CHAMBER=<temp>]
[MESH_MIN=<x,y>] [MESH_MAX=<x,y>] [LAYERS=<num>]
[NOZZLE_SIZE=<mm>]
gcode:
CHECK_KM_CONFIG # Need this in case startup errors were missed.
CLEAR_PAUSE
{% set BED = params.BED|default(params.BED_TEMP)|float %}
{% set EXTRUDER = params.EXTRUDER|default(params.EXTRUDER_TEMP)|float %}
{% set CHAMBER = params.CHAMBER|default(0)|float
if "chamber" in printer.heaters.available_heaters else 0.0 %}
{% set settings = printer["gcode_macro print_start_set"].settings %}
{% set MESH_MIN = params.MESH_MIN|default(settings.MESH_MIN)|default(None) %}
{% set MESH_MAX = params.MESH_MAX|default(settings.MESH_MAX)|default(None) %}
{% set LAYERS = params.LAYERS|default(settings.LAYERS)|default(0)|int %}
{% set NOZZLE_SIZE = params.NOZZLE_SIZE|default(settings.NOZZLE_SIZE)|
default(printer.configfile.settings.extruder.nozzle_diameter)|float %}
{% set km = printer["gcode_macro _km_globals"] %}
{% set actions_at_temp = km.start_level_bed_at_temp or
km.start_quad_gantry_level_at_temp or
start_z_tilt_adjust_at_temp %}
{% set bed_at_target = (BED - printer.heater_bed.temperature)|abs < 0.3 %}
{% set bed_overshoot = (BED + (km.start_bed_heat_overshoot if
(BED and not bed_at_target) else 0.0),
printer.configfile.settings.heater_bed.max_temp ) | min %}
INIT_LAYER_GCODE LAYERS="{LAYERS}"
{% if CHAMBER > 0.0 %}
M141 S{CHAMBER}
{% endif %}
# Start bed heating
M140 S{bed_overshoot}
{% if actions_at_temp %}
# If we're going to run a bed level we heat the extruder only part way to
# avoid oozing all over the bed while probing.
M104 S{(km.start_extruder_preheat_scale * EXTRUDER)|round(0,'ceil')|int}
{% else %}
M104 S{EXTRUDER}
{% endif %}
# home all axes
G28
G90
# Skip this if the bed was already at target when START_PRINT was called.
{% if BED > 0.0 and not bed_at_target %}
PARK
# Overshoot the target a bit.
M190 S{bed_overshoot}
G4 P{km.start_bed_heat_delay / 2}
M190 R{BED} # Settle down after the overshoot.
G4 P{km.start_bed_heat_delay / 2}
{% endif %}
{% if CHAMBER > 0.0 %}
_KM_PARK_IF_NEEDED HEATER="chamber" RANGE=ABOVE
M191 S{CHAMBER}
{% endif %}
{% if actions_at_temp %}
{% if km.start_extruder_set_target_before_level %}
M104 S{EXTRUDER} # set the final extruder target temperature
{% endif %}
{% if km.start_home_z_at_temp and not bed_at_target %}
G28 Z # Re-home only the Z axis now that the bed has stabilized.
{% endif %}
{% if km.start_z_tilt_adjust_at_temp %}
Z_TILT_ADJUST
{% endif %}
{% if km.start_quad_gantry_level_at_temp %}
QUAD_GANTRY_LEVEL
{% endif %}
{% if km.start_level_bed_at_temp %}
BED_MESH_CALIBRATE_FAST{% if MESH_MIN %} MESH_MIN={MESH_MIN}{% endif
%}{% if MESH_MAX %} MESH_MAX={MESH_MAX}{% endif %}
{% endif %}
{% if not km.start_extruder_set_target_before_level %}
M104 S{EXTRUDER} # set the final extruder target temperature
{% endif %}
G4
{% endif %}
# Wait for extruder to reach temperature
_KM_PARK_IF_NEEDED HEATER={printer.toolhead.extruder} RANGE=ABOVE
M109 S{EXTRUDER}
M118 checkpoint 1
# apply Z offset for bed surface (just in case it was reset).
_APPLY_BED_SURFACE_OFFSET
{% if km.start_gcode_before_print %}{ km.start_gcode_before_print }{% endif %}
{% if km.start_purge_length > 0.0 %}
DRAW_PURGE_LINE WIDTH="{NOZZLE_SIZE * 1.25}" HEIGHT="{NOZZLE_SIZE * 0.625
}"{% if MESH_MIN %} PRINT_MIN={MESH_MIN}{% endif
%}{% if MESH_MAX %} PRINT_MAX={MESH_MAX}{% endif %}
M118 checkpoint 2
{% endif %}
M118 Einde gcode_macro print_start
[gcode_macro _km_park_if_needed]
description: Parks the extruder if the current temperature of the supplied heater is not within the specified target range.
Usage: _KM_PARK_IF_NEEDED HEATER=<heater> RANGE=[<percentage>|ABOVE|BELOW]
gcode:
# This needs to get called as its own macro to get the current temp evaluated.
{% set HEATER = params.HEATER %}
{% set RANGE = (params.RANGE|default(1))|string|upper %}
{% if printer[HEATER].target %}
{% if RANGE == "ABOVE" %}
{% if printer[HEATER].temperature < printer[HEATER].target %}
M118 checkpoint PARK 01
PARK
M118 checkpoint PARK 1
{% endif %}
{% elif RANGE == "BELOW" %}
{% if printer[HEATER].temperature > printer[HEATER].target %}
M118 checkpoint PARK 02
PARK
M118 checkpoint PARK 2
{% endif %}
{% elif (printer[HEATER].temperature - printer[HEATER].target)|abs >
(printer[HEATER].target * RANGE|float * 0.01)|abs %}
M118 checkpoint PARK 03
PARK
M118 checkpoint PARK 3
{% endif %}
{% endif %}
M118 Einde gcode_macro _km_park_if_needed
[gcode_macro print_start_set]
description: Inserted by slicer to set values used by PRINT_START.
Usage: PRINT_START_SET <VARIABLE>=<value>
variable_settings: {}
gcode:
{%for k in params %}
{% set dummy = settings.__setitem__(k|upper, params[k]) %}
{% endfor %}
M118 Einde gcode_macro print_start_set
[gcode_macro print_end]
description: Inserted by slicer at end of print.
Usage: PRINT_END
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% set toolhead = printer.toolhead %}
{% set max_x = km.print_max[0] %}
{% set max_y = km.print_max[1] %}
{% set max_z = toolhead.axis_maximum.z %}
{% set x_safe = (max_x - toolhead.position.x, 2.0)|min %}
{% set y_safe = (max_y - toolhead.position.y, 2.0)|min %}
{% set z_safe = (max_z - toolhead.position.z, 2.0)|min %}
# Wipe if we're not cancelling a paused print.
{% if not printer.pause_resume.is_paused %}
G91
G0 Z{z_safe} E-1.0 F{km.travel_speed_z * 2} ; move nozzle up
G0 X{x_safe} Y{y_safe} E-1.0 F{km.travel_speed_xy} ; remove stringing
{% endif %}
# Small retract to prevent ooze
G92 E0
G1 E-5.0 F3600
M400
{% if km.start_clear_adjustments_at_end != 0 %}
RESET_HEATER_SCALING
RESET_FAN_SCALING
M220 S100
M221 S100
{% endif %}
_RESET_LAYER_GCODE
_RESET_VELOCITY_LIMITS
TURN_OFF_HEATERS
M107; turn off fan
# Park the toolhead and present the bed
PARK Y="{km.start_end_park_y}"
M84 ; disable steppers
CLEAR_PAUSE
M118 Einde gcode_macro print_end

View File

@@ -1,34 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro _km_save_state]
description: Tracks gcode state.
variable_state_set: {}
variable_is_ephemeral: 0
gcode:
{% if params.SAVE|int %}
{% set dummy = state_set.__setitem__(params.NAME, None) %}
{% else %}
{% set dummy = state_set.__delitem__(params.NAME) %}
{% endif %}
SET_GCODE_VARIABLE MACRO=_km_save_state VARIABLE=is_ephemeral VALUE="{
1 if state_set|length > 0 else 0 }"
[gcode_macro save_gcode_state]
description: Wraps SAVE_GCODE_STATE to track persistence state.
Usage: See Klipper documentation
rename_existing: _KM_SAVE_GCODE_STATE
gcode:
_KM_SAVE_GCODE_STATE {rawparams}
{% set NAME = params.NAME|default("default") %}
_km_save_state NAME={NAME} SAVE=1
[gcode_macro restore_gcode_state]
description: Wraps RESTORE_GCODE_STATE to track persistence state.
Usage: See Klipper documentation
rename_existing: _KM_RESTORE_GCODE_STATE
gcode:
_KM_RESTORE_GCODE_STATE {rawparams}
{% set NAME = params.NAME|default("default") %}
_km_save_state NAME={NAME} SAVE=0

View File

@@ -1,86 +0,0 @@
# Copyright (C) 2022 Justin Schuh <code@justinschuh.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro m201]
description: Sets maximum accelleration.
Usage: M201 [X<accel>] [Y<accel>]
variable_max_accel: 1.7976931348623157e+308
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% if 'X' in params or 'Y' in params %}
{% set accel = (params.X|default(params.Y)|float,
params.Y|default(params.X)|float)|min %}
SET_GCODE_VARIABLE MACRO=m201 VARIABLE=max_accel VALUE="{accel}"
{% if accel < printer.toolhead.max_accel %}
SET_VELOCITY_LIMIT ACCEL="{accel
}" ACCEL_TO_DECEL="{accel * km.velocity_decel_scale}"
{% endif %}
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m203]
description: Sets maximum velocity.
Usage: M203 [X<velocity>] [Y<velocity>]
gcode:
{% if 'X' in params or 'Y' in params %}
{% set velocity = (params.X|default(params.Y)|float,
params.Y|default(params.X)|float)|min %}
SET_VELOCITY_LIMIT VELOCITY="{velocity}"
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m204]
description: Sets maximum accelleration.
Usage: M204 [S<accel>] [P<accel> T<accel>]
rename_existing: M204.6245197
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% set max_accel = printer["gcode_macro m201"].max_accel %}
{% set accel = 0.0 %}
{% if 'S' in params %}
{% set accel = (params.S|float, max_accel)|min %}
{% elif 'P' in params %}
{% set accel = (params.P|float, params.T|default(params.P)|float,
max_accel)|min %}
{% endif %}
{% if accel %}
SET_VELOCITY_LIMIT ACCEL="{accel
}" ACCEL_TO_DECEL="{accel * km.velocity_decel_scale}"
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m205]
description: Sets square corner velocity.
Usage: M203 [X<velocity>] [Y<velocity>]
gcode:
{% if 'X' in params or 'Y' in params %}
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY="{
(params.X|default(0)|float, params.Y|default(0)|float)|min}"
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m900]
description: Sets pressure advance.
Usage: M900 [K<advance>] [T<extruder_index>]
gcode:
{% set km = printer["gcode_macro _km_globals"] %}
{% if km.pressure_advance_scale > 0.0 %}
{% set extruder = "extruder" ~ params.T|replace('0', '')
if "T" in params else printer.toolhead.extruder %}
{% if 'K' in params %}
SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{
params.K|float * km.pressure_advance_scale}"
{% endif %}
{% endif %}
[gcode_macro _reset_velocity_limits]
description: Sets maximum accelleration.
Usage: M204 [S<accel>] [P<accel> T<accel>]
gcode:
SET_GCODE_VARIABLE MACRO=m201 VARIABLE=max_accel VALUE="{1.7976931348623157e+308}"

View File

@@ -1,283 +0,0 @@
# This file contains common pin mappings for the BIGTREETECH SKR mini
# E3 v1.2. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR mini E3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR
# mini E3 with that SD card.
# See docs/Config_Reference.md for a description of parameters.
# Note: This board has a design flaw in its thermistor circuits that
# cause inaccurate temperatures (most noticeable at low temperatures).
# Met de DropEffect OmniDrop V2.1 is het punt links-beneden (dus het 0-punt): X = 12 en Y = 30
# En om bij de clips vandaan te blijven wordt er aan Y nog 21 toegevoegd.
# Invoegen van de standaard macros, geknipt uit printer.cfg
#[include macros/standaardMacros.cfg]
# Invoegen van macros. Deze komen uit: https://github.com/jschuh/klipper-macros
[include macros/jschuh_macros.cfg]
[include scherm/menu.cfg]
[include leds/neopixel.cfg]
[exclude_object]
[stepper_x]
step_pin: PB13
dir_pin: !PB12
enable_pin: !PB14
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC0
position_endstop: -13.5
position_min: -13.5
position_max: 221.5
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: PB15
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250
[stepper_y]
step_pin: PB10
dir_pin: !PB2
enable_pin: !PB11
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC1
position_endstop: -51
position_min: -51
position_max: 195
homing_speed: 50
[tmc2209 stepper_y]
uart_pin: PC6
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250
[stepper_z]
step_pin: PB0
dir_pin: PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: ^PC2
position_endstop: 0
position_min: -2
position_max: 250
[tmc2209 stepper_z]
uart_pin: PC10
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 5
[bltouch]
sensor_pin: ^PC14
control_pin: PA1
#pin_up_reports_not_triggered: False
#pin_up_touch_mode_reports_triggered: False
x_offset: 33.7
y_offset: -33.5
#z_offset: 2.68
pin_move_time: 0.680
[bed_screws]
screw1: 29,31
screw2: 196,31
screw3: 196,206
screw4: 29,206
#screw5: 117,117
[bed_mesh]
speed: 80
horizontal_move_z: 5
mesh_min: 25,10
mesh_max: 200,150
probe_count: 5,5
[extruder]
# DropEffect OmniaDrop V2.1
step_pin: PB3
dir_pin: PB4
enable_pin: !PD2
microsteps: 16
gear_ratio: 5:1
rotation_distance: 32.160
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
#control: pid
#pid_Kp: 21.527
#pid_Ki: 1.063
#pid_Kd: 108.982
min_temp: 0
max_temp: 285
[tmc2209 extruder]
uart_pin: PC11
run_current: 0.500
hold_current: 0.400
stealthchop_threshold: 5
[heater_fan my_nozzle_fan]
# Aansturing via PT-DET pinout
pin: PC12
heater: extruder
heater_temp: 50.0
fan_speed: 1.0
[heater_bed]
heater_pin: PC9
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC3
#control: pid
#pid_Kp: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: PA8
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_32FFDA054158323011792557-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[static_digital_output usb_pullup_enable]
pins: !PC13
[board_pins]
aliases:
# EXP1 header
EXP1_1=PB5, EXP1_3=PA9, EXP1_5=PA10, EXP1_7=PB8, EXP1_9=<GND>,
EXP1_2=PB6, EXP1_4=<RST>, EXP1_6=PB9, EXP1_8=PB7, EXP1_10=<5V>
# See the sample-lcd.cfg file for definitions of common LCD displays.
[display]
lcd_type: st7920
cs_pin: EXP1_7
sclk_pin: EXP1_6
sid_pin: EXP1_8
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2
[output_pin beeper]
pin: EXP1_1
[virtual_sdcard]
path: ~/printer_data/gcodes
[display_status]
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # an example
### input-shaper waardes verkregen via adxl345 tuning
[input_shaper]
shaper_freq_x: 69.8
shaper_type_x: mzv
shaper_freq_y: 41.4
shaper_type_y: ei
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 30.552
#*# pid_ki = 2.289
#*# pid_kd = 101.966
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 69.576
#*# pid_ki = 0.488
#*# pid_kd = 2478.635
#*#
#*# [bltouch]
#*# z_offset = 2.675
#*#
#*# [stepper_z]
#*#
#*# [bed_mesh GlasbedCarbonBoven]
#*# version = 1
#*# points =
#*# 0.250000, 0.085000, 0.025000, -0.015000, -0.027500
#*# 0.192500, 0.072500, 0.015000, -0.015000, -0.045000
#*# 0.052500, -0.032500, -0.037500, -0.050000, 0.015000
#*# -0.030000, -0.017500, 0.025000, 0.072500, 0.117500
#*# 0.032500, 0.005000, 0.042500, 0.032500, 0.127500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh GlasbedCarbonBoven ]
#*# version = 1
#*# points =
#*# 0.030000, -0.065000, -0.075000, -0.145000, -0.165000
#*# 0.272500, 0.092500, -0.070000, -0.275000, -0.422500
#*# 0.027500, -0.052500, -0.075000, -0.165000, -0.160000
#*# -0.045000, -0.040000, -0.045000, -0.105000, -0.057500
#*# 0.017500, 0.005000, 0.022500, -0.012500, 0.002500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.327500, -0.370000, -0.362500, -0.365000, -0.490000
#*# -0.285000, -0.327500, -0.385000, -0.417500, -0.482500
#*# -0.442500, -0.385000, -0.335000, -0.302500, -0.357500
#*# -0.460000, -0.382500, -0.365000, -0.307500, -0.282500
#*# -0.405000, -0.302500, -0.257500, -0.222500, -0.240000
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0

View File

@@ -1,288 +0,0 @@
# This file contains common pin mappings for the BIGTREETECH SKR mini
# E3 v1.2. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR mini E3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR
# mini E3 with that SD card.
# See docs/Config_Reference.md for a description of parameters.
# Note: This board has a design flaw in its thermistor circuits that
# cause inaccurate temperatures (most noticeable at low temperatures).
# Met de DropEffect OmniDrop V2.1 is het punt links-beneden (dus het 0-punt): X = 12 en Y = 30
# En om bij de clips vandaan te blijven wordt er aan Y nog 21 toegevoegd.
# Voor het verplaatsen van de X en/of Y is het nodig om Z 2.0 mm omhoog te zetten. Hierdoor komt de kop boven de clipjes en kunnen de clipjes op hun plaats blijven zitten.
# Dit wordt geregeld in PRINT_START in start_end.cfg en in HOMING in kinematics.cfg.
# Invoegen van de standaard macros, geknipt uit printer.cfg
#[include macros/standaardMacros.cfg]
# Invoegen van macros. Deze komen uit: https://github.com/jschuh/klipper-macros
[include macros/jschuh_macros.cfg]
[include scherm/menu.cfg]
[include leds/neopixel.cfg]
[exclude_object]
[stepper_x]
step_pin: PB13
dir_pin: !PB12
enable_pin: !PB14
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC0
position_endstop: -14
position_min: -14
position_max: 195
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: PB15
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250
[stepper_y]
step_pin: PB10
dir_pin: !PB2
enable_pin: !PB11
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC1
position_endstop: -51
position_min: -51
position_max: 160
homing_speed: 50
[tmc2209 stepper_y]
uart_pin: PC6
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250
[stepper_z]
step_pin: PB0
dir_pin: PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: ^PC2
position_endstop: 0
position_min: -2
position_max: 250
[tmc2209 stepper_z]
uart_pin: PC10
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 5
[bltouch]
sensor_pin: ^PC14
control_pin: PA1
#pin_up_reports_not_triggered: False
#pin_up_touch_mode_reports_triggered: False
x_offset: 33.7
y_offset: -33.5
#z_offset: 2.68
pin_move_time: 0.680
[bed_screws]
screw1: 29,31
screw2: 196,31
screw3: 196,206
screw4: 29,206
#screw5: 117,117
[bed_mesh]
speed: 80
horizontal_move_z: 5
mesh_min: 25,10
mesh_max: 228.7,126.5
probe_count: 5,5
[extruder]
# DropEffect OmniaDrop V2.1
step_pin: PB3
dir_pin: PB4
enable_pin: !PD2
microsteps: 16
gear_ratio: 5:1
rotation_distance: 32.160
max_extrude_cross_section: 3.0
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
#control: pid
#pid_Kp: 21.527
#pid_Ki: 1.063
#pid_Kd: 108.982
min_temp: 0
max_temp: 285
[tmc2209 extruder]
uart_pin: PC11
run_current: 0.500
hold_current: 0.400
stealthchop_threshold: 5
[heater_fan my_nozzle_fan]
# Aansturing via PT-DET pinout
pin: PC12
heater: extruder
heater_temp: 50.0
fan_speed: 1.0
[heater_bed]
heater_pin: PC9
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC3
#control: pid
#pid_Kp: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: PA8
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_32FFDA054158323011792557-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[static_digital_output usb_pullup_enable]
pins: !PC13
[board_pins]
aliases:
# EXP1 header
EXP1_1=PB5, EXP1_3=PA9, EXP1_5=PA10, EXP1_7=PB8, EXP1_9=<GND>,
EXP1_2=PB6, EXP1_4=<RST>, EXP1_6=PB9, EXP1_8=PB7, EXP1_10=<5V>
# See the sample-lcd.cfg file for definitions of common LCD displays.
[display]
lcd_type: st7920
cs_pin: EXP1_7
sclk_pin: EXP1_6
sid_pin: EXP1_8
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2
[output_pin beeper]
pin: EXP1_1
[virtual_sdcard]
path: ~/printer_data/gcodes
on_error_gcode: CANCEL_PRINT
[display_status]
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # an example
### input-shaper waardes verkregen via adxl345 tuning
[input_shaper]
shaper_freq_x: 69.8
shaper_type_x: mzv
shaper_freq_y: 41.4
shaper_type_y: ei
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 30.552
#*# pid_ki = 2.289
#*# pid_kd = 101.966
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 61.642
#*# pid_ki = 0.561
#*# pid_kd = 1694.375
#*#
#*# [bltouch]
#*# z_offset = 2.675
#*#
#*# [stepper_z]
#*#
#*# [bed_mesh GlasbedCarbonBoven]
#*# version = 1
#*# points =
#*# 0.250000, 0.085000, 0.025000, -0.015000, -0.027500
#*# 0.192500, 0.072500, 0.015000, -0.015000, -0.045000
#*# 0.052500, -0.032500, -0.037500, -0.050000, 0.015000
#*# -0.030000, -0.017500, 0.025000, 0.072500, 0.117500
#*# 0.032500, 0.005000, 0.042500, 0.032500, 0.127500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh GlasbedCarbonBoven ]
#*# version = 1
#*# points =
#*# 0.030000, -0.065000, -0.075000, -0.145000, -0.165000
#*# 0.272500, 0.092500, -0.070000, -0.275000, -0.422500
#*# 0.027500, -0.052500, -0.075000, -0.165000, -0.160000
#*# -0.045000, -0.040000, -0.045000, -0.105000, -0.057500
#*# 0.017500, 0.005000, 0.022500, -0.012500, 0.002500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.327500, -0.370000, -0.362500, -0.365000, -0.490000
#*# -0.285000, -0.327500, -0.385000, -0.417500, -0.482500
#*# -0.442500, -0.385000, -0.335000, -0.302500, -0.357500
#*# -0.460000, -0.382500, -0.365000, -0.307500, -0.282500
#*# -0.405000, -0.302500, -0.257500, -0.222500, -0.240000
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0

View File

@@ -1,288 +0,0 @@
# This file contains common pin mappings for the BIGTREETECH SKR mini
# E3 v1.2. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR mini E3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR
# mini E3 with that SD card.
# See docs/Config_Reference.md for a description of parameters.
# Note: This board has a design flaw in its thermistor circuits that
# cause inaccurate temperatures (most noticeable at low temperatures).
# Met de DropEffect OmniDrop V2.1 is het punt links-beneden (dus het 0-punt): X = 12 en Y = 30
# En om bij de clips vandaan te blijven wordt er aan Y nog 21 toegevoegd.
# Voor het verplaatsen van de X en/of Y is het nodig om Z 2.0 mm omhoog te zetten. Hierdoor komt de kop boven de clipjes en kunnen de clipjes op hun plaats blijven zitten.
# Dit wordt geregeld in PRINT_START in start_end.cfg en in HOMING in kinematics.cfg.
# Invoegen van de standaard macros, geknipt uit printer.cfg
#[include macros/standaardMacros.cfg]
# Invoegen van macros. Deze komen uit: https://github.com/jschuh/klipper-macros
[include macros/jschuh_macros.cfg]
[include scherm/menu.cfg]
[include leds/neopixel.cfg]
[exclude_object]
[stepper_x]
step_pin: PB13
dir_pin: !PB12
enable_pin: !PB14
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC0
position_endstop: -14
position_min: -14
position_max: 195
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: PB15
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250
[stepper_y]
step_pin: PB10
dir_pin: !PB2
enable_pin: !PB11
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC1
position_endstop: -51
position_min: -51
position_max: 160
homing_speed: 50
[tmc2209 stepper_y]
uart_pin: PC6
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250
[stepper_z]
step_pin: PB0
dir_pin: PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: ^PC2
position_endstop: 0
position_min: -2
position_max: 250
[tmc2209 stepper_z]
uart_pin: PC10
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 5
[bltouch]
sensor_pin: ^PC14
control_pin: PA1
#pin_up_reports_not_triggered: False
#pin_up_touch_mode_reports_triggered: False
x_offset: 33.7
y_offset: -33.5
#z_offset: 2.68
pin_move_time: 0.680
[bed_screws]
screw1: 29,31
screw2: 196,31
screw3: 196,206
screw4: 29,206
#screw5: 117,117
[bed_mesh]
speed: 80
horizontal_move_z: 5
mesh_min: 25,10
mesh_max: 228.7,126.5
probe_count: 5,5
[extruder]
# DropEffect OmniaDrop V2.1
step_pin: PB3
dir_pin: PB4
enable_pin: !PD2
microsteps: 16
gear_ratio: 5:1
rotation_distance: 32.160
max_extrude_cross_section: 3.0
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
#control: pid
#pid_Kp: 21.527
#pid_Ki: 1.063
#pid_Kd: 108.982
min_temp: 0
max_temp: 285
[tmc2209 extruder]
uart_pin: PC11
run_current: 0.500
hold_current: 0.400
stealthchop_threshold: 5
[heater_fan my_nozzle_fan]
# Aansturing via PT-DET pinout
pin: PC12
heater: extruder
heater_temp: 50.0
fan_speed: 1.0
[heater_bed]
heater_pin: PC9
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC3
#control: pid
#pid_Kp: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: PA8
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_32FFDA054158323011792557-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[static_digital_output usb_pullup_enable]
pins: !PC13
[board_pins]
aliases:
# EXP1 header
EXP1_1=PB5, EXP1_3=PA9, EXP1_5=PA10, EXP1_7=PB8, EXP1_9=<GND>,
EXP1_2=PB6, EXP1_4=<RST>, EXP1_6=PB9, EXP1_8=PB7, EXP1_10=<5V>
# See the sample-lcd.cfg file for definitions of common LCD displays.
[display]
lcd_type: st7920
cs_pin: EXP1_7
sclk_pin: EXP1_6
sid_pin: EXP1_8
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2
[output_pin beeper]
pin: EXP1_1
[virtual_sdcard]
path: ~/printer_data/gcodes
on_error_gcode: CANCEL_PRINT
[display_status]
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # an example
### input-shaper waardes verkregen via adxl345 tuning
[input_shaper]
shaper_freq_x: 69.8
shaper_type_x: mzv
shaper_freq_y: 41.4
shaper_type_y: ei
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 31.285
#*# pid_ki = 2.343
#*# pid_kd = 104.414
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 61.642
#*# pid_ki = 0.561
#*# pid_kd = 1694.375
#*#
#*# [bltouch]
#*# z_offset = 2.675
#*#
#*# [stepper_z]
#*#
#*# [bed_mesh GlasbedCarbonBoven]
#*# version = 1
#*# points =
#*# 0.250000, 0.085000, 0.025000, -0.015000, -0.027500
#*# 0.192500, 0.072500, 0.015000, -0.015000, -0.045000
#*# 0.052500, -0.032500, -0.037500, -0.050000, 0.015000
#*# -0.030000, -0.017500, 0.025000, 0.072500, 0.117500
#*# 0.032500, 0.005000, 0.042500, 0.032500, 0.127500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh GlasbedCarbonBoven ]
#*# version = 1
#*# points =
#*# 0.030000, -0.065000, -0.075000, -0.145000, -0.165000
#*# 0.272500, 0.092500, -0.070000, -0.275000, -0.422500
#*# 0.027500, -0.052500, -0.075000, -0.165000, -0.160000
#*# -0.045000, -0.040000, -0.045000, -0.105000, -0.057500
#*# 0.017500, 0.005000, 0.022500, -0.012500, 0.002500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.327500, -0.370000, -0.362500, -0.365000, -0.490000
#*# -0.285000, -0.327500, -0.385000, -0.417500, -0.482500
#*# -0.442500, -0.385000, -0.335000, -0.302500, -0.357500
#*# -0.460000, -0.382500, -0.365000, -0.307500, -0.282500
#*# -0.405000, -0.302500, -0.257500, -0.222500, -0.240000
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0

View File

@@ -1,288 +0,0 @@
# This file contains common pin mappings for the BIGTREETECH SKR mini
# E3 v1.2. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR mini E3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR
# mini E3 with that SD card.
# See docs/Config_Reference.md for a description of parameters.
# Note: This board has a design flaw in its thermistor circuits that
# cause inaccurate temperatures (most noticeable at low temperatures).
# Met de DropEffect OmniDrop V2.1 is het punt links-beneden (dus het 0-punt): X = 12 en Y = 30
# En om bij de clips vandaan te blijven wordt er aan Y nog 21 toegevoegd.
# Voor het verplaatsen van de X en/of Y is het nodig om Z 2.0 mm omhoog te zetten. Hierdoor komt de kop boven de clipjes en kunnen de clipjes op hun plaats blijven zitten.
# Dit wordt geregeld in PRINT_START in start_end.cfg en in HOMING in kinematics.cfg.
# Invoegen van de standaard macros, geknipt uit printer.cfg
#[include macros/standaardMacros.cfg]
# Invoegen van macros. Deze komen uit: https://github.com/jschuh/klipper-macros
[include macros/jschuh_macros.cfg]
[include scherm/menu.cfg]
[include leds/neopixel.cfg]
[exclude_object]
[stepper_x]
step_pin: PB13
dir_pin: !PB12
enable_pin: !PB14
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC0
position_endstop: -14
position_min: -14
position_max: 195
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: PB15
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250
[stepper_y]
step_pin: PB10
dir_pin: !PB2
enable_pin: !PB11
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC1
position_endstop: -51
position_min: -51
position_max: 160
homing_speed: 50
[tmc2209 stepper_y]
uart_pin: PC6
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 250
[stepper_z]
step_pin: PB0
dir_pin: PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: ^PC2
position_endstop: 0
position_min: -2
position_max: 250
[tmc2209 stepper_z]
uart_pin: PC10
run_current: 0.580
hold_current: 0.500
stealthchop_threshold: 5
[bltouch]
sensor_pin: ^PC14
control_pin: PA1
#pin_up_reports_not_triggered: False
#pin_up_touch_mode_reports_triggered: False
x_offset: 32.3
y_offset: -33.5
#z_offset: 2.68
pin_move_time: 0.680
[bed_screws]
screw1: 29,31
screw2: 196,31
screw3: 196,206
screw4: 29,206
#screw5: 117,117
[bed_mesh]
speed: 80
horizontal_move_z: 5
mesh_min: 25,10
mesh_max: 228.7,126.5
probe_count: 5,5
[extruder]
# DropEffect OmniaDrop V2.1
step_pin: PB3
dir_pin: PB4
enable_pin: !PD2
microsteps: 16
gear_ratio: 5:1
rotation_distance: 32.160
max_extrude_cross_section: 3.0
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA0
#control: pid
#pid_Kp: 21.527
#pid_Ki: 1.063
#pid_Kd: 108.982
min_temp: 0
max_temp: 285
[tmc2209 extruder]
uart_pin: PC11
run_current: 0.500
hold_current: 0.400
stealthchop_threshold: 5
[heater_fan my_nozzle_fan]
# Aansturing via PT-DET pinout
pin: PC12
heater: extruder
heater_temp: 50.0
fan_speed: 1.0
[heater_bed]
heater_pin: PC9
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC3
#control: pid
#pid_Kp: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: PA8
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_32FFDA054158323011792557-if00
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[static_digital_output usb_pullup_enable]
pins: !PC13
[board_pins]
aliases:
# EXP1 header
EXP1_1=PB5, EXP1_3=PA9, EXP1_5=PA10, EXP1_7=PB8, EXP1_9=<GND>,
EXP1_2=PB6, EXP1_4=<RST>, EXP1_6=PB9, EXP1_8=PB7, EXP1_10=<5V>
# See the sample-lcd.cfg file for definitions of common LCD displays.
[display]
lcd_type: st7920
cs_pin: EXP1_7
sclk_pin: EXP1_6
sid_pin: EXP1_8
encoder_pins: ^EXP1_5, ^EXP1_3
click_pin: ^!EXP1_2
[output_pin beeper]
pin: EXP1_1
[virtual_sdcard]
path: ~/printer_data/gcodes
on_error_gcode: CANCEL_PRINT
[display_status]
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # an example
### input-shaper waardes verkregen via adxl345 tuning
[input_shaper]
shaper_freq_x: 69.8
shaper_type_x: mzv
shaper_freq_y: 41.4
shaper_type_y: ei
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 31.285
#*# pid_ki = 2.343
#*# pid_kd = 104.414
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 63.394
#*# pid_ki = 0.394
#*# pid_kd = 2550.799
#*#
#*# [bltouch]
#*# z_offset = 2.675
#*#
#*# [stepper_z]
#*#
#*# [bed_mesh GlasbedCarbonBoven]
#*# version = 1
#*# points =
#*# 0.250000, 0.085000, 0.025000, -0.015000, -0.027500
#*# 0.192500, 0.072500, 0.015000, -0.015000, -0.045000
#*# 0.052500, -0.032500, -0.037500, -0.050000, 0.015000
#*# -0.030000, -0.017500, 0.025000, 0.072500, 0.117500
#*# 0.032500, 0.005000, 0.042500, 0.032500, 0.127500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh GlasbedCarbonBoven ]
#*# version = 1
#*# points =
#*# 0.030000, -0.065000, -0.075000, -0.145000, -0.165000
#*# 0.272500, 0.092500, -0.070000, -0.275000, -0.422500
#*# 0.027500, -0.052500, -0.075000, -0.165000, -0.160000
#*# -0.045000, -0.040000, -0.045000, -0.105000, -0.057500
#*# 0.017500, 0.005000, 0.022500, -0.012500, 0.002500
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.327500, -0.370000, -0.362500, -0.365000, -0.490000
#*# -0.285000, -0.327500, -0.385000, -0.417500, -0.482500
#*# -0.442500, -0.385000, -0.335000, -0.302500, -0.357500
#*# -0.460000, -0.382500, -0.365000, -0.307500, -0.282500
#*# -0.405000, -0.302500, -0.257500, -0.222500, -0.240000
#*# tension = 0.2
#*# min_x = 25.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 5
#*# max_y = 170.0
#*# mesh_x_pps = 2
#*# max_x = 200.0