MapleLeafMakers / klipper-virtual_leds

Virtual LED chains composed of segments of physical led chains... for klipper.
GNU General Public License v3.0
13 stars 2 forks source link

Error after configuring virtual_leds #1

Closed staticanime closed 7 months ago

staticanime commented 10 months ago

Hi all

Getting this error when restarting klipper after attempting to add a virtual_leds definition to my LED config file (unused by any macros yet)

Internal error during connect: object of type 'NoneType' has no len()

Here's the config I have, with the virtual_leds currently commented out to keep klipper functional

[neopixel left_matchstick]
pin: PA9
chain_count: 10
color_order: GRBW
initial_RED: 0.0
initial_GREEN: 0.0
initial_BLUE: 0.0

[neopixel right_matchstick]
pin: PB15
chain_count: 10
color_order: GRBW
initial_RED: 0.0
initial_GREEN: 0.0
initial_BLUE: 0.0

[neopixel db_leds]
pin: ebb36:PD3
chain_count: 10
color_order: GRB,GRB,GRB,GRB,GRB,GRB,GRB,GRB,GRBW,GRBW
initial_RED: 0.0
initial_GREEN: 0.0
initial_BLUE: 0.0
initial_WHITE: 0.0

# [virtual_leds chamber_leds]
# leds:
#     neopixel:left_matchstick (1-10)
#     neopixel:right_matchstick (1-10)

# [virtual_leds db_logo_leds]
# leds:
#     neopixel:db_leds (1-8)

# [virtual_leds db_nozzle_leds]
# leds:
#     neopixel:db_leds (9-10)

Full config file is auto-backed up to my github, so you can view it here, as well as the rest of my configuration, in case that is of any help

MapleLeafMakers commented 10 months ago

There should be a more complete error message in the klipper log, if you can find that it would be helpful, I'm not sure why it would throw any errors when it's all commented out, that's unusual.

staticanime commented 10 months ago

Sorry, should have included that in the first place!! Here's the relevant snippet from the klippy.log, full log also attached.

Unhandled exception during connect
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 175, in _connect
    self._read_config()
  File "/home/pi/klipper/klippy/klippy.py", line 141, in _read_config
    self.load_object(config, section_config.get_name(), None)
  File "/home/pi/klipper/klippy/klippy.py", line 130, in load_object
    self.objects[section] = init_func(config.getsection(section))
  File "/home/pi/klipper/klippy/extras/virtual_leds.py", line 103, in load_config_prefix
    return PrinterVirtualLeds(config)
  File "/home/pi/klipper/klippy/extras/virtual_leds.py", line 42, in __init__
    self.led_helper = pled.setup_helper(config, self.update_leds, sum(len(leds) for chainName, leds in self.configChains))
  File "/home/pi/klipper/klippy/extras/virtual_leds.py", line 42, in <genexpr>
    self.led_helper = pled.setup_helper(config, self.update_leds, sum(len(leds) for chainName, leds in self.configChains))
TypeError: object of type 'NoneType' has no len()

klippy.log

staticanime commented 7 months ago

I've come back to give this another test, and I've concluded that this is the offender:

[virtual_leds chamber_leds] leds: neopixel:left_matchstick (1-10) neopixel:right_matchstick (1-10)

My assumption is that while led_effect allows you to stack multiple LED definitions, virtual_leds does not?

MapleLeafMakers commented 7 months ago

Thanks for the report, this is supposed to work, the code is mostly borrowed from led_effect. I'll look into it

MapleLeafMakers commented 7 months ago

this should be fixed now