MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.32k stars 19.25k forks source link

[FR] option to change servo timings #27408

Open Ilderi opened 2 months ago

Ilderi commented 2 months ago

Is your feature request related to a problem? Please describe.

Right now timings for servo control are hard coded but hobby servos aren't a precise devices and their set angle for specified input pulse may vary.

For example, with default settings from marlin:

class Servo {
  static const int MIN_ANGLE =   0,
                   MAX_ANGLE = 270,
                   MIN_PULSE_WIDTH =  544,  // Shortest pulse sent to a servo
                   MAX_PULSE_WIDTH = 2400,  // Longest pulse sent to a servo
                   TAU_MSEC = 20,
                   TAU_USEC = (TAU_MSEC * 1000),
                   MAX_COMPARE = _BV(16) - 1; // 65535

My servo doesn't do full 270 degree rotation with those timings:

out_2

But if i change value of MAX_PULSE_WIDTH parameter to 2500 it works properly.

out_1

Are you looking for hardware support?

No response

Describe the feature you want

Make servo timings editable in configuration_adv file.

Additional context

No response

Ilderi commented 2 months ago

Right now my workaround is to change this default value but if someone has more than one servo that won't do the job.