Klipper3d / klipper

Klipper is a 3d-printer firmware
GNU General Public License v3.0
8.99k stars 5.17k forks source link

Add grouping for LEDs and correct not necessary stuff #6445

Closed Elenedeath closed 5 months ago

Elenedeath commented 6 months ago

I reused the code made by julianschill one year ago on this pull request https://github.com/Klipper3d/klipper/pull/5788 and correct something KevinOConnor say about raise self.printer.config_error() maybe now the pull request by accepted.

for the short description made by julianschill

This adds the functionality to create groups of LEDs to either separate a chain or combine multiple chains to one big LED chain.

Configuration made by me and use on my BLV MGN Cube:

[neopixel _status_panel]
pin: PD3
chain_count: 48
color_order: GRB
initial_RED: 0.0
initial_GREEN: 0.0
initial_BLUE: 0.0

[led_group status_panel1]
leds:
  _status_panel (1-16)

[led_group status_panel2]
leds:
  _status_panel (17-32)

[led_group status_panel3]
leds:
  _status_panel (33-48)

#####################################################################
#                          LEDS Effects
#####################################################################
[led_effect critical_error]
leds:
    led_group:status_panel1
    led_group:status_panel2
    led_group:status_panel3
    led_group:SHT36_logo
    led_group:SHT36_nozzle
layers:
    strobe         1  1.5   add        (1.0,  1.0, 1.0)
    breathing      2  0     difference (0.95, 0.0, 0.0)
    static         1  0     top        (1.0,  0.0, 0.0)
autostart:                             false
frame_rate:                            24
run_on_error:                          true

I use this script https://github.com/Elenedeath/klipper-neopixel to have a working panel with 3 different information on it. this is a little video to show it in action https://www.youtube.com/watch?v=7i_VIg28kKw

this is my start gcode:

  M117 Heating bed...
  _NEOPIXEL_DISPLAY LED=status_panel3 TYPE=bed_temp MODE=progress NUMBERS=16
  M190 S{params.BED_TEMP|default(printer.heater_bed.target, true)  }; wait for bed to heat up
  M117 Heating extruder...
  _NEOPIXEL_DISPLAY LED=status_panel2 TYPE=extruder_temp MODE=progress NUMBERS=16
  M109 S{params.EXTRUDER_TEMP|default(printer.extruder.target, true) }; wait for extruder to heat up
  M117 Printing...
  _NEOPIXEL_DISPLAY LED=status_panel1 TYPE=print_percent MODE=progress NUMBERS=16

and i can chain another neopixel without the need to specific another gpio for it, only need a new group.

on this example, i have status_panel1 for print_percent, status_panel2 for extruder_temp and status_panel3 for bed_temp

JamesH1978 commented 5 months ago

Thank you for submitting a PR, pleas refer to point 3 in "What to expect in a review" in https://github.com/Klipper3d/klipper/blob/master/docs/CONTRIBUTING.md and provide a signed off by line.

Thanks James