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>
This commit is contained in:
Kevin O'Connor 2025-04-21 13:09:47 -04:00
parent 8e107b2280
commit cc919a5f8d

View File

@ -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