Useful printer.cfg Snippets¶
A collection of handy printer.cfg snippets that work well with Mainsail. Each section can be copied directly into
your configuration.
Additional sensors¶
You can integrate additional sensors supported by Klipper into the temperature graph in Mainsail.
Raspberry Pi temperature sensor¶
Append the following section to your printer.cfg:
MCU temperature sensor (ATSAM, ATAMD, and STM32)¶
Append the following section to your printer.cfg:
Override built‑in commands¶
Klipper exposes many built‑in commands (e.g., BED_MESH_CALIBRATE) that you can override via gcode_macro. Mainsail
calls those commands from the UI, so if you customize them, Mainsail will use your logic.
Best‑practice pattern:
- Rename the original command to a safe backup name with
rename_existing. - Implement your macro under the original command name.
- Call the renamed original inside your macro at the appropriate point (forwarding parameters as needed).
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: BASE_BED_MESH_CALIBRATE
gcode:
# Pre-steps
BED_MESH_CLEAR
QUAD_GANTRY_LEVEL
G1 X125 Y125 Z5 F6000
# Original routine, forward any params
BASE_BED_MESH_CALIBRATE {rawparams}
# Post-steps
# e.g., move head to safe position
Note
The macro name must exactly match the built‑in command you want to override. Only a subset of commands are macro‑overridable.
Disable OctoPrint LCD menu¶
Klipper ships with an OctoPrint entry in the LCD menu which does not work with Mainsail. Add the following entry to
your printer.cfg to disable it: