Klipper plugin refactoring with embedded macros

This commit is contained in:
Félix Boisselier
2024-05-09 16:08:47 +02:00
parent d9060fed3b
commit 30a1910513
21 changed files with 762 additions and 644 deletions

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env python3
from ..helpers.console_output import ConsoleOutput
def excitate_axis_at_freq(gcmd, gcode) -> None:
freq = gcmd.get_int('FREQUENCY', default=25, minval=1)
duration = gcmd.get_int('DURATION', default=10, minval=1)
axis = gcmd.get('AXIS', default='x')
if axis not in ['x', 'y', 'a', 'b']:
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')
if axis == 'a':
axis = '1,-1'
elif axis == 'b':
axis = '1,1'
gcode.run_script_from_command(
f'TEST_RESONANCES OUTPUT=raw_data AXIS={axis} FREQ_START={freq-1} FREQ_END={freq+1} HZ_PER_SEC={1/(duration/3)}'
)