How to print console to .txt & run loops in macros ?
schpongo last edited by
Hey I'm not sure if this is a working feature, If so please do point me to a guide.
But I would like to save the output of for example the G3 S-1 command to a text file so I can later evaluate the text file.
By doing this I could take repeated measurements and get a good average.
Another things that would be helpful in this context would be the ability to write loops in macros.
Thanks for the help.
You can't do loops in macros yet unfortunately. Maybe soon?
But you can enable logging to a file.
However, to do what you want with the G30 S-1 command to get an average of consecutive trigger height runs you can do something like I've done in a macro. It requires having gcodes echoes to the DWC gcode console and running the macro from the DWC (as opposed to from the panel due as then it doesn't seem to echo properly).
; Clear compensation map and Zprobe trigger height ; M291 P"Grid bed compensation map and ZProbe trigger height will be cleared. Ok or Cancel?" R"WARNING" S3 ; User must click OK or cancel. M561 ; Disable any current bed compensation G29 S2 ; Clear mesh bed compensation perameters G31 Z0 ; Reset zprobe trigger height ; home all axis ; G28 ; Home all axis G90 ; Absolute positioning T0 ; Activate first tool ; Set lower speeds for Z homing and lower Z motor current ; M566 Z10 ; Set maximum instantaneous speed changes (mm/min) (Jerk) M203 Z400 ; Set maximum speeds (mm/min) M201 Z100 ; Set maximum accelerations (mm/s^2) M906 Z900 ; Drop motor current to prevent damage in case of head crash ; Preheat to probing temps ; M291 P"Preheating to bed to 60 and nozzle to 210 for accurate probing" M104 S210 ; Set nozzle to 210 and release M190 S60 ; Set bed to 60 and wait M109 S210 ; Set nozzle to 210 and wait ; Move nozzle to center of bed at z10 ; M291 P"Nozzle will now move to center of bed to reset Z0 and calibrate probe" S3 G1 Z1 ; Drop bed for nozzle clearance G1 X150 Y110 Z2 F4000 ; Move to bed center ; Reset z to 5 to allow jogging up to touch bed to nozzle ; G92 Z5 ; Dialog to allow user to jog z to touch nozzle to bed gently and then move Z down 10 ; M291 P"Jog the Z Axis until the bed and nozzle are touching and click OK" R"Setting Z=0" Z1 S3 G92 Z0 ; Set z = 0 ; Move probe to center of bed and get probe trigger heights ; M291 P"Probe will now move to center of bed and measure trigger height 10 times" R"ZProbe Trigger Height Calibration" S3 G1 Z1 ; Drop bed for nozzle clearance G1 X190 Y90 F4000 ; Move to bed center M291 P"Heights will be found in gcode console if logging successful gcode is enabled" R"Did you remember to enabled gcode logging?" S3 ; G30 S-1 10 times ; ; 1 G1 Z10 G30 S-1 ; 2 G1 Z10 G30 S-1 ; 3 G1 Z10 G30 S-1 ; 4 G1 Z10 G30 S-1 ; 5 G1 Z10 G30 S-1 ; 6 G1 Z10 G30 S-1 ; 7 G1 Z10 G30 S-1 ; 8 G1 Z10 G30 S-1 ; 9 G1 Z10 G30 S-1 ; 10 G1 Z10 G30 S-1 M291 P"Probing complete. Turning off heaters and homing axis. Check log for trigger heights and enter into config.g" S2 ; Turn off heaters ; M104 S0 ; Set nozzle to 0 and release M140 S0 ; Set bed to 0 and release M906 Z1500 ; Return Z motor current to normal G28 XY ; Home XY ; Tone to get user attention ; M400 ; Clear movement buffer so tones play reliably M300 S666 P500 G4 P501 M300 S1111 P300 G4 P301