Start / Stop S3D SCRIPT / G-CODE
-
Well for starters in the places in S3D for user code I have
M98 "print_begin.g"
and
M98 "print_end.g"
All the actual code for start/stop is in those two files on the Duet.
Both of these files include calls to macros which I am going to omit for now but you should be able to understand what is going on.
Here is print_begin.g:
; S3D inserts the following before the call to this file ;G90 ; absolute XYZ moves ;M83 ; relative E moves ;M106 S0 ; fan on to 0 (correct way to do fan off) ;M140 S60 ; set bed temp but don't wait ;M104 S190 T0 ; set extruder temp but don't wait ;M98 P"print_begin.g" ; invokes this file ; select tool and configure based on filament selected T0 ; select tool 0 so extruder commands below will work M703 ; configure selected filament (sets bed/extruder temps, extrusion multiplier) ; check for selected filament if move.extruders[0].filament = "" M291 R"No Filament Selected" P"Cannot Continue" S2 T0 abort ; check bed heater active temp setting if heat.heaters[0].active = 0 M291 R"Bed Heater Active Temp = 0" P"Cannot Continue" S2 T0 abort ; check extruder heater active temp setting if heat.heaters[1].active = 0 M291 R"Extruder Heater Active Temp = 0" P"Cannot Continue" S2 T0 abort ; check if homed - allows homing (OK button) or canceling (CLOSE button) if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed M291 R"Printer has not been homed" P"Home and Continue?" S3 T0 G28 ; setup to print M291 R"Preparing to print" P"Please wait..." T0 M106 P2 S255 ; lights on M106 P3 S255 ; lights on M106 P4 S255 ; lights on G90 ; absolute moves G1 Z100 F1200 ; position for cleaning G1 X0 Y-145 F6000 ; position for cleaning M291 R"Heating Extruder & Bed" P"Please wait..." T0 M116 ; wait for temps to reach set points M291 R"Priming Extruder" P"Please wait..." T0 M83 ; insure extruder relative mode G92 E0 ; reset the extruder logical position G1 E10 F60 ; prime the extruder M400 ; wait to complete G92 E0 ; reset the extruder logical position M98 P"beep_alert_1.g" ; beep paneldue M291 R"Clean Nozzle and Bed" P"Click OK to begin printing" S3 T0 G1 E-0.5 F60 ; retract to control oozing M400 ; wait to complete G92 E0 ; reset the extruder logical position M98 P"mesh_comp_map_load.g" ; load height map as needed M118 L0 P4 S"FT5|Print begun"
Here is print_end.g:
M291 R"Finishing Print" P"Please wait..." T0 M83 ; extruder relative G1 E-1 F3600 ; retract filament M106 P0 S0 ; turn part fan off G10 P0 S-999 R-999 ; turn extruder heater off (also sets temps to zero) T-1 ; deselect all tools M140 S0 ; set bed heater active temp to 0 M140 S-999 ; turn bed heater off G91 ; relative moves G1 Z100 F1200 ; move the nozzle out of the way - step 1 G90 ; absolute moves G1 X0 Y150 F3000 ; move the nozzle out of the way - step 2 M106 P2 S0 ; lights off M106 P3 S0 ; lights off M106 P4 S0 ; lights off M118 L0 P4 S"FT5|Print Finished" M291 R"Print Finished" P"OK" T0
-
@fcwilt Thank you very much!
-
@fcwilt I will fully admit I can't follow it. My script for my TLM pre-duet was a few lines. I am lost on how to get it so it doesn't a single probe to get the right height and get up axis.
-
@noblebran said in Start / Stop S3D SCRIPT / G-CODE:
@fcwilt I am lost on how to get it so it doesn't a single probe to get the right height and get up axis.
I'm sorry but I don't understand the question.
If you are asking about setting the Z=0 datum that happens in the "mesh_comp_map_load.g".
One of the things that you always do before loading the height map is setting the Z=0 datum.
I have it in that file to be sure the height map is loaded correctly.
Here is a simplified version of that file:
M98 P"probe_set_z.g"; set Z=0 Datum G29 S1 ; load existing height map M376 H0 ; set bed compensation taper (0 = no taper)
-
@fcwilt said in Start / Stop S3D SCRIPT / G-CODE:
M98 P"probe_set_z.g"; set Z=0 Datum G29 S1 ; load existing height map M376 H0 ; set bed compensation taper (0 = no taper)
I must be really ignorant... I don' have a "mesh_comp_map_load.g"
-
@noblebran said in Start / Stop S3D SCRIPT / G-CODE:
@fcwilt said in Start / Stop S3D SCRIPT / G-CODE:
M98 P"probe_set_z.g"; set Z=0 Datum G29 S1 ; load existing height map M376 H0 ; set bed compensation taper (0 = no taper)
I must be really ignorant... I don' have a "mesh_comp_map_load.g"
Where you see M98 P"...." that M98 command is executing a file that I created to perform a specific task.
Whenever I have a hunk of code I need to execute from more than one location I place that code in a separate file that I can invoke as needed with M98. That way I don't have any duplicate code appearing in multiple locations.
The common files you are likely to see are:
- config.g
- homeall.g
- homex.g
- homey.g
- homez.g
- bed.g
- mesh.g
In addition to these I have 27 other files of my own creation that perform specific tasks.
Frederick
-
@fcwilt Okay, thank you for the explanation my friend.
-
@noblebran said in Start / Stop S3D SCRIPT / G-CODE:
@fcwilt Okay, thank you for the explanation my friend.
Glad to help.
Do not hesitate to ask any questions you may have - that's how we all learn.
Frederick
-
@fcwilt I have no clue or have a start of where I need to go, but am not close to you....
-
@noblebran said in Start / Stop S3D SCRIPT / G-CODE:
@fcwilt I have no clue or have a start of where I need to go, but am not close to you....
Well let's back up a bit.
What is it you want to do but don't know how to do?
I and others here can provide simple step by step code/instructions to do anything that needs to happen at the start of a print or the end of a print.
Frederick
-
@fcwilt Right now I don't have any code (except old Little Monster Smoothieware code) and I went to print something and the z-probe didn't extend and the height went to low, I did the offset and have done the work to get it all set up, but don't know how to start it and how to end the code. This is all new to me, and it was unexpected. The MKS Base card burnt out so I went with the Duet and have not had the time to do my research like I always like to do. I just don't want to break something in the process.
-
Have you created the basic files I mentioned and have you installed them on the Duet?
- config.g
- homeall.g
- homex.g
- homey.g
- homez.g
Frederick
-
@fcwilt Sorry I was in bed and working now. I have done all (not to say they are right or not).
-
@noblebran said in Start / Stop S3D SCRIPT / G-CODE:
@fcwilt Sorry I was in bed and working now. I have done all (not to say they are right or not).
OK lets check those files.
using the </> tag post copy&paste the contents of each file in a separate tag.
The </> tag creates a scrollable region and makes viewing code easy.
Frederick
-
@fcwilt config.g
; Configuration file for Duet WiFi (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.2.3 on Mon Jul 05 2021 14:33:32 GMT-0400 (Eastern Daylight Time) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"My Printer" ; set printer name M665 R155 L397.15 B155 H520 ; Set delta radius, diagonal rod length, printable radius and homed height M666 X0 Y0 Z0 ; put your endstop adjustments here, or let auto calibration find them ; Network M552 S1 ; enable network M587 S"XXXXXX" ; CONFIGURE AP M586 P0 S1 ; enable HTTP M586 P1 S1 ; enable FTP M586 P2 S1 ; enable Telnet ; Drives M569 P0 S1 ; physical drive 0 goes forwards M569 P1 S1 ; physical drive 1 goes forwards M569 P2 S1 ; physical drive 2 goes forwards M569 P3 S0 ; physical drive 3 goes forwards M584 X0 Y1 Z2 E3 ; set drive mapping M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation M92 X160.00 Y160.00 Z160.00 E873.08 ; set steps per mm M566 X1200.00 Y1200.00 Z1200.00 E1200.00 ; set maximum instantaneous speed changes (mm/min) M203 X72000.00 Y72000.00 Z72000.00 E1200.00 ; set maximum speeds (mm/min) M201 X2000.00 Y2000.00 Z2000.00 E1000.00 ; set accelerations (mm/s^2) M906 X1200 Y1200 Z1200 E1200 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 Z0 S1 ; set minimum Z ; Endstops M574 X2 S1 P"xstop" ; configure active-high endstop for high end on X via pin xstop M574 Y2 S1 P"ystop" ; configure active-high endstop for high end on Y via pin ystop M574 Z2 S1 P"zstop" ; configure active-high endstop for high end on Z via pin zstop ; Z-Probe M950 S0 C"exp.heater3" ; create servo pin 0 for BLTouch M558 P9 C"^zprobe.in" H5 F120 T6000 ; set Z probe type to bltouch and the dive height + speeds G31 P500 X0 Y20 Z1.35 ; set Z probe trigger value, offset and trigger height M557 R150 S45 ; define mesh grid ; Heaters M308 S0 P"bedtemp" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin bedtemp M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0 M307 H1 B1 S1.00 ; enable bang-bang mode for the bed heater and set PWM limit M140 H0 ; map heated bed to heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C M308 S1 P"e0temp" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin e0temp M950 H1 C"e1heat" T1 ; create nozzle heater output on e1heat and map it to sensor 1 M307 H1 B0 R3.660 C138.7 D14.26 S1.00 V23.1 ; disable bang-bang mode for heater and set PWM limit M143 H1 S280 ; set temperature limit for heater 1 to 280C ; Fans M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency M106 P0 S1 H0 T50 ; set fan 0 value. Thermostatic control is turned on ; Tools M563 P0 D0 H1 F0 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C ; Miscellaneous M575 P1 S1 B57600 ; enable support for PanelDue M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; set voltage thresholds and actions to run on power loss M501 ; for PID tuning
-
@fcwilt homeall.g
G91 ; relative positioning G1 H1 X705 Y705 Z705 F3600 ; move all towers to the high end stopping at the endstops (first pass) G1 H2 X-5 Y-5 Z-5 F3600 ; go down a few mm G1 H1 X10 Y10 Z10 F360 ; move all towers up once more (second pass) G1 Z-5 F6000 ; move down a few mm so that the nozzle can be centred G90 ; absolute positioning G1 X0 Y0 F6000 ; move X+Y to the center
-
@fcwilt homex.g
G28 X ; home x
-
@fcwilt homey.g
G28 Y
-
@fcwilt homez.g
G28 Z
-
Great.
Now I don't have any delta printers so I had to check.
For a delta printer the RRF configuration tool doesn't create those four homing files, just homedelta.g
The homeall.g you posted looks like what the homedelta.g file should be.
So get rid of homex.g homey.g and homez.g and then rename homeall.g to homedelta.g.
Now with that out of the way let's turn to config.g.
You have an M587 there which not be used in config.g. You use that command when setting up the WiFi connection but you don't keep it in config.g.
At first glance everything else looks reasonable.
Does the PanelDue work?
Does homing work?
Can you move the nozzle to all places in the printable area?
Can you move over the range of the Z axis?
If you move to Z=10 and do a G30 does the Z probe work?
If you activate the heaters do they heat as expected to whatever temperature you specified?
Do the fans work?
Thanks.
Frederick