diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2022-09-05 20:52:17 +0300 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2022-09-05 20:55:19 +0300 |
commit | f6a166cb67c2f11cc5cf3ab7399bdff4274a29c1 (patch) | |
tree | a37658008463d901d921b62532e6a1bf1ad97cf7 | |
parent | 35e2472bbc1d160eee157690e6baf5a111dc59e0 (diff) |
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 <kevin@koconnor.net>
-rw-r--r-- | klippy/extras/tmc.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/klippy/extras/tmc.py b/klippy/extras/tmc.py index 18aad419d..df3c705bd 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): |