Frix-x / klippain

Generic Klipper configuration for 3D printers
GNU General Public License v3.0
849 stars 221 forks source link

Pin naming conventions when multiple, independent ports are present #278

Closed ndanyluk closed 1 year ago

ndanyluk commented 1 year ago

Hi! So it's been a while since I was last working on #208, but one item that I never got around to resolving was the presence of duplicate features with independent pins on a mainboard.

Specifically, the LDO picobilical includes 2 separate, independently controllable neopixel ports. The intent, so far as I know, is to control a left-hand neopixel strip and a right-hand one.

Currently Klippain only supports STATUS_NEOPIXEL, LIGHT_NEOPIXEL, and LIGHT_OUTPUT. It would be nice to change this to be something like LIGHT_NEOPIXEL[0,1,2,etc] across Klippain so users have a more standardized way of accessing these features.

Thoughts? The biggest issue I see is that if we make LIGHT_NEOPIXEL0/1 replace LIGHT_NEOPIXEL/unused, then it would be a breaking change for users of LIGHT_NEOPIXEL.

Frix-x commented 1 year ago

Currently Klippain only supports STATUS_NEOPIXEL, LIGHT_NEOPIXEL, and LIGHT_OUTPUT. It would be nice to change this to be something like LIGHT_NEOPIXEL[0,1,2,etc] across Klippain so users have a more standardized way of accessing these features.

I understand the concept, but I'm still uncertain about how to handle it efficiently. Here are my thoughts:

Currently, Klippain controls only one set of lights that are connected to a single neopixel pin. I question the practicality of having two separate control pins: when you chain the strips, you can still manage all the LEDs individually in the same manner. Therefore, aside from simplifying the wiring, there's no real advantage in using both ports; it just complicates matters. Would it be feasible to use just one port? So this means defining both ports in the manufacturer board's pins and then, in the user MCU template, opting for one over the other. This approach would allow users to utilize the remaining port for custom functions in their macros or other applications.

Regarding the filament runout sensor pins that was discussed in #208 , I believe Klipper currently supports only one runout sensor definition, so using both pins at the same time isn't curently an option. However, the solution could mirror the one suggested for the neopixel pins: define both pins in the manufacturer's file and then choose between them in the user MCU template. The unused pin could serve another purpose for the user or be used by a future Klippain feature.

ndanyluk commented 1 year ago

Hi Frix,

I understand and I actually hadn't considered only implementing it in the board config and not the user template, that's a great idea and would resolve the problem cleanest I think.

Unfortunately in this case, it's feasible but very undesirable to only use one neopixel port on the picobolical. The design of the board and placement of the connectors is designed around these style LED strips with JSTs: https://west3d.com/products/rainbow-on-a-matchstick

It can be done, but I'd likely opt for the mcu file changes and just implement it in overrides in that case rather than change the led wiring.

Frix-x commented 1 year ago

Yes the overrides are always possible to overcome this kind of problems at the end and is indeed a first step :)