fix gcmd error that wasn't sent correctly
This commit is contained in:
@@ -15,7 +15,7 @@ def axes_shaper_calibration(gcmd, config, st_process: ShakeTuneProcess) -> None:
|
||||
accel_per_hz = gcmd.get_float('ACCEL_PER_HZ', default=None)
|
||||
axis_input = gcmd.get('AXIS', default='all').lower()
|
||||
if axis_input not in ['x', 'y', 'all']:
|
||||
gcmd.error('AXIS selection invalid. Should be either x, y, or all!')
|
||||
raise gcmd.error('AXIS selection invalid. Should be either x, y, or all!')
|
||||
scv = gcmd.get_float('SCV', default=None, minval=0)
|
||||
max_sm = gcmd.get_float('MAX_SMOOTHING', default=None, minval=0)
|
||||
feedrate_travel = gcmd.get_float('TRAVEL_SPEED', default=120.0, minval=20.0)
|
||||
@@ -38,10 +38,10 @@ def axes_shaper_calibration(gcmd, config, st_process: ShakeTuneProcess) -> None:
|
||||
# Move to the starting point
|
||||
test_points = res_tester.test.get_start_test_points()
|
||||
if len(test_points) > 1:
|
||||
gcmd.error('Only one test point in the [resonance_tester] section is supported by Shake&Tune.')
|
||||
raise gcmd.error('Only one test point in the [resonance_tester] section is supported by Shake&Tune.')
|
||||
if test_points[0] == (-1, -1, -1):
|
||||
if z_height is None:
|
||||
gcmd.error(
|
||||
raise gcmd.error(
|
||||
'Z_HEIGHT parameter is required if the test_point in [resonance_tester] section is set to -1,-1,-1'
|
||||
)
|
||||
# Use center of bed in case the test point in [resonance_tester] is set to -1,-1,-1
|
||||
@@ -84,7 +84,7 @@ def axes_shaper_calibration(gcmd, config, st_process: ShakeTuneProcess) -> None:
|
||||
# First we need to find the accelerometer chip suited for the axis
|
||||
accel_chip = Accelerometer.find_axis_accelerometer(printer, config['axis'])
|
||||
if accel_chip is None:
|
||||
gcmd.error('No suitable accelerometer found for measurement!')
|
||||
raise gcmd.error('No suitable accelerometer found for measurement!')
|
||||
accelerometer = Accelerometer(printer.lookup_object(accel_chip))
|
||||
|
||||
# Then do the actual measurements
|
||||
|
||||
@@ -22,12 +22,12 @@ def axes_map_calibration(gcmd, config, st_process: ShakeTuneProcess) -> None:
|
||||
accel_chip = Accelerometer.find_axis_accelerometer(printer, 'xy')
|
||||
k_accelerometer = printer.lookup_object(accel_chip, None)
|
||||
if k_accelerometer is None:
|
||||
gcmd.error('Error: multi-accelerometer configurations are not supported for this macro!')
|
||||
raise gcmd.error('Multi-accelerometer configurations are not supported for this macro!')
|
||||
pconfig = printer.lookup_object('configfile')
|
||||
current_axes_map = pconfig.status_raw_config[accel_chip]['axes_map']
|
||||
if current_axes_map.strip().replace(' ', '') != 'x,y,z':
|
||||
gcmd.error(
|
||||
f'Error: The parameter axes_map is already set in your {accel_chip} configuration! Please remove it (or set it to "x,y,z")!'
|
||||
current_axes_map = pconfig.status_raw_config[accel_chip].get('axes_map', None)
|
||||
if current_axes_map is not None and current_axes_map.strip().replace(' ', '') != 'x,y,z':
|
||||
raise gcmd.error(
|
||||
f'The parameter axes_map is already set in your {accel_chip} configuration! Please remove it (or set it to "x,y,z")!'
|
||||
)
|
||||
accelerometer = Accelerometer(k_accelerometer)
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ def compare_belts_responses(gcmd, config, st_process: ShakeTuneProcess) -> None:
|
||||
# For CoreXZ kinematics, we can use the X axis accelerometer as most of the time they are moving bed printers
|
||||
accel_chip = Accelerometer.find_axis_accelerometer(printer, 'x')
|
||||
else:
|
||||
gcmd.error('Only CoreXY and CoreXZ kinematics are supported for the belt comparison tool!')
|
||||
raise gcmd.error('Only CoreXY and CoreXZ kinematics are supported for the belt comparison tool!')
|
||||
ConsoleOutput.print(f'{motors_config_parser.kinematics.upper()} kinematics mode')
|
||||
|
||||
if accel_chip is None:
|
||||
gcmd.error(
|
||||
raise gcmd.error(
|
||||
'No suitable accelerometer found for measurement! Multi-accelerometer configurations are not supported for this macro.'
|
||||
)
|
||||
accelerometer = Accelerometer(printer.lookup_object(accel_chip))
|
||||
@@ -52,10 +52,10 @@ def compare_belts_responses(gcmd, config, st_process: ShakeTuneProcess) -> None:
|
||||
# Move to the starting point
|
||||
test_points = res_tester.test.get_start_test_points()
|
||||
if len(test_points) > 1:
|
||||
gcmd.error('Only one test point in the [resonance_tester] section is supported by Shake&Tune.')
|
||||
raise gcmd.error('Only one test point in the [resonance_tester] section is supported by Shake&Tune.')
|
||||
if test_points[0] == (-1, -1, -1):
|
||||
if z_height is None:
|
||||
gcmd.error(
|
||||
raise gcmd.error(
|
||||
'Z_HEIGHT parameter is required if the test_point in [resonance_tester] section is set to -1,-1,-1'
|
||||
)
|
||||
# Use center of bed in case the test point in [resonance_tester] is set to -1,-1,-1
|
||||
|
||||
@@ -15,7 +15,7 @@ def excitate_axis_at_freq(gcmd, config) -> None:
|
||||
|
||||
axis_config = next((item for item in AXIS_CONFIG if item['axis'] == axis), None)
|
||||
if axis_config is None:
|
||||
gcmd.error('AXIS selection invalid. Should be either x, y, a or b!')
|
||||
raise gcmd.error('AXIS selection invalid. Should be either x, y, a or b!')
|
||||
|
||||
ConsoleOutput.print(f'Excitating {axis.upper()} axis at {freq}Hz for {duration} seconds')
|
||||
|
||||
@@ -31,10 +31,10 @@ def excitate_axis_at_freq(gcmd, config) -> None:
|
||||
# Move to the starting point
|
||||
test_points = res_tester.test.get_start_test_points()
|
||||
if len(test_points) > 1:
|
||||
gcmd.error('Only one test point in the [resonance_tester] section is supported by Shake&Tune.')
|
||||
raise gcmd.error('Only one test point in the [resonance_tester] section is supported by Shake&Tune.')
|
||||
if test_points[0] == (-1, -1, -1):
|
||||
if z_height is None:
|
||||
gcmd.error(
|
||||
raise gcmd.error(
|
||||
'Z_HEIGHT parameter is required if the test_point in [resonance_tester] section is set to -1,-1,-1'
|
||||
)
|
||||
# Use center of bed in case the test point in [resonance_tester] is set to -1,-1,-1
|
||||
|
||||
@@ -21,7 +21,7 @@ def create_vibrations_profile(gcmd, config, st_process: ShakeTuneProcess) -> Non
|
||||
accel_chip = gcmd.get('ACCEL_CHIP', default=None)
|
||||
|
||||
if (size / (max_speed / 60)) < 0.25:
|
||||
gcmd.error('The size of the movement is too small for the given speed! Increase SIZE or decrease MAX_SPEED!')
|
||||
raise gcmd.error('The size of the movement is too small for the given speed! Increase SIZE or decrease MAX_SPEED!')
|
||||
|
||||
printer = config.get_printer()
|
||||
gcode = printer.lookup_object('gcode')
|
||||
@@ -31,7 +31,7 @@ def create_vibrations_profile(gcmd, config, st_process: ShakeTuneProcess) -> Non
|
||||
|
||||
# Check that input shaper is already configured
|
||||
if input_shaper is None:
|
||||
gcmd.error('Input shaper is not configured! Please run the shaper calibration macro first.')
|
||||
raise gcmd.error('Input shaper is not configured! Please run the shaper calibration macro first.')
|
||||
|
||||
motors_config_parser = MotorsConfigParser(config, motors=['stepper_x', 'stepper_y'])
|
||||
if motors_config_parser.kinematics == 'cartesian' or motors_config_parser.kinematics == 'corexz':
|
||||
@@ -39,7 +39,7 @@ def create_vibrations_profile(gcmd, config, st_process: ShakeTuneProcess) -> Non
|
||||
elif motors_config_parser.kinematics == 'corexy':
|
||||
main_angles = [45, 135] # CoreXY motors are on A and B axis (45 and 135 degrees)
|
||||
else:
|
||||
gcmd.error(
|
||||
raise gcmd.error(
|
||||
'Only Cartesian, CoreXY and CoreXZ kinematics are supported at the moment for the vibrations measurement tool!'
|
||||
)
|
||||
ConsoleOutput.print(f'{motors_config_parser.kinematics.upper()} kinematics mode')
|
||||
@@ -76,7 +76,7 @@ def create_vibrations_profile(gcmd, config, st_process: ShakeTuneProcess) -> Non
|
||||
current_accel_chip = Accelerometer.find_axis_accelerometer(printer, accel_axis)
|
||||
k_accelerometer = printer.lookup_object(current_accel_chip, None)
|
||||
if k_accelerometer is None:
|
||||
gcmd.error(f'Error: accelerometer [{current_accel_chip}] not found!')
|
||||
raise gcmd.error(f'Accelerometer [{current_accel_chip}] not found!')
|
||||
accelerometer = Accelerometer(k_accelerometer)
|
||||
ConsoleOutput.print(f'Accelerometer chip used for this angle: [{current_accel_chip}]')
|
||||
|
||||
|
||||
@@ -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={motors[0].get_config("pwm_freq_target")}kHz / Y={motors[1].get_config("pwm_freq_target")}kHz)'
|
||||
)
|
||||
else:
|
||||
config_blocks = [
|
||||
|
||||
Reference in New Issue
Block a user