From cc919a5f8d2dc3f137f7058c4019e55a98555cba Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 21 Apr 2025 13:09:47 -0400 Subject: [PATCH] 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 --- klippy/mcu.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 +# Copyright (C) 2016-2025 Kevin O'Connor # # 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