Skip to content

driver/motor_driver: fix failing motor initialization#21626

Merged
maribu merged 1 commit intoRIOT-OS:masterfrom
LeonardHerbst:motor_driver_fix
Jul 28, 2025
Merged

driver/motor_driver: fix failing motor initialization#21626
maribu merged 1 commit intoRIOT-OS:masterfrom
LeonardHerbst:motor_driver_fix

Conversation

@LeonardHerbst
Copy link
Copy Markdown
Contributor

@LeonardHerbst LeonardHerbst commented Jul 28, 2025

Contribution description

The motor_driver_init function mistakenly expected that pwm_init sets the pwm device to the exact frequency requested. In reality it sets the frequency to the next highest possible frequency with the given resolution.

The fix updates the code to properly check for the error return value 0.

`pwm_init` returns the actual frequency the pwm is set to, not the exact frequency requested.
@github-actions github-actions bot added the Area: drivers Area: Device drivers label Jul 28, 2025
@benpicco benpicco requested a review from maribu July 28, 2025 08:52
@benpicco benpicco added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Jul 28, 2025
@crasbe crasbe added Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 28, 2025
@riot-ci
Copy link
Copy Markdown

riot-ci commented Jul 28, 2025

Murdock results

✔️ PASSED

8a57349 driver/motor_driver: fix failing motor initialization

Success Failures Total Runtime
10547 0 10547 11m:08s

Artifacts

@maribu maribu enabled auto-merge July 28, 2025 09:30
@maribu maribu added this pull request to the merge queue Jul 28, 2025
@maribu
Copy link
Copy Markdown
Member

maribu commented Jul 28, 2025

Thx a lot for the fix!

If I'm not mistaken, this is your first PR to RIOT. So welcome to the RIOT contributors 🎉

Merged via the queue into RIOT-OS:master with commit 914f301 Jul 28, 2025
29 checks passed
@LeonardHerbst LeonardHerbst deleted the motor_driver_fix branch September 18, 2025 13:04
@benpicco benpicco added this to the Release 2025.10 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants