From 0291a1554cb7bb8c74db15591150aa7958905df5 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 5 Mar 2024 21:45:16 -0500 Subject: configfile: Add support for reporting runtime_warnings via the API server Add a new runtime_warning() method that will add a 'runtime_warning' type message to the printer.configfile.warnings object. Signed-off-by: Kevin O'Connor --- klippy/mcu.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'klippy/mcu.py') diff --git a/klippy/mcu.py b/klippy/mcu.py index afd0d75d..366f7806 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -811,8 +811,10 @@ class MCU: mcu_freq_mhz = int(mcu_freq / 1000000. + 0.5) calc_freq_mhz = int(calc_freq / 1000000. + 0.5) if mcu_freq_mhz != calc_freq_mhz: - logging.warn("MCU '%s' configured for %dMhz but running at %dMhz!", - self._name, mcu_freq_mhz, calc_freq_mhz) + pconfig = self._printer.lookup_object('configfile') + msg = ("MCU '%s' configured for %dMhz but running at %dMhz!" + % (self._name, mcu_freq_mhz, calc_freq_mhz)) + pconfig.runtime_warning(msg) # Config creation helpers def setup_pin(self, pin_type, pin_params): pcs = {'endstop': MCU_endstop, -- cgit v1.2.3-70-g09d2