Skip to content

Commit

Permalink
Updates docs\Bleeding_Edge.md example macro for pa tuning so that a f… (
Browse files Browse the repository at this point in the history
#240)

* 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.
  • Loading branch information
Jakob-Eichberger authored May 18, 2024
1 parent a7b72e1 commit f849421
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions docs/Bleeding_Edge.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit f849421

Please sign in to comment.