added CoreXZ support for the belt comparison tool
This commit is contained in:
@@ -20,6 +20,8 @@ AXIS_CONFIG = [
|
|||||||
{'axis': 'y', 'direction': (0, 1, 0), 'label': 'axis_Y'},
|
{'axis': 'y', 'direction': (0, 1, 0), 'label': 'axis_Y'},
|
||||||
{'axis': 'a', 'direction': (1, -1, 0), 'label': 'belt_A'},
|
{'axis': 'a', 'direction': (1, -1, 0), 'label': 'belt_A'},
|
||||||
{'axis': 'b', 'direction': (1, 1, 0), 'label': 'belt_B'},
|
{'axis': 'b', 'direction': (1, 1, 0), 'label': 'belt_B'},
|
||||||
|
{'axis': 'corexz_x', 'direction': (1, 0, 1), 'label': 'belt_X'},
|
||||||
|
{'axis': 'corexz_z', 'direction': (-1, 0, 1), 'label': 'belt_Z'},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,17 +23,32 @@ def compare_belts_responses(gcmd, config, st_thread: ShakeTuneThread) -> None:
|
|||||||
res_tester = printer.lookup_object('resonance_tester')
|
res_tester = printer.lookup_object('resonance_tester')
|
||||||
systime = printer.get_reactor().monotonic()
|
systime = printer.get_reactor().monotonic()
|
||||||
|
|
||||||
|
if accel_per_hz is None:
|
||||||
|
accel_per_hz = res_tester.test.accel_per_hz
|
||||||
|
max_accel = max_freq * accel_per_hz
|
||||||
|
|
||||||
|
# Configure the graph creator
|
||||||
|
motors_config_parser = MotorsConfigParser(config, motors=None)
|
||||||
|
creator = st_thread.get_graph_creator()
|
||||||
|
creator.configure(motors_config_parser.kinematics, accel_per_hz)
|
||||||
|
|
||||||
|
if motors_config_parser.kinematics == 'corexy':
|
||||||
|
filtered_config = [a for a in AXIS_CONFIG if a['axis'] in ('a', 'b')]
|
||||||
accel_chip = Accelerometer.find_axis_accelerometer(printer, 'xy')
|
accel_chip = Accelerometer.find_axis_accelerometer(printer, 'xy')
|
||||||
|
elif motors_config_parser.kinematics == 'corexz':
|
||||||
|
filtered_config = [a for a in AXIS_CONFIG if a['axis'] in ('corexz_x', 'corexz_z')]
|
||||||
|
# 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!')
|
||||||
|
ConsoleOutput.print(f'{motors_config_parser.kinematics.upper()} kinematics mode')
|
||||||
|
|
||||||
if accel_chip is None:
|
if accel_chip is None:
|
||||||
gcmd.error(
|
gcmd.error(
|
||||||
'No suitable accelerometer found for measurement! Multi-accelerometer configurations are not supported for this macro.'
|
'No suitable accelerometer found for measurement! Multi-accelerometer configurations are not supported for this macro.'
|
||||||
)
|
)
|
||||||
accelerometer = Accelerometer(printer.lookup_object(accel_chip))
|
accelerometer = Accelerometer(printer.lookup_object(accel_chip))
|
||||||
|
|
||||||
if accel_per_hz is None:
|
|
||||||
accel_per_hz = res_tester.test.accel_per_hz
|
|
||||||
max_accel = max_freq * accel_per_hz
|
|
||||||
|
|
||||||
# Move to the starting point
|
# Move to the starting point
|
||||||
test_points = res_tester.test.get_start_test_points()
|
test_points = res_tester.test.get_start_test_points()
|
||||||
if len(test_points) > 1:
|
if len(test_points) > 1:
|
||||||
@@ -58,11 +73,6 @@ def compare_belts_responses(gcmd, config, st_thread: ShakeTuneThread) -> None:
|
|||||||
toolhead.manual_move(point, feedrate_travel)
|
toolhead.manual_move(point, feedrate_travel)
|
||||||
toolhead.dwell(0.5)
|
toolhead.dwell(0.5)
|
||||||
|
|
||||||
# Configure the graph creator
|
|
||||||
motors_config_parser = MotorsConfigParser(config, motors=None)
|
|
||||||
creator = st_thread.get_graph_creator()
|
|
||||||
creator.configure(motors_config_parser.kinematics, accel_per_hz)
|
|
||||||
|
|
||||||
# set the needed acceleration values for the test
|
# set the needed acceleration values for the test
|
||||||
toolhead_info = toolhead.get_status(systime)
|
toolhead_info = toolhead.get_status(systime)
|
||||||
old_accel = toolhead_info['max_accel']
|
old_accel = toolhead_info['max_accel']
|
||||||
@@ -76,8 +86,7 @@ def compare_belts_responses(gcmd, config, st_thread: ShakeTuneThread) -> None:
|
|||||||
else:
|
else:
|
||||||
input_shaper = None
|
input_shaper = None
|
||||||
|
|
||||||
# Filter axis configurations to get the A and B axis only
|
# Run the test for each axis
|
||||||
filtered_config = [a for a in AXIS_CONFIG if a['axis'] in ('a', 'b')]
|
|
||||||
for config in filtered_config:
|
for config in filtered_config:
|
||||||
accelerometer.start_measurement()
|
accelerometer.start_measurement()
|
||||||
vibrate_axis(toolhead, gcode, config['direction'], min_freq, max_freq, hz_per_sec, accel_per_hz)
|
vibrate_axis(toolhead, gcode, config['direction'], min_freq, max_freq, hz_per_sec, accel_per_hz)
|
||||||
|
|||||||
Reference in New Issue
Block a user