Skip to content

Commit

Permalink
chore: create macro to help us test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jomik committed Nov 22, 2024
1 parent 497d030 commit eae7c75
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ Inside [./typings] is a file named after the module with some dummy classes.
These are the modules that our code will be checked against when pyright is executed.
We can improve our confidence by ensuring these are well defined and up to date with the actual code.
The files that we import with `from . import probe` are reexported in [./__init__.py] to allow pyright to infer this.

## Testing changes

A convenience macro, [./cartographer_ci_test.cfg], has been made to help us test changes.
This can be linked into your `printer_data/configs` and included in `printer.cfg` for ease of use.
We should strive to keep this up to date.
36 changes: 36 additions & 0 deletions cartographer_ci_test.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[respond]

[gcode_macro CARTOGRAPHER_CI_TEST]
variable_stages = ["G28", "PROBE", "PROBE_ACCURACY", "BED_MESH_CALIBRATE", "CARTOGRAPHER_CALIBRATE METHOD=manual", "CARTOGRAPHER_THRESHOLD_SCAN", "CARTOGRAPHER_CALIBRATE", "CARTOGRAPHER_TOUCH"]
variable_stage_index = 0
gcode:
{% set stage_count = stages | length %}
{action_respond_info("Executing %s" % (stages[stage_index]))}
{stages[stage_index]}
M400
G28 Z
{% set next_index = stage_index + 1 %}
RESPOND TYPE=command MSG='{"action:prompt_begin Cartographer CI Tests [%d / %d]" % (next_index, stage_count)}'
{% if next_index < stage_count %}
RESPOND TYPE=command MSG='{"action:prompt_text Next test is %s" % (stages[next_index])}'
RESPOND TYPE=command MSG="action:prompt_footer_button ABORT|_CARTOGRAPHER_CI_TEST_ABORT|error"
RESPOND TYPE=command MSG="action:prompt_footer_button Continue|_CARTOGRAPHER_CI_TEST_CONTINUE|primary"
{% else %}
RESPOND TYPE=command MSG="action:prompt_text All tests completed!!"
SET_GCODE_VARIABLE MACRO=CARTOGRAPHER_CI_TEST VARIABLE=stage_index VALUE=0
{% endif %}
RESPOND TYPE=command MSG="action:prompt_show"

[gcode_macro _CARTOGRAPHER_CI_TEST_CONTINUE]
gcode:
RESPOND TYPE=command MSG="action:prompt_end"
{% set vars = printer["gcode_macro CARTOGRAPHER_CI_TEST"]%}
SET_GCODE_VARIABLE MACRO=CARTOGRAPHER_CI_TEST VARIABLE=stage_index VALUE={vars.stage_index + 1}
CARTOGRAPHER_CI_TEST

[gcode_macro _CARTOGRAPHER_CI_TEST_ABORT]
gcode:
RESPOND TYPE=command MSG="action:prompt_end"
SET_GCODE_VARIABLE MACRO=CARTOGRAPHER_CI_TEST VARIABLE=stage_index VALUE=0
{action_respond_info("Cartographer CI tests aborted.")}

0 comments on commit eae7c75

Please sign in to comment.