From f8494215169f97c8c52eb68c414b27251bafa4d8 Mon Sep 17 00:00:00 2001 From: Jakob <53713395+Jakob-Eichberger@users.noreply.github.com> Date: Sat, 18 May 2024 11:52:37 +0200 Subject: [PATCH] =?UTF-8?q?Updates=20docs\Bleeding=5FEdge.md=20example=20m?= =?UTF-8?q?acro=20for=20pa=20tuning=20so=20that=20a=20f=E2=80=A6=20(#240)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Updates docs\Bleeding_Edge.md example macro for pa tuning so that a finer tuning of pa is possible * Update Bleeding_Edge.md Remove redundant if statement. Update documentation. --- docs/Bleeding_Edge.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/Bleeding_Edge.md b/docs/Bleeding_Edge.md index 67e741ab0..0afff99ae 100644 --- a/docs/Bleeding_Edge.md +++ b/docs/Bleeding_Edge.md @@ -287,9 +287,26 @@ gcode: # M109 S{vars.hotend_temp} {% set flow_percent = vars.flow_rate|float * 100.0 %} {% if flow_percent > 0 %} - M221 S{flow_percent} + M221 S{flow_percent} + {% endif %} + {% set height = printer.configfile.settings.pa_test.height %} + {% set pavalue = vars.pa_value %} + ; If pa_value is 0 then we test the full pa range starting from 0 + {% if vars.pa_value == 0 %} + TUNING_TOWER COMMAND=SET_PRESSURE_ADVANCE PARAMETER=ADVANCE START=0 FACTOR=.005 + {% else %} + ; make sure that delta and start can not be lower then 0 + {% if vars.pa_value - vars.pa_range <= 0%} + {% set delta = vars.pa_range %} + {% set start = 0 %} + {% else %} + ; calculate the pa range that we want to test + {% set delta = (vars.pa_value + vars.pa_range) - (vars.pa_value - vars.pa_range) %} + ; calculate the pa start value + {% set start = vars.pa_value - vars.pa_range %} + {% endif %} + TUNING_TOWER COMMAND=SET_PRESSURE_ADVANCE PARAMETER=ADVANCE START={start} FACTOR={delta / height} {% endif %} - TUNING_TOWER COMMAND=SET_PRESSURE_ADVANCE PARAMETER=ADVANCE START=0 FACTOR=.005 ; PRINT_PA_TOWER must be the last command in the start_pa_test script: ; it starts a print and then immediately returns without waiting for the print to finish PRINT_PA_TOWER {vars.rawparams} FINAL_GCODE_ID=end_pa_test @@ -310,6 +327,8 @@ gcode: [gcode_macro RUN_PA_TEST] variable_bed_temp: -1 variable_hotend_temp: -1 +variable_pa_value: 0 # Used for further tuning of pa value. If value is not 0 than the tested pa value will only be +/- (determined by the pa_range variable) around of the pa_value variable +variable_pa_range: 0.03 # Only use if pa_value is set to heigher than 0. Used to set the +/- area around pa_value that should be tested variable_flow_rate: -1 variable_rawparams: '' gcode: @@ -322,6 +341,8 @@ gcode: {% endif %} SET_GCODE_VARIABLE MACRO=RUN_PA_TEST VARIABLE=bed_temp VALUE={params.BED_TEMP|default(60)} SET_GCODE_VARIABLE MACRO=RUN_PA_TEST VARIABLE=hotend_temp VALUE={params.TARGET_TEMP} + SET_GCODE_VARIABLE MACRO=RUN_PA_TEST VARIABLE=pa_value VALUE={params.PA_VALUE|default(0)} + SET_GCODE_VARIABLE MACRO=RUN_PA_TEST VARIABLE=pa_range VALUE={params.PA_RANGE|default(0.01)} SET_GCODE_VARIABLE MACRO=RUN_PA_TEST VARIABLE=flow_rate VALUE={params.FLOW_RATE|default(-1)} SET_GCODE_VARIABLE MACRO=RUN_PA_TEST VARIABLE=rawparams VALUE="'{rawparams}'" SAVE_GCODE_STATE NAME=PA_TEST_STATE