From 913649de2e8057e849be2a54e08d34302ee37dad Mon Sep 17 00:00:00 2001 From: "Jason S. McMullan" Date: Sat, 17 Apr 2021 06:54:12 -0400 Subject: loop_sdcard: Add loopable SD card file sections To support continuous belt printing, add nestable repeat loop support via an `[sdcard_loop]` module. Supported G-Code: - SDCARD_LOOP_BEGIN COUNT=n ; Loop for N times, or infinitely if N is 0 - SDCARD_LOOP_END ; End of loop - SDCARD_LOOP_DESIST ; Complete all loops without iterating Marlin M808 compatibility example in `config/sample-macros.cfg`: - M808 Ln ; Loop for N times, or infinitely if N is 0 - M808 ; End of loop - M808 K ; Complete all loops without iterating Added unit tests in test/klippy/sdcard_loop.test See https://reprap.org/wiki/G-code#M808:_Set_or_Goto_Repeat_Marker Signed-off-by: Jason S. McMullan --- config/sample-macros.cfg | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'config') diff --git a/config/sample-macros.cfg b/config/sample-macros.cfg index ea37c584..0eb049ac 100644 --- a/config/sample-macros.cfg +++ b/config/sample-macros.cfg @@ -176,3 +176,15 @@ gcode: "Humidity: %.2f%%" % ( sensor.temperature, sensor.humidity))} + +# SDCard 'looping' (aka Marlin M808 commands) support +# +# Support SDCard looping +[sdcard_loop] + +# 'Marlin' style M808 compatibility macro for SDCard looping +[gcode_macro M808] +gcode: + {% if params.K is not defined and params.L is defined %}SDCARD_LOOP_BEGIN COUNT={params.L|int}{% endif %} + {% if params.K is not defined and params.L is not defined %}SDCARD_LOOP_END{% endif %} + {% if params.K is defined and params.L is not defined %}SDCARD_LOOP_DESIST{% endif %} -- cgit v1.2.3-70-g09d2