fixed items from code review
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from .axes_map_calibration import axes_map_calibration as axes_map_calibration
|
||||
from .axes_shaper_calibration import axes_shaper_calibration as axes_shaper_calibration
|
||||
from .compare_belts_responses import compare_belts_responses as compare_belts_responses
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# This file provides a custom and internal Shake&Tune Accelerometer helper that is
|
||||
# an interface to Klipper's own accelerometer classes. It is used to start and
|
||||
# stop accelerometer measurements and write the data to a file in a blocking manner.
|
||||
@@ -18,7 +16,7 @@ class Accelerometer:
|
||||
def find_axis_accelerometer(printer, axis: str = 'xy'):
|
||||
accel_chip_names = printer.lookup_object('resonance_tester').accel_chip_names
|
||||
for chip_axis, chip_name in accel_chip_names:
|
||||
if axis in ['x', 'y'] and chip_axis == 'xy':
|
||||
if axis in {'x', 'y'} and chip_axis == 'xy':
|
||||
return chip_name
|
||||
elif chip_axis == axis:
|
||||
return chip_name
|
||||
@@ -57,4 +55,4 @@ class Accelerometer:
|
||||
f.write('#time,accel_x,accel_y,accel_z\n')
|
||||
samples = bg_client.samples or bg_client.get_samples()
|
||||
for t, accel_x, accel_y, accel_z in samples:
|
||||
f.write('%.6f,%.6f,%.6f,%.6f\n' % (t, accel_x, accel_y, accel_z))
|
||||
f.write(f'{t:.6f},{accel_x:.6f},{accel_y:.6f},{accel_z:.6f}\n')
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
from ..helpers.console_output import ConsoleOutput
|
||||
from ..shaketune_process import ShakeTuneProcess
|
||||
from .accelerometer import Accelerometer
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
from ..helpers.common_func import AXIS_CONFIG
|
||||
from ..helpers.console_output import ConsoleOutput
|
||||
from ..helpers.resonance_test import vibrate_axis
|
||||
@@ -14,7 +11,7 @@ def axes_shaper_calibration(gcmd, config, st_process: ShakeTuneProcess) -> None:
|
||||
hz_per_sec = gcmd.get_float('HZ_PER_SEC', default=1, minval=1)
|
||||
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']:
|
||||
if axis_input not in {'x', 'y', '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)
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
from ..helpers.common_func import AXIS_CONFIG
|
||||
from ..helpers.console_output import ConsoleOutput
|
||||
from ..helpers.motors_config_parser import MotorsConfigParser
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
import math
|
||||
|
||||
from ..helpers.console_output import ConsoleOutput
|
||||
@@ -39,7 +36,7 @@ def create_vibrations_profile(gcmd, config, st_process: ShakeTuneProcess) -> Non
|
||||
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':
|
||||
if motors_config_parser.kinematics in {'cartesian', 'corexz'}:
|
||||
main_angles = [0, 90] # Cartesian motors are on X and Y axis directly, same for CoreXZ
|
||||
elif motors_config_parser.kinematics == 'corexy':
|
||||
main_angles = [45, 135] # CoreXY motors are on A and B axis (45 and 135 degrees)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from ..helpers.common_func import AXIS_CONFIG
|
||||
from ..helpers.console_output import ConsoleOutput
|
||||
from ..helpers.resonance_test import vibrate_axis_at_static_freq
|
||||
@@ -29,7 +27,7 @@ def excitate_axis_at_freq(gcmd, config, st_process: ShakeTuneProcess) -> None:
|
||||
if create_graph:
|
||||
printer = config.get_printer()
|
||||
if accel_chip is None:
|
||||
accel_chip = Accelerometer.find_axis_accelerometer(printer, 'xy' if axis in ['a', 'b'] else axis)
|
||||
accel_chip = Accelerometer.find_axis_accelerometer(printer, 'xy' if axis in {'a', 'b'} else axis)
|
||||
k_accelerometer = printer.lookup_object(accel_chip, None)
|
||||
if k_accelerometer is None:
|
||||
raise gcmd.error(f'Accelerometer chip [{accel_chip}] was not found!')
|
||||
|
||||
Reference in New Issue
Block a user