aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/mcu.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-05-20 17:41:42 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-05-26 11:09:32 -0400
commit8532e2123ecd3868381fd7438dc25e3fd535bfbf (patch)
tree155f7dd123023ca2ed80f838a7185d0bec995ffb /klippy/mcu.py
parent8cd8cb492e44d1661add19b2c77b699a82f5eb49 (diff)
downloadkutter-8532e2123ecd3868381fd7438dc25e3fd535bfbf.tar.gz
kutter-8532e2123ecd3868381fd7438dc25e3fd535bfbf.tar.xz
kutter-8532e2123ecd3868381fd7438dc25e3fd535bfbf.zip
gpiocmds: Specify soft pwm duration in clock ticks
Improve the precision of soft pwm pulses by allowing the host to directly specify the clock duration of the pulse. This improvement in precision may be noticeable when controller servos (and bltouch). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/mcu.py')
-rw-r--r--klippy/mcu.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/klippy/mcu.py b/klippy/mcu.py
index e7c28a03..256c15f2 100644
--- a/klippy/mcu.py
+++ b/klippy/mcu.py
@@ -341,7 +341,7 @@ class MCU_pwm:
or self._shutdown_value not in [0., 1.]):
raise pins.error(
"start and shutdown values must be 0.0 or 1.0 on soft pwm")
- self._pwm_max = self._mcu.get_constant_float("SOFT_PWM_MAX")
+ self._pwm_max = float(cycle_ticks)
if self._is_static:
self._mcu.add_config_cmd("set_digital_out pin=%s value=%d" % (
self._pin, self._start_value >= 0.5))
@@ -354,7 +354,8 @@ class MCU_pwm:
self._start_value >= 0.5, self._shutdown_value >= 0.5,
self._mcu.seconds_to_clock(self._max_duration)))
self._set_cmd = self._mcu.lookup_command(
- "schedule_soft_pwm_out oid=%c clock=%u value=%hu", cq=cmd_queue)
+ "schedule_soft_pwm_out oid=%c clock=%u on_ticks=%u",
+ cq=cmd_queue)
def set_pwm(self, print_time, value):
clock = self._mcu.print_time_to_clock(print_time)
if self._invert: