aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2025-04-21 13:09:47 -0400
committerKevin O'Connor <kevin@koconnor.net>2025-04-28 19:28:52 -0400
commitcc919a5f8d2dc3f137f7058c4019e55a98555cba (patch)
tree912283f82141c2b6a871fe270ec5bbb6918e7ff4 /klippy
parent8e107b2280c12dc70e635220c78fce7656bc4304 (diff)
downloadkutter-cc919a5f8d2dc3f137f7058c4019e55a98555cba.tar.gz
kutter-cc919a5f8d2dc3f137f7058c4019e55a98555cba.tar.xz
kutter-cc919a5f8d2dc3f137f7058c4019e55a98555cba.zip
mcu: Add new min_schedule_time() and max_nominal_duration() helpers
Add a function that returns the minimum amount of time the host needs to reserve for messages to be sent from host to micro-controller. Add a function that returns the maximum amount of time (in seconds) that all micro-controllers should be able to schedule future timers at. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/mcu.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/klippy/mcu.py b/klippy/mcu.py
index b12888f8..2800b235 100644
--- a/klippy/mcu.py
+++ b/klippy/mcu.py
@@ -1,6 +1,6 @@
# Interface to Klipper micro-controller code
#
-# Copyright (C) 2016-2024 Kevin O'Connor <kevin@koconnor.net>
+# Copyright (C) 2016-2025 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import sys, os, zlib, logging, math
@@ -545,6 +545,11 @@ class MCU_adc:
# Main MCU class
######################################################################
+# Minimum time host needs to get scheduled events queued into mcu
+MIN_SCHEDULE_TIME = 0.100
+# Maximum time all MCUs can internally schedule into the future
+MAX_NOMINAL_DURATION = 5.0
+
class MCU:
error = error
def __init__(self, config, clocksync):
@@ -868,6 +873,10 @@ class MCU:
return int(time * self._mcu_freq)
def get_max_stepper_error(self):
return self._max_stepper_error
+ def min_schedule_time(self):
+ return MIN_SCHEDULE_TIME
+ def max_nominal_duration(self):
+ return MAX_NOMINAL_DURATION
# Wrapper functions
def get_printer(self):
return self._printer