diff --git a/files/improved-shapers/delete_csv.sh b/files/improved-shapers/delete_csv.sh new file mode 100755 index 0000000..f29d6dc --- /dev/null +++ b/files/improved-shapers/delete_csv.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +rm -f /tmp/calibration_data_*.csv +rm -f /tmp/resonances_*.csv +rm -f /tmp/raw_data_axis*.csv + +exit 0 \ No newline at end of file diff --git a/files/improved-shapers/delete_graph.sh b/files/improved-shapers/delete_graph.sh new file mode 100755 index 0000000..a2ae9f2 --- /dev/null +++ b/files/improved-shapers/delete_graph.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ -f /usr/data/printer_data/config/Helper-Script/improved-shapers/resonances_x.png ]; then + rm -f /usr/data/printer_data/config/Helper-Script/improved-shapers/resonances_x.png +fi +if [ -f /usr/data/printer_data/config/Helper-Script/improved-shapers/resonances_y.png ]; then + rm -f /usr/data/printer_data/config/Helper-Script/improved-shapers/resonances_y.png +fi +if [ -f /usr/data/printer_data/config/Helper-Script/improved-shapers/belts_calibration.png ]; then + rm -f /usr/data/printer_data/config/Helper-Script/improved-shapers/belts_calibration.png +fi + +exit 0 \ No newline at end of file diff --git a/files/improved-shapers/improved-shapers.cfg b/files/improved-shapers/improved-shapers.cfg index 35f6b1c..5d6cb63 100644 --- a/files/improved-shapers/improved-shapers.cfg +++ b/files/improved-shapers/improved-shapers.cfg @@ -10,13 +10,25 @@ [gcode_shell_command resonance_graph] command: /usr/data/printer_data/config/Helper-Script/improved-shapers/scripts/calibrate_shaper.py timeout: 600.0 -verbose: True +verbose: False [gcode_shell_command belts_graph] command: /usr/data/printer_data/config/Helper-Script/improved-shapers/scripts/graph_belts.py timeout: 600.0 -verbose: True +verbose: False + + +[gcode_shell_command delete_graph] +command: sh /usr/data/helper-script/files/improved-shapers/delete_graph.sh +timeout: 600.0 +verbose: False + + +[gcode_shell_command delete_csv] +command: sh /usr/data/helper-script/files/improved-shapers/delete_csv.sh +timeout: 600.0 +verbose: False [gcode_macro INPUT_SHAPER_CALIBRATION] @@ -35,6 +47,7 @@ gcode: {% if printer["configfile"].config["temperature_fan mcu_fan"] %} SET_TEMPERATURE_FAN_TARGET TEMPERATURE_FAN=mcu_fan TARGET=50 {% endif %} + RUN_SHELL_COMMAND CMD=delete_csv RESPOND TYPE=command MSG="Input Shaper Calibration complete!" SAVE_CONFIG @@ -42,6 +55,7 @@ gcode: [gcode_macro TEST_RESONANCES_GRAPHS] description: Test X and Y Axis Resonances and Generate Graphs gcode: + RUN_SHELL_COMMAND CMD=delete_graph {% set x_png = params.X_PNG|default("/usr/data/printer_data/config/Helper-Script/improved-shapers/resonances_x.png") %} {% set y_png = params.Y_PNG|default("/usr/data/printer_data/config/Helper-Script/improved-shapers/resonances_y.png") %} {% if printer["configfile"].config["temperature_fan mcu_fan"] %} @@ -54,24 +68,26 @@ gcode: RESPOND TYPE=command MSG="Testing X Resonances..." TEST_RESONANCES AXIS=X NAME=x M400 - RESPOND TYPE=command MSG="Generating X Graphs... This may take some time." + RESPOND TYPE=command MSG="Generating X Graph... This may take some time." RUN_SHELL_COMMAND CMD=resonance_graph PARAMS="/tmp/resonances_x_x.csv -o {x_png}" - RESPOND TYPE=command MSG="X Graph (resonances_x.png) is available in /Helper-Script/improved-shapers folder." + RESPOND TYPE=command MSG="X Graph (resonances_x.png) is now available in /Helper-Script/improved-shapers folder." RESPOND TYPE=command MSG="Testing Y Resonances..." TEST_RESONANCES AXIS=Y NAME=y M400 - RESPOND TYPE=command MSG="Generating Y Graphs... This may take some time." + RESPOND TYPE=command MSG="Generating Y Graph... This may take some time." RUN_SHELL_COMMAND CMD=resonance_graph PARAMS="/tmp/resonances_y_y.csv -o {y_png}" - RESPOND TYPE=command MSG="Y Graph (resonances_y.png) is available in /Helper-Script/improved-shapers folder." + RESPOND TYPE=command MSG="Y Graph (resonances_y.png) is now available in /Helper-Script/improved-shapers folder." {% if printer["configfile"].config["temperature_fan mcu_fan"] %} SET_TEMPERATURE_FAN_TARGET TEMPERATURE_FAN=mcu_fan TARGET=50 {% endif %} + RUN_SHELL_COMMAND CMD=delete_csv RESPOND TYPE=command MSG="Resonances Test complete!" [gcode_macro BELTS_SHAPER_CALIBRATION] description: Perform a custom half-axis test to analyze and compare the frequency profiles of individual belts on CoreXY printers gcode: + RUN_SHELL_COMMAND CMD=delete_graph {% set min_freq = params.FREQ_START|default(5)|float %} {% set max_freq = params.FREQ_END|default(133.33)|float %} {% set hz_per_sec = params.HZ_PER_SEC|default(1)|float %} @@ -89,13 +105,13 @@ gcode: M400 TEST_RESONANCES AXIS=1,-1 OUTPUT=raw_data NAME=a FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} M400 - RESPOND TYPE=command MSG="Generating belts comparative frequency profile..." - RESPOND TYPE=command MSG="This may take some time (3-5min)." + RESPOND TYPE=command MSG="Generating Belts Frequency Profiles Graph... This may take some time." RUN_SHELL_COMMAND CMD=belts_graph PARAMS="-w {png_width} -l {png_height} -n -o {png_out_path} -k /usr/share/klipper /tmp/raw_data_axis=1.000,-1.000_a.csv /tmp/raw_data_axis=1.000,1.000_b.csv" - RESPOND TYPE=command MSG="Graph (belts_calibration.png) is available in /Helper-Script/improved-shapers folder." + RESPOND TYPE=command MSG="Graph (belts_calibration.png) is now available in /Helper-Script/improved-shapers folder." {% if printer["configfile"].config["temperature_fan mcu_fan"] %} SET_TEMPERATURE_FAN_TARGET TEMPERATURE_FAN=mcu_fan TARGET=50 {% endif %} + RUN_SHELL_COMMAND CMD=delete_csv RESPOND TYPE=command MSG="Belts Shaper Calibration complete!"