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>
This commit is contained in:
parent
35e2472bbc
commit
f6a166cb67
|
@ -505,6 +505,10 @@ class TMCVirtualPinHelper:
|
||||||
def TMCMicrostepHelper(config, mcu_tmc):
|
def TMCMicrostepHelper(config, mcu_tmc):
|
||||||
fields = mcu_tmc.get_fields()
|
fields = mcu_tmc.get_fields()
|
||||||
stepper_name = " ".join(config.get_name().split()[1:])
|
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)
|
stepper_config = ms_config = config.getsection(stepper_name)
|
||||||
if (stepper_config.get('microsteps', None, note_valid=False) is None
|
if (stepper_config.get('microsteps', None, note_valid=False) is None
|
||||||
and config.get('microsteps', None, note_valid=False) is not None):
|
and config.get('microsteps', None, note_valid=False) is not None):
|
||||||
|
|
Loading…
Reference in New Issue