Make GCode (starting script) Commands wait for G28 and G29 to finish before continuing?
Posted: August 21st, 2018, 11:26 am
---------------------------------------------------------------------------------------------
BEFORE READING BELOW, KNOW THESE FEW THINGS:
1. I know that this is different from the starting script that TH3D recommends - this is because I need it to activate specific tasks to prevent sensor interference.
2. I know that there are other ways to prevent signal interference (shielding and grounding cables, separating cables, etc). I'm not looking for alternatives really, just looking to get this script working correctly.
3. My ONLY goal here is to get the starting script to do exactly what I want it to do, regardless of my end goal on the mechanical side of things. I'd like to know what I'm doing wrong in the script.
4. Everything else works just fine. Auto-homes just fine, initiates G29 and creates mesh just fine, everything except for the below issue works fine.
Thanks in advance! Now read:
---------------------------------------------------------------------------------------------
Hey everyone,
I wasn't sure where to post GCode/scripting questions so if you know where, let me know.
I currently have a custom GCode starting script that controls my external heated bed and lighting through a raspberry pi running octoprint and connected to a relay board (to control the power to the LED's and Keenovo heated bed). I also have an EZABL installed so I'm using G29 command to probe the surface.
Anyway, what I'm trying to do is turn OFF the LED's and heated bed during the homing and probing processes (G28 and G29 respectively). What's actually happening is that it turns off the bed and LED's for just a split second and then turns them back on AND THEN does the G28 and G29 commands... it's like G28 and G29 are happening in a split second and it's not waiting for G28 and G29 to finish before turning the heated bed and LED's back on.
Here's my starting script:
NOTES:
ENC O1 S0 = Heated Bed off.
ENC O1 S1 = Heated Bed on
ENC O2 S0 = LEDs off.
ENC O2 S1 = LEDs on
_______________________________________________________________________________________
G28 ; Home all axes - this centersn the EZABL sensor in the middle of the bed.
ENC O1 S1 ; turn heated bed on
ENC O2 S1 ; Turn LEDs on
G4 S420 ; wait 7 minutes (this is when the top of the bed reaches the desired temperature)
M75 ; Start Print Timer and Engage Fil Sensor
M84 E ; Disable E Motor for probe accuracy on direct drive systems
ENC O1 S0 ; turn heated bed off
ENC O2 S0 ; Turn LEDs off
G28 ; home all axes
G28 Z ; home Z to get more accurate Z position
G29 ; EZABL mesh generation
ENC O1 S1 ; turn heated bed on --------------------------- THIS IS THE PART THAT'S NOT WORKING - it does not wait for G28, 29 to finish.
ENC O2 S1 ; Turn LEDs on --------------------------- THIS IS THE PART THAT'S NOT WORKING - it does not wait for G28, 29 to finish.
M500 ; create config-override
M106 S[fan_speed_pwm] ; Turn on cooling fan
M104 S[extruder0_temperature] T0 ; start heating nozzle
M109 S[extruder0_temperature] T0 ; wait for nozzle to reach desired temp.
M117 Purge extruder
G92 E0 ; reset extruder
G1 Z15.0 F200 ; move z up little
G1 X0.1 Y20 Z0.31 F5000.0 ; move to start-line position
G1 X0.1 Y100.0 Z0.31 F1000.0 E15 ; draw 1st line
G1 X0.4 Y100.0 Z0.31 F5000.0 ; move to side a little
G1 X0.4 Y20 Z0.31 F1000.0 E30 ; draw 2nd line
G92 E0 ; reset extruder
G1 Z2 F200 ; move z up little
M117 Printing.....
_______________________________________________________________________________________
Again, it's just not waiting for the autohome and bed leveling (probing) to finish before it turns the heated bed and LED's back on with ENC O1 S1 and ENC O2 S1 (respectively).
I'm sure I could put a timer after the G28 and G29 but... isn't there a way to tell it not to continue UNTIL G28 and G29 are finished?
SETUP INFO:
CR-10 S4 (running latest firmware from TH3D and on a CR-10S board with filament sensor and dual-z motors)
ENCLOSURE PLUGIN used to control relays.
BEFORE READING BELOW, KNOW THESE FEW THINGS:
1. I know that this is different from the starting script that TH3D recommends - this is because I need it to activate specific tasks to prevent sensor interference.
2. I know that there are other ways to prevent signal interference (shielding and grounding cables, separating cables, etc). I'm not looking for alternatives really, just looking to get this script working correctly.
3. My ONLY goal here is to get the starting script to do exactly what I want it to do, regardless of my end goal on the mechanical side of things. I'd like to know what I'm doing wrong in the script.
4. Everything else works just fine. Auto-homes just fine, initiates G29 and creates mesh just fine, everything except for the below issue works fine.
Thanks in advance! Now read:
---------------------------------------------------------------------------------------------
Hey everyone,
I wasn't sure where to post GCode/scripting questions so if you know where, let me know.
I currently have a custom GCode starting script that controls my external heated bed and lighting through a raspberry pi running octoprint and connected to a relay board (to control the power to the LED's and Keenovo heated bed). I also have an EZABL installed so I'm using G29 command to probe the surface.
Anyway, what I'm trying to do is turn OFF the LED's and heated bed during the homing and probing processes (G28 and G29 respectively). What's actually happening is that it turns off the bed and LED's for just a split second and then turns them back on AND THEN does the G28 and G29 commands... it's like G28 and G29 are happening in a split second and it's not waiting for G28 and G29 to finish before turning the heated bed and LED's back on.
Here's my starting script:
NOTES:
ENC O1 S0 = Heated Bed off.
ENC O1 S1 = Heated Bed on
ENC O2 S0 = LEDs off.
ENC O2 S1 = LEDs on
_______________________________________________________________________________________
G28 ; Home all axes - this centersn the EZABL sensor in the middle of the bed.
ENC O1 S1 ; turn heated bed on
ENC O2 S1 ; Turn LEDs on
G4 S420 ; wait 7 minutes (this is when the top of the bed reaches the desired temperature)
M75 ; Start Print Timer and Engage Fil Sensor
M84 E ; Disable E Motor for probe accuracy on direct drive systems
ENC O1 S0 ; turn heated bed off
ENC O2 S0 ; Turn LEDs off
G28 ; home all axes
G28 Z ; home Z to get more accurate Z position
G29 ; EZABL mesh generation
ENC O1 S1 ; turn heated bed on --------------------------- THIS IS THE PART THAT'S NOT WORKING - it does not wait for G28, 29 to finish.
ENC O2 S1 ; Turn LEDs on --------------------------- THIS IS THE PART THAT'S NOT WORKING - it does not wait for G28, 29 to finish.
M500 ; create config-override
M106 S[fan_speed_pwm] ; Turn on cooling fan
M104 S[extruder0_temperature] T0 ; start heating nozzle
M109 S[extruder0_temperature] T0 ; wait for nozzle to reach desired temp.
M117 Purge extruder
G92 E0 ; reset extruder
G1 Z15.0 F200 ; move z up little
G1 X0.1 Y20 Z0.31 F5000.0 ; move to start-line position
G1 X0.1 Y100.0 Z0.31 F1000.0 E15 ; draw 1st line
G1 X0.4 Y100.0 Z0.31 F5000.0 ; move to side a little
G1 X0.4 Y20 Z0.31 F1000.0 E30 ; draw 2nd line
G92 E0 ; reset extruder
G1 Z2 F200 ; move z up little
M117 Printing.....
_______________________________________________________________________________________
Again, it's just not waiting for the autohome and bed leveling (probing) to finish before it turns the heated bed and LED's back on with ENC O1 S1 and ENC O2 S1 (respectively).
I'm sure I could put a timer after the G28 and G29 but... isn't there a way to tell it not to continue UNTIL G28 and G29 are finished?
SETUP INFO:
CR-10 S4 (running latest firmware from TH3D and on a CR-10S board with filament sensor and dual-z motors)
ENCLOSURE PLUGIN used to control relays.