From f405abe37a0dde676619df0bc4e7cea8054192ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Mon, 24 Feb 2025 20:22:10 +0100 Subject: [PATCH] Accept float for frequency in static freq test (#205) --- shaketune/commands/excitate_axis_at_freq.py | 4 ++-- shaketune/helpers/resonance_test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shaketune/commands/excitate_axis_at_freq.py b/shaketune/commands/excitate_axis_at_freq.py index 1ab9709..3372850 100644 --- a/shaketune/commands/excitate_axis_at_freq.py +++ b/shaketune/commands/excitate_axis_at_freq.py @@ -21,7 +21,7 @@ def excitate_axis_at_freq(gcmd, config, st_process: ShakeTuneProcess) -> None: date = datetime.now().strftime('%Y%m%d_%H%M%S') create_graph = gcmd.get_int('CREATE_GRAPH', default=0, minval=0, maxval=1) == 1 - freq = gcmd.get_int('FREQUENCY', default=25, minval=1) + freq = gcmd.get_float('FREQUENCY', default=25, minval=1) duration = gcmd.get_int('DURATION', default=30, minval=1) accel_per_hz = gcmd.get_float('ACCEL_PER_HZ', default=None) axis = gcmd.get('AXIS', default='x').lower() @@ -53,7 +53,7 @@ def excitate_axis_at_freq(gcmd, config, st_process: ShakeTuneProcess) -> None: st_process.get_st_config().chunk_size, printer.get_reactor(), filename ) - ConsoleOutput.print(f'Excitating {axis.upper()} axis at {freq}Hz for {duration} seconds') + ConsoleOutput.print(f'Excitating {axis.upper()} axis at {freq:.1f}Hz for {duration} seconds') printer = config.get_printer() gcode = printer.lookup_object('gcode') diff --git a/shaketune/helpers/resonance_test.py b/shaketune/helpers/resonance_test.py index bcc00e0..d60578e 100644 --- a/shaketune/helpers/resonance_test.py +++ b/shaketune/helpers/resonance_test.py @@ -277,7 +277,7 @@ def _run_test_sequence(self, axis_direction, test_seq): toolhead.move([nX, nY, nZ, E], max(abs_v, abs_last_v)) if math.floor(freq) > math.floor(last_freq): - ConsoleOutput.print(f'Testing frequency: {freq:.0f} Hz') + ConsoleOutput.print(f'Testing frequency: {freq:.1f} Hz') reactor.pause(reactor.monotonic() + 0.01) X, Y, Z = nX, nY, nZ