# Multiple aliases referencing the same pin

**URL:** <https://klipper.discourse.group/t/multiple-aliases-referencing-the-same-pin/2695>\
**Category:** Developers\
**Created:** [April 25, 2022, 12:37pm UTC](https://klipper.discourse.group/t/multiple-aliases-referencing-the-same-pin/2695 "2022-04-25T12:37:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nphesse](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@nphesse](https://klipper.discourse.group/u/nphesse)\
**Post date:** [April 25, 2022, 12:37pm UTC](https://klipper.discourse.group/t/multiple-aliases-referencing-the-same-pin/2695/1 "2022-04-25T12:37:03Z")

</div>

Hi,

during creating a configuration for the BTT SKR Mini E3 v3.0 board for the [RatOS](https://github.com/Rat-OS/RatOS) distribution I stumbled upon an error

```auto
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!

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [April 25, 2022, 5:12pm UTC](https://klipper.discourse.group/t/multiple-aliases-referencing-the-same-pin/2695/2 "2022-04-25T17:12:18Z")

</div>

See [Intentional or an aliasing related bug? - #6 by jslaker](https://klipper.discourse.group/t/intentional-or-an-aliasing-related-bug/1735/6)

---

<div class="post-metadata">

**Author:** ![nphesse](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@nphesse](https://klipper.discourse.group/u/nphesse)\
**Post date:** [April 26, 2022, 6:12am UTC](https://klipper.discourse.group/t/multiple-aliases-referencing-the-same-pin/2695/3 "2022-04-26T06:12:02Z")

</div>

I see, thank you for your time!

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [April 26, 2022, 7:55am UTC](https://klipper.discourse.group/t/multiple-aliases-referencing-the-same-pin/2695/4 "2022-04-26T07:55:14Z")

</div>

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.
