Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Servo.attach() call to Servo::write() before min/max are configured leads to issue when writting angles in degrees #2308

Closed
Labels
bug 🐛Something isn't working
Milestone
@jan019

Description

@jan019

Describe the bug
The Servo library calls thewrite()function within theattach() function

before configuring this->min andthis->max values
this->min = (MIN_PULSE_WIDTH - min) /4;//resolution of min/max is 4 uS
this->max = (MAX_PULSE_WIDTH - max) /4;
, which however need to be configured forwrite() function to work correctly when the servo position is set in degrees. The functionwrite()uses thethis->min andthis->max values to map the passed value in degrees between min and maxhttps://github.com/stm32duino/Arduino_Core_STM32/blob/641f3d8883e9a7220f65dded355dc32e218a990d/libraries/Servo/src/stm32/Servo.cpp#L156/

To Reproduce

int min = 40;int max = 70;int value = 40;// on first call to attach, the write is called with a different value in this->min and this->max than on following callsServo.attach(pin, min, max, value)
  • STM32 core version: 2.7.1

Thewrite() function should either not be called in theattach() function at all, or it must be called afterthis->min andthis->max are configured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp