klipper icon indicating copy to clipboard operation
klipper copied to clipboard

virtual_pins: initial implementation of virtual pins

Open pedrolamas opened this issue 2 years ago • 3 comments

This is a follow up on https://klipper.discourse.group/t/new-virtual-pins-module-for-testing-purposes/4727/6

As the AVR atmega644p only has 30 usable pins, that can be quite low when one wants to test features while developing for Fluidd or Mainsail.

This is where virtual-pins comes in!

On the “printer.cfg”, add a [virtual_pins] section, and from that point on, try setting a few pins to virtual_pin:<pin-name>.

That will add a new SET_VIRTUAL_PIN gcode command that allow to set a virtual pin value (pass PIN=<pin-name> and VALUE=<value>)

The global or individual pins state can be retrieved from the status of printer.virtual_pins.

Note: I understand that this might not be of usefulness in Klipper mainline (this is mostly a debug helper feature!), but in the end, its impact is only seen when the section is added, so I am sending a PR so that this can be properly evaluated.

Signed-off-by: Pedro Lamas [email protected]

pedrolamas avatar Nov 07 '22 01:11 pedrolamas

Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html

There are some steps that you can take now:

  1. Perform a self-review of your Pull Request by following the steps at: https://www.klipper3d.org/CONTRIBUTING.html#what-to-expect-in-a-review If you have completed a self-review, be sure to state the results of that self-review explicitly in the Pull Request comments. A reviewer is more likely to participate if the bulk of a review has already been completed.
  2. Consider opening a topic on the Klipper Discourse server to discuss this work. The Discourse server is a good place to discuss development ideas and to engage users interested in testing. Reviewers are more likely to prioritize Pull Requests with an active community of users.
  3. Consider helping out reviewers by reviewing other Klipper Pull Requests. Taking the time to perform a careful and detailed review of others work is appreciated. Regular contributors are more likely to prioritize the contributions of other regular contributors.

Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available.

Best regards, ~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

github-actions[bot] avatar Nov 25 '22 00:11 github-actions[bot]

Interesting. FWIW, I'm not sure it needs to be in the mainline Klipper branch though.

Cheers, -Kevin

KevinOConnor avatar Dec 01 '22 01:12 KevinOConnor

Would be handy for all developers

eliteSchwein avatar Dec 01 '22 07:12 eliteSchwein

Could be handy to generate toggle switches inside the UI (Fluidd/Mainsail) und use them than as an enable feature insight other macros. Currently I recommend people using a Linux mcu and assigning unused gpio pins to get that functionality.

so there would be also a use case for main klipper but I am not sure if I would find 100 users for that.

zellneralex avatar Dec 05 '22 07:12 zellneralex

I have my doubts that one would find 100 users for this feature... having said that, I have bundled this module directly on my Klipper Simulavr Docker image so I can easily test things while I work on Fluidd development, and that sure helps a lot as I don't need to go fiddle with what pins I still have free to use! 😉

Another advantage is that when someone shares a configuration with me, I can just copy-paste the part I am interested in checking, prefix any of the pins with virtual-pin:, restart Klipper, and test!

pedrolamas avatar Dec 08 '22 15:12 pedrolamas

Unfortunately a reviewer has not assigned themselves to this GitHub Pull Request and it is therefore being closed. It is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available.

Best regards, ~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

github-actions[bot] avatar Dec 23 '22 00:12 github-actions[bot]