Skip to content

Commit

Permalink
reworked override.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
Frix-x committed Apr 23, 2023
1 parent 275adcb commit 182c667
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions docs/overrides.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# Overrides details

In Klipper, when two (but identical) `[section]` are defined, the last one in the include order will replace the previous one. In addition, any missing values will be filled in by the last entry. This mechanism is called an "override".
In Klipper, when two identical `[section]` are defined, it's the last one in the include order that will take over. Additionally, any missing values are filled in by the last entry. This mechanism is called an "override".

It allow me to set default values for each configuration section that you can include from the `printer.cfg` file. Then, if you want to change those values, you can add some overrides without having to change all the files in this repo. This has the advantage of keeping my repo read-only and compatible with Moonraker's update manager.

Using this mechanism, you will be able to tweak the machine dimensions, limits, currents, and everything else in all these configuration sections. You can also use the overrides to invert motor directions, or even add/replace a macro, etc... This is a very powerful feature!
To keeps Klippain files read-only and compatible with Moonraker's update manager, you will need to use this mechansim extensively. Indeed, there is default values included in every Klippain files, but if you want to change them, you can add some overrides without having to dig and modify all the files in Klippain folders.

Use overrides to tweak machine dimensions, invert motor directions, change axis limits, currents, sensors type, or anything you feel the need to change. You can even override a full macro to replace it completely by your own or add new features to Klippain on your side. This is a very powerful feature!

> **Note**
> Klipper does not allow `[board_pins]` sections to contain pin modifiers such as `!`, `^` and `~`. Moreover, when configuring multiple MCUs at the same time, all the aliases used in the hardware sections must be prefixed with the MCU name. This is a current limitation of Klipper and is why you will also need to use the overrides.cfg file to add them.
>
> Klipper does not allow `[board_pins]` sections to contain pin modifiers such as `!`, `^`, and `~`. Furthermore, when configuring multiple MCUs simultaneously, all aliases used in hardware sections must be prefixed with the MCU name. This is a current limitation of Klipper and the reason why you'll also need to use the `overrides.cfg` file to add them.

## Common overrides

Since my defaults are designed to be as generic as possible, you will not need to add as many overrides. However, there are still some common things you should take a look at. For example, **pay special attention to the axis limits** in the `[stepper_...]` sections, run current, etc... Also check the thermistor types in `[extruder]` and `[heated_bed]`, ... If you are using a multi-MCU configuration, you will also need to override any section where there are pins connected to the secondary board to explicitly add it. Finally, you will need to use overrides if you want to change direction of motors or adding a pull-up/down (using `!`, `^` and `~`).
Since my defaults aim to be as generic as possible, you won't need many overrides. However, there are still some common elements to check.

For example, **pay special attention to axis limits** in the `[stepper_...]` sections, run current, etc. Verify thermistor types in `[extruder]` and `[heated_bed]` sections. If using a multi-MCU configuration, you'll need to override any section where pins are connected to the secondary or toolhead boards to specify it. Finally, use overrides if you want to change motor direction or add a pull-up/down (using `!`, `^`, and `~`).

In addition, if you want to add a new macro or even replace an existing one to adapt it to your use case, you can always do it the same way!
Additionally, if you want to add a new macro to Klippain or even replace an existing one to adapt it to your use case, you can do it the same way!


## How to write an override

>**Warning**
> put any changes in your own `overrides.cfg` user file and **never modify my config directly** as your changes will be deleted when the repo is updated!
The following examples should help you add all the overrides you need to customize Klippain and make it work correctly with your printer!

Let's say you want to change the motor current for the X axis. You'll need to override the `[tmc2209 stepper_x]` section because that's where this current is defined.
To do this, simply add this to your `overrides.cfg` file:
Let's say you want to change the motor current for the X-axis. You'll need to override the `[tmc2209 stepper_x]` section because that's where the current is defined. To do this, simply add the following to your `overrides.cfg` file:
```
[tmc2209 stepper_x]
run_current: ...
Expand All @@ -34,3 +37,16 @@ Similarly, if you want to invert the Z2 motor direction, override the `[stepper_
[stepper_z2]
dir_pin: !mcu:Z2_DIR
```

Changing a thermistor type (like for the bed), can be done this way:
```
[heated_bed]
sensor_type: ...
```

You can even redefine a full macro! For example if the default Klippain prime line is not adapted to your needs, just override the macro like that:
```
[gcode_macro _MODULE_PRIMELINE]
gcode:
# Put your custom prime line G-code here...
```

0 comments on commit 182c667

Please sign in to comment.