Skip to content

Latest commit

 

History

History
125 lines (93 loc) · 2.61 KB

File metadata and controls

125 lines (93 loc) · 2.61 KB

Quick Start Guide

Get the G-code preprocessor running in 5 minutes!

Installation (2 minutes)

cd ~
git clone https://github.com/jwellman80/klipper-gcode-preprocessor.git
cd klipper-gcode-preprocessor
./install.sh

Follow the prompts:

  1. Answer "1" for Moonraker integration (recommended)
  2. Answer "1" to restart Klipper

Configuration (1 minute)

Add to your printer.cfg:

[include gcode-preprocessor/preprocessor.cfg]

Save and restart Klipper:

sudo systemctl restart klipper

Test It (2 minutes)

Option 1: Upload a Test File

  1. Upload the included test file to Mainsail/Fluidd:
    • File: ~/klipper-gcode-preprocessor/examples/test_sample.gcode
  2. Check the first line - it should now say:
    ; processed by klipper-gcode-preprocessor
  3. Look for inserted cooldown commands:
    ; T1 no longer needed - cooling down
    M104 T1 S0

Option 2: Manual Processing

PREPROCESS_GCODE_FILE FILE=/path/to/your/file.gcode

Option 3: List Processors

LIST_GCODE_PROCESSORS

You should see:

  • token_replacer
  • unused_tool_shutdown

What It Does

Automatically cools down tools after their last use

  • T1 used, then T2 → M104 T1 S0 inserted
  • Saves energy and reduces oozing

Extracts metadata from slicer comments

  • Tool count, colors, materials, temperatures

Replaces placeholders in your macros

  • !tool_count! → actual number
  • !colors! → hex color codes

Customize (optional)

Edit ~/printer_data/config/gcode-preprocessor/preprocessor.cfg:

# Customize unused tool shutdown
[preprocessor unused_tool_shutdown]
exclude_tools: 0  # Optional: exclude T0 from shutdown

Next Steps

  • Read full docs: docs/README.md
  • Try placeholders in your macros
  • Write custom processors

Troubleshooting

Files not being preprocessed?

  • Check: tail -f ~/printer_data/logs/klippy.log
  • Verify config is included in printer.cfg

Already preprocessed warning?

  • Files are only processed once
  • Re-upload to process again

Need help?

  • Full documentation: README.md
  • Detailed guide: docs/README.md
  • GitHub Issues for bugs

Example: Using Placeholders

Add to your START_PRINT macro:

[gcode_macro START_PRINT]
gcode:
    M118 Starting print with !tool_count! tools
    M118 Colors: !colors!
    M118 Materials: !materials!

After preprocessing, this becomes:

M118 Starting print with 3 tools
M118 Colors: ff0000,00ff00,0000ff
M118 Materials: PLA,PETG,ABS

That's it! Your G-code preprocessor is now running and automatically optimizing your prints.