Skip to content

Avoid microsecond drift in step timing #41

Description

@spingoogL

The > condition here can allow extra uSeconds of time to creep in to the stepping:

this->last_step_time = now;

Since the condition to advance a step is >=, the result will be fewer steps than expected, in a given time frame.

This can be fixed by changing Stepper.cpp:201 to:

this->last_step_time += this->step_delay;

Argument for the existing code: that if the processor gets bogged down, the motors will step slower, and guarantee step counts. But, everything slows down.

Argument for updating the code: start to finish timing stays correct, but as the processor bogs down, it can lose steps at higher speeds.

Thank you for your attention to this detail.
Gerald Lafreniere

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions