Skip to content

fix: PID invalid integration of negative target_delta#2213

Merged
Ralim merged 1 commit into
Ralim:devfrom
ok2cm:ralim_dev
May 24, 2026
Merged

fix: PID invalid integration of negative target_delta#2213
Ralim merged 1 commit into
Ralim:devfrom
ok2cm:ralim_dev

Conversation

@ok2cm
Copy link
Copy Markdown
Contributor

@ok2cm ok2cm commented May 23, 2026

(cherry picked from commit 6b4164c)

  • Please check if the PR fulfills these requirements
  • The changes have been tested locally
  • There are no breaking changes
  • What kind of change does this PR introduce?
    Bug fix

  • What is the current behavior?
    interval_ms is TickType_t which is UNSIGNED. Multiplication (target_delta * interval_ms * Ki) gives wrong results when target_delta is negative.

  • What is the new behavior (if this is a feature change)?
    Mathematically correct result.

  • Other information:
    Example: https://www.programiz.com/online-compiler/4s9BkH6P4IPr2
    Explanation: https://stackoverflow.com/a/50632

@Ralim Ralim enabled auto-merge (squash) May 23, 2026 23:31
@Ralim Ralim merged commit 85f6db1 into Ralim:dev May 24, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants