Feature/spindle max pwm
authorRandy C. Will <randall.will@gmail.com>
Sat, 18 Nov 2017 20:03:37 +0000 (12:03 -0800)
committerRandy C. Will <randall.will@gmail.com>
Sat, 18 Nov 2017 20:03:37 +0000 (12:03 -0800)
commit6277b09db11b357b55457d884029f13ab3c5b0e5
tree3f4f4cd1776df3786a2ab7104930742bd1706241
parent9ab2d1337226e13f1f92df622bcdc39ba19124c7
Feature/spindle max pwm

Treadmill motor controllers are becoming increasingly popular in DIY
machines.  One such popular controller is the mc2100 which expects a
duty cycle of 0-85% for 0-100% speed.  To keep the PWM signal below the
controller maximum and thus prevent the controller from going into an
error state when higher speeds than physically possible are requested,
we need a config option for the ceiling on the PWM signal.

I tested this for backwards compatibility with my original configuration
without this new parameter included and it works as expected, using 100%
as the maximum duty cycle.

I tested setting `spindle.max_pwm` to 0.85 (above the hard-coded 0.5
starting point) and 0.25 (below the hard-coded 0.5 starting point) and
confirmed expected function for both via M957 output and viewing the
physical PWM output with a scope.

I added a sample `spindle.config` showing this new parameter in context
with the other spindle parameters I could find with a quick grep of the
code and search through the docs.
ConfigSamples/spindle.config [new file with mode: 0644]
src/modules/tools/spindle/PWMSpindleControl.cpp
src/modules/tools/spindle/PWMSpindleControl.h