From 73b93107d7f70218e7716ba74972c0379d1a8a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Tue, 4 Jun 2024 23:04:11 +0200 Subject: [PATCH] fix crash when ACCEL_CHIP is an empty string --- shaketune/measurement/vibrations_profile.py | 3 +++ shaketune/post_processing/graph_vibrations.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/shaketune/measurement/vibrations_profile.py b/shaketune/measurement/vibrations_profile.py index e131bb3..d8a0f78 100644 --- a/shaketune/measurement/vibrations_profile.py +++ b/shaketune/measurement/vibrations_profile.py @@ -20,6 +20,9 @@ def create_vibrations_profile(gcmd, config, st_process: ShakeTuneProcess) -> Non feedrate_travel = gcmd.get_float('TRAVEL_SPEED', default=120.0, minval=20.0) accel_chip = gcmd.get('ACCEL_CHIP', default=None) + if accel_chip == '': + accel_chip = None + if (size / (max_speed / 60)) < 0.25: raise gcmd.error('The size of the movement is too small for the given speed! Increase SIZE or decrease MAX_SPEED!') diff --git a/shaketune/post_processing/graph_vibrations.py b/shaketune/post_processing/graph_vibrations.py index 3a20ff4..5689cfb 100644 --- a/shaketune/post_processing/graph_vibrations.py +++ b/shaketune/post_processing/graph_vibrations.py @@ -571,7 +571,7 @@ def plot_motor_config_txt(fig, motors, differences): for mot, lbl in motor_details ] config_blocks.append( - f'| TMC Autotune enabled (PWM freq target: X={motors[0].get_config("pwm_freq_target")}kHz / Y={motors[1].get_config("pwm_freq_target")}kHz)' + f'| TMC Autotune enabled (PWM freq target: X={int(motors[0].get_config("pwm_freq_target"))}kHz / Y={int(motors[1].get_config("pwm_freq_target"))}kHz)' ) else: config_blocks = [