diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-11-22 09:41:13 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-11-22 10:08:56 -0500 |
commit | d1e13b7e12ff97453e65233c4e7f110f6424a32a (patch) | |
tree | fc84c63fc006b3f5cc4e567a17e9ac3bc13ac774 /klippy/mcu.py | |
parent | 4eeb4620cd9eb6fc8bd4789dca6264e4291eabed (diff) | |
download | kutter-d1e13b7e12ff97453e65233c4e7f110f6424a32a.tar.gz kutter-d1e13b7e12ff97453e65233c4e7f110f6424a32a.tar.xz kutter-d1e13b7e12ff97453e65233c4e7f110f6424a32a.zip |
mcu: Verify start value equal to shutdown value when using max duration
The mcu can only enforce the max duration if the start value is the
same as the shutdown value, so verify that before configuing the mcu.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/mcu.py')
-rw-r--r-- | klippy/mcu.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/klippy/mcu.py b/klippy/mcu.py index 751e55ef..4fa7772b 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -254,6 +254,9 @@ class MCU_digital_out: self._mcu.add_config_cmd("set_digital_out pin=%s value=%d" % (self._pin, self._start_value)) return + if self._max_duration and self._start_value != self._shutdown_value: + raise pins.error("Pin with max duration must have start" + " value equal to shutdown value") self._mcu.request_move_queue_slot() self._oid = self._mcu.create_oid() self._mcu.add_config_cmd( @@ -305,6 +308,9 @@ class MCU_pwm: self._shutdown_value = max(0., min(1., shutdown_value)) self._is_static = is_static def _build_config(self): + if self._max_duration and self._start_value != self._shutdown_value: + raise pins.error("Pin with max duration must have start" + " value equal to shutdown value") cmd_queue = self._mcu.alloc_command_queue() curtime = self._mcu.get_printer().get_reactor().monotonic() printtime = self._mcu.estimated_print_time(curtime) |