From f6a166cb67c2f11cc5cf3ab7399bdff4274a29c1 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 5 Sep 2022 13:52:17 -0400 Subject: [PATCH] tmc: Improve error on missing stepper section If a tmc driver can't find the stepper config section it reports a "missing microsteps" error which can be confusing. Provide a more explicit error message. Signed-off-by: Kevin O'Connor --- klippy/extras/tmc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/klippy/extras/tmc.py b/klippy/extras/tmc.py index 18aad419..df3c705b 100644 --- a/klippy/extras/tmc.py +++ b/klippy/extras/tmc.py @@ -505,6 +505,10 @@ class TMCVirtualPinHelper: def TMCMicrostepHelper(config, mcu_tmc): fields = mcu_tmc.get_fields() stepper_name = " ".join(config.get_name().split()[1:]) + if not config.has_section(stepper_name): + raise config.error( + "Could not find config section '[%s]' required by tmc driver" + % (stepper_name,)) stepper_config = ms_config = config.getsection(stepper_name) if (stepper_config.get('microsteps', None, note_valid=False) is None and config.get('microsteps', None, note_valid=False) is not None):