Multiple aliases referencing the same pin

Hi,

during creating a configuration for the BTT SKR Mini E3 v3.0 board for the RatOS distribution I stumbled upon an error

pin y_uart_pin is an alias for x_uart_pin

The RatOS configuration is very structured for supporting many different boards/printers/etc. Due to this, they’re using a pin alias <axis>_uart_pin for setting the UART pin for each stepper driver, if it supports it.

Then there is a different configuration file tmc2209.cfg which is valid for all printer/board configurations that are using TMC2209 drivers, where this is used to set the uart_pin setting of the corresponding tmc2209 sections.

Now, for the BTT SKR Mini E3 v3.0 this pin is the same pin for all drivers since they’re identified by using the uart_address configuration.

In klippy/pins.py#L45 is a check that ensures that multiple commands that use different aliases to “activate” the same pin cannot be used and results in the above error.

Now, this check leads to this very modular configuration not being possible in this case, only way seems to be to include a override config at the very end to set the uart_pin of the drivers manually to the correct pin.

I’d like to contribute something that allows me to stay in the modular approach of RatOS and use different aliases for the same pin at different places.
There already is a duplicate_pin_override and I was wondering if adding such a override for aliases, something like duplicate_pin_alias_override , would be a practicable way of doing it.

The way I would image it without knowing too much about the Klipper code base would be to add an additional array member to the class PinResolver that contains a list of pins for which multiple aliases may be used and then adding a check for this new member to the update_command method to see if multiple aliases for a given pin should result in errors or not - so like the already existent validate_aliases member but per pin.

Could I get some feedback on if something like this would be able to be merged or not?

Thanks a lot!

See Intentional or an aliasing related bug? - #6 by jslaker

I see, thank you for your time!

If you allow one comment:
We already had some support requests from users running RatOS. Although the cfgs and everything is very well laid out, I found it to be:

  • Nearly impossible to grasp what is going on for novice user
  • Not transparent in the sense of the includes and behavior when a user modifies something, which might be overwritten later or vice versa
  • Hard to support outside of the project because non RatOS will most likely not spend the time digging into this

Given that the basic setup of Klipper is a one time effort but tweaking, tuning and extending comes with the time, I’m not sure that this system is user friendly at the end.

Just my 2 cents.