TMCStepper icon indicating copy to clipboard operation
TMCStepper copied to clipboard

Add TMCSTEPPER_SW_SERIAL to force usage of SW/HW serial

Open skruppy opened this issue 2 years ago • 2 comments

This PR adds a method to force the usage of HW/SW serial, while still maintaining backwards compatibility. This new method can be used together with small changes to Marlin to automatically select the best method.

Related issues:

  • #48 (with the small Marlin patch, your comment gets a solution)
  • #228 (same problem, further down the release pipeline)
  • MarlinFirmware/Marlin#16299 (this was a bug never the less, but it got more visible with my changes, so I had to fix it too)

Aspects of the PR:

  • Don't break code / be backwards compatible
  • Changes not tailored specifically for Marlin (don't "detect" the presence of Marlin and behave appropriately)
  • Prevent future name clashes: prefix / scope the new macro with the lib name TMCSTEPPER_
  • Allow forcing "HW serial only" mode as well as "SW serial" mode (with a single macro)

If you are planing to release a 0.7.4 with this PR, then I will file the corresponding Marlin PR. If you don't plan to release any further v0 releases, in favor of v1, please add a similar mechanism :smiley:

skruppy avatar Jan 11 '22 22:01 skruppy

I can merge this in with 0.7.4 in mind but for the v1.0 branch I'd like to have something that doesn't rely so much on the preprocessor and works across IDEs and frameworks.

teemuatlut avatar Jan 18 '22 18:01 teemuatlut

@skruppy thank you for this effort, I've been happily using this after failing to find a solution myself.

I've added a suggestion to the commit with the changes needed on Marlins side which accounts for a sanity check between software serial, and endstop interrupts.

phizev avatar Aug 22 '22 18:08 phizev