u/Traq_r

▲ 7 r/SovolSV08+1 crossposts

After discovering that Orca emits filament and extruder details in indexed lists for multicolour prints, I had the idea that I wanted to use a neopixel (or in my case the stock screen backlight on my SV08) to show me which colour each Filament Change wanted, as well as showing the vendor and ID on screen.

Here's my new Change Filament section from the Machine G-code tab;

M117 {filament_vendor[next_extruder]} {filament_settings_id[next_extruder]}
; Hex colour codes include a leading hash
; DO NOT omit quote container or the code will be commented out
NEO_HEX_RGB COLOUR="{filament_colour[next_extruder]}"
M118 T{next_extruder} - {filament_colour[next_extruder]}

M600

Figuring out that the leading hash in #44D24F (for example) was causing Klipper to treat the colour code as a trailing comment took some time & reading (duh!). Adding quotes solved the parameter pass.

The M118 started life as a troubleshooting line, but I found I liked having a timestamped filament change in the console history so I've kept it.

In addition to the macros below, I made two changes to my existing macros;

  1. The PAUSE macro announces itself with an M117 that almost instantly overwrites the text I called in my Filament Change gcode, so I wrapped it in an IF;

    {% if state != 'filament_change' %} M117 Pause Print!!! {% endif %}

  2. I added a reset to the stock screen colour at the end of the RESUME macro - easiest way to find your stock settings is to use Mainsail to change it, then hit the restore arrow. The stock colour command appears on the console.

    SET_LED LED="Screen_Colour" RED=0.5 GREEN=0.4 BLUE=0.7 SYNC=0 TRANSMIT=1

Here are the two macros I made:

Nozzle LED (mine is a GRBW Neopixel, but Klipper corrects the sequence in the neopixel configuration so I still call it RGBW)

[gcode_macro NEO_HEX_RGBW]
description: Set RGBW NeoPixel based on RGB Hex code (not balanced for colour temp, gamma, etc.)
gcode:
  {% set led = params.LED|default("nozzle_led") %}
  {% set rgb = {"r":params.COLOUR[1:3]|default("ff")| int(base=16),
                "g":params.COLOUR[3:5]|default("ff")| int(base=16),
                "b":params.COLOUR[5:7]|default("ff")| int(base=16)} %}
                       
  {% set white = [rgb.r, rgb.g, rgb.b]|min %}

  SET_LED LED={led} RED={(rgb.r - white)/255} GREEN={(rgb.g - white)/255} BLUE={(rgb.b - white)/255} WHITE={white/255} SYNC=0 TRANSMIT=1

Screen backlight

[gcode_macro NEO_HEX_RGB]
description: Set RGB NeoPixel based on RGB Hex code (not balanced for colour temp, gamma, etc.)
gcode:
  {% set led = params.LED|default("Screen_Colour") %}
  {% set rgb = {"r":params.COLOUR[1:3]|default("ff")| int(base=16),
                "g":params.COLOUR[3:5]|default("ff")| int(base=16),
                "b":params.COLOUR[5:7]|default("ff")| int(base=16)} %}
                       
  SET_LED LED={led} RED={rgb.r/255} GREEN={rgb.g/255} BLUE={rgb.b/255} SYNC=0 TRANSMIT=1
reddit.com
u/Traq_r — 14 days ago