Skip to content

[BUG] CURRENT_STEP_DOWN wrapping around to 65536 on multiple driver errors #27102

Open
@sargonphin

Description

@sargonphin

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

Upon encountering an error, the feature CURRENT_STEP_DOWN reduces current a certain amount in the hope to fix the error condition

If the motor current _CURRENT is not a multiple of CURRENT_STEP_DOWN, the condition that triggers a stop if current goes below 50 mA will never trigger due to the int16 current value wrapping around to 65,536 and less.

For instance, X_CURRENT == 1900 and CURRENT_STEP_DOWN == 200
Then decreasing on multiple errors would go 1700, 1500, 1300, [...], 300, 100, 65,000 (wrap around), and the condition will never be true (on top of failing the print, putting the driver in a dangerous power state and overloading the stepper motor)

image

Bug Timeline

New bug

Expected behavior

When the driver current reaches critical levels, stop the printer without wrapping the int16

Actual behavior

The stepper driver current wraps around to over 65,000 mA

Steps to Reproduce

For this you require a faulty condition that is not easy to reproduce.

Version of Marlin Firmware

Bugfix Feb. 2024

Printer model

--

Electronics

--

LCD/Controller

--

Other add-ons

--

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

Running Marlin Bugfix from February 2024

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions