# Some general settings....?

**URL:** https://klipper.discourse.group/t/some-general-settings/6552
**Category:** General Discussion
**Created:** [February 10, 2023, 11:33am UTC](https://klipper.discourse.group/t/some-general-settings/6552 "2023-02-10T11:33:24Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 10, 2023, 11:33am UTC](https://klipper.discourse.group/t/some-general-settings/6552/1 "2023-02-10T11:33:24Z")

</div>

### Basic Information:

Printer Model: Tronxy 500  
 MCU / Printerboard: Spider V2.2  
 `klippy.log`

Hello!  
I have some confusion about setting up the printer.

X/Y/Z=0 the nozzle is on mechanical X/Y/Z = 0  
I use the

[stepper\_x]  
**position\_endstop: -36**  
position\_min: -36

[stepper\_y]  
**position\_endstop: -20**  
position\_min: -20

[bltouch]  
x\_offset: -23  
y\_offset: -70  
**z\_offset: 3**

are these the correct variables?

for referencing the Z, I use the BL Touch in the middle (250x250)  
[safe\_z\_home] #BL Touch  
home\_xy\_position: 227, 180 # Change coordinates to the center of your print bed

good to go?  
[printer.cfg](https://klipper.discourse.group/uploads/short-url/lsrU8smGj2gMMzbKPiqYFod7BNL.cfg) (9.2 KB)

---

<div class="post-metadata">

### Author: ![LifeOfBrian](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/lifeofbrian/32/2380_2.png) [@LifeOfBrian](https://klipper.discourse.group/u/LifeOfBrian)
#### Post date: [February 10, 2023, 12:53pm UTC](https://klipper.discourse.group/t/some-general-settings/6552/2 "2023-02-10T12:53:40Z")

</div>

If I’m right those positions are the distances of the nozzle tip between the bed edges and when hitting the respective endstops.  
So just measure it.  
Sometimes it is needed to have the position\_min lower/farther away than the position\_endstop is so that the print head is able to fully drive into the endstop having it triggered at all.

---

<div class="post-metadata">

### Author: ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)
#### Post date: [February 10, 2023, 3:23pm UTC](https://klipper.discourse.group/t/some-general-settings/6552/3 "2023-02-10T15:23:53Z")

</div>

For the Tronxy S5 series there are some official cfgs availability which should also contain the correct endstop positions. See [klipper/config at master · Klipper3d/klipper · GitHub](https://github.com/Klipper3d/klipper/tree/master/config)

My workflow for determining the X / Y BLTouch offsets:

- Stick two small pieces of insulating tape on top of each other
- Put it somewhere on your bed
- Drive the nozzle **gently and slowly** into the tape until you leave a mark in the tape. It doesn’t take much. If the nozzle is sticking out on the other side of the bed, it was too far
- Issue a `GET_POSITION` and record / write down the current nozzle position
- Extend the tip of your BLTouch
- Move the head until the tip of BLT is exactly over the mark in the tape
- Issue a `GET_POSITION` and record / write down the current nozzle position
- Calculate the offset as difference of the two positions

For tuning the Z-Offset refer to [Probe calibration - Klipper documentation](https://www.klipper3d.org/Probe_Calibrate.html#calibrating-probe-z-offset)

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 11, 2023, 7:11am UTC](https://klipper.discourse.group/t/some-general-settings/6552/4 "2023-02-11T07:11:51Z")

</div>

@LifeOfBrian  
I do not think, that this is the correct way.  
Endstops are active after referencing and should protect the printer.  
I would recommend a reference point independent to endstop. value of reference would be outside ! of the endstop values.

@Sineos  
Thanks for you description, I have done this offset first, are the variables I use the correct ones?

---

<div class="post-metadata">

### Author: ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)
#### Post date: [February 11, 2023, 8:47am UTC](https://klipper.discourse.group/t/some-general-settings/6552/5 "2023-02-11T08:47:28Z")

</div>

> [@4711Austria](#):
>
> Endstops are active after referencing and should protect the printer.

Nope.  
An endstop usually is only at one end. What protects the other end?  
Also: if they should do so, either they have to initiate an interrupt on the MCU. Interrupt able ports are rare. Or the ports have to be polled. Too much MCU load for nothing.

And for verification: I tried during a print, nothing happens.

The endstops are only for homing.

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 11, 2023, 9:31am UTC](https://klipper.discourse.group/t/some-general-settings/6552/6 "2023-02-11T09:31:27Z")

</div>

Hi,

when I stop the printing, he always wants to move somewhere near max X/Y, how can I stop that?  
[klippy (2).log](https://klipper.discourse.group/uploads/short-url/nXHYFhqMmHuXmWSWzsyzyV0bcH2.log) (2.2 MB)

---

<div class="post-metadata">

### Author: ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)
#### Post date: [February 11, 2023, 9:45am UTC](https://klipper.discourse.group/t/some-general-settings/6552/7 "2023-02-11T09:45:44Z")

</div>

You may have a look on your slicers end code.

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 11, 2023, 9:56am UTC](https://klipper.discourse.group/t/some-general-settings/6552/8 "2023-02-11T09:56:48Z")

</div>

there I do not finde the code (Cura newest)

```auto
M104 S0 ;extruder heater off

M140 S0 ;heated bed heater off (if you have it)

G91 ;relative positioning

G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure

G1 Z+10 F50

;G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more

;G28 Z0

;G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way

M84 ;steppers off

G90 ;absolute positioning

```

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 11, 2023, 9:57am UTC](https://klipper.discourse.group/t/some-general-settings/6552/9 "2023-02-11T09:57:24Z")

</div>

I mean when I stop printing on mainsail

---

<div class="post-metadata">

### Author: ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)
#### Post date: [February 11, 2023, 9:58am UTC](https://klipper.discourse.group/t/some-general-settings/6552/10 "2023-02-11T09:58:01Z")

</div>

Is there a script that is executed after a print?

And please:

If you upload code snippets, please use

![Format](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/6/643ab9def96b03089cfb0c194628129fcc96b3f8.png)

to format the code as code.

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 11, 2023, 10:00am UTC](https://klipper.discourse.group/t/some-general-settings/6552/11 "2023-02-11T10:00:24Z")

</div>

script after print? where can I look at?

---

<div class="post-metadata">

### Author: ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)
#### Post date: [February 11, 2023, 10:14am UTC](https://klipper.discourse.group/t/some-general-settings/6552/12 "2023-02-11T10:14:52Z")

</div>

Sorry, I don’t know. I don’t use Mainsail.

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 11, 2023, 10:22am UTC](https://klipper.discourse.group/t/some-general-settings/6552/13 "2023-02-11T10:22:14Z")

</div>

OK, thanks.  
If I stop printing via Mainsail, the printerhead goes somewhere maximum ends.  
If the print is finished, it does what Cura settings are.

---

<div class="post-metadata">

### Author: ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)
#### Post date: [February 11, 2023, 10:31am UTC](https://klipper.discourse.group/t/some-general-settings/6552/14 "2023-02-11T10:31:27Z")

</div>

> [@4711Austria](#):
>
> ```auto
> ;G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more
> 
> ;G28 Z0
> 
> ;G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
> 
> ```

In that snippet, these moves are commented out.  
Also the `G1` command line is made during relative positioning.

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 11, 2023, 10:35am UTC](https://klipper.discourse.group/t/some-general-settings/6552/15 "2023-02-11T10:35:28Z")

</div>

correct, but that is fine, no problem at all  
the mainsail - klipper does a movement on stopping the print

---

<div class="post-metadata">

### Author: ![LifeOfBrian](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/lifeofbrian/32/2380_2.png) [@LifeOfBrian](https://klipper.discourse.group/u/LifeOfBrian)
#### Post date: [February 11, 2023, 3:41pm UTC](https://klipper.discourse.group/t/some-general-settings/6552/16 "2023-02-11T15:41:46Z")

</div>

You have an **PRINT\_END** macro or one for cancelling a print that needs to be adapted to your needs.  
I changed it as well to avoid those movements after stopping a print.

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 11, 2023, 3:53pm UTC](https://klipper.discourse.group/t/some-general-settings/6552/17 "2023-02-11T15:53:30Z")

</div>

thx! could you please tell me how

I have done some macros to switch on/off led, does it work the same?

---

<div class="post-metadata">

### Author: ![LifeOfBrian](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/lifeofbrian/32/2380_2.png) [@LifeOfBrian](https://klipper.discourse.group/u/LifeOfBrian)
#### Post date: [February 11, 2023, 6:21pm UTC](https://klipper.discourse.group/t/some-general-settings/6552/18 "2023-02-11T18:21:11Z")

</div>

Just open the **macros.cfg** and look for **[gcode\_macro PRINT\_END]**

Mine looks like this:

```auto
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script
gcode:
    # Get Boundaries
    {% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
    
    # Check end position to determine safe directions to move
    {% if printer.toolhead.position.z < (max_z - 2) %}
        {% set z_safe = 2.0 %}
    {% else %}
        {% set z_safe = max_z - printer.toolhead.position.z %}
    {% endif %}
    
    M400 ; wait for buffer to clear
    G92 E0 ; zero the extruder
    G1 E-2.0 F3600 ; retract
    G91 ; relative positioning
    G0 Z{z_safe} F3600 ; move nozzle up
    G90
    G0 X5 Y-3 F12000 ; move nozzle to remove stringing
    
    M104 S0 ; turn off hotend
    M140 S0 ; turn off bed
    M107 ; turn off fan
    M84 ; turn off motors

    #M300 P300 S1000 ;play tone
    #M300 P300 S5000
    #M300 P300 S1000
    Bauraumlicht VALUE=0

    M117 Finished!

```

The line with

```auto
G90
G0 X5 Y-3 F12000 ; move nozzle to remove stringing

```

moves the print head to the front left corner with absolute coordinates instead of the default back right one.  
The respective parameters need to be adapted to your printers ones so carefully check its boundaries first!

Further check **mainsail.cfg** as well as it should contain at least the **[gcode\_macro CANCEL\_PRINT]** macro that is being run when you cancel a print.  
This by default sends the print head to a place where I did not wanted it…

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 12, 2023, 6:05am UTC](https://klipper.discourse.group/t/some-general-settings/6552/19 "2023-02-12T06:05:12Z")

</div>

Thanks a lot !!  
where do I find the macro.cfg, need I to create one?  
or is it the kiauh\_macros.cfg?

 ![Unbenannt](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/a/a8507a91ef94b5ecef6cecd22a13cf66a5d82666.png)  
[printer.cfg](https://klipper.discourse.group/uploads/short-url/b62CqMuJ8S0ZCfHgbnpm9FohQ6S.cfg) (9.2 KB)  
[mainsail.cfg](https://klipper.discourse.group/uploads/short-url/c829Q0i6nqkBNGGRD8Yc6CVgeYe.cfg) (2.1 KB)  
[kiauh\_macros.cfg](https://klipper.discourse.group/uploads/short-url/bQj6eHASJXZ1ltZSYycY935VYL1.cfg) (1.9 KB)

---

<div class="post-metadata">

### Author: ![4711Austria](https://avatars.discourse-cdn.com/v4/letter/4/c6cbf5/32.png) [@4711Austria](https://klipper.discourse.group/u/4711Austria)
#### Post date: [February 13, 2023, 2:33pm UTC](https://klipper.discourse.group/t/some-general-settings/6552/20 "2023-02-13T14:33:48Z")

</div>

where do I finde macro.cfg ?

[Next page](https://klipper.discourse.group/t/some-general-settings/6552.md?page=2)
