3.5.0b1+ don't wait for commands to finish before moving on
-
@dc42 Sorry, i managed to leave that out
🤦♂️
Duet 3 Mini in standalone..
-
This post is deleted! -
@Exerqtor thank. Please post the contents of print_tram.g.
-
; /sys/lib/print/print_tram.g v1.0 ; Called by start.g ; Used to tram the bed before a print starts echo "print_tram.g start" ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Prep phase ; ==================== M561 ; Clear any bed transform M290 R0 S0 ; Reset baby stepping M84 E0 ; Disable extruder stepper ; Lower XY currents if fileexists("/sys/lib/current/xy_current_low.g") M98 P"/sys/lib/current/xy_current_low.g" ; Set low XY currents else M913 X40 Y40 ; Set X Y motors to 40% of their max current ; Lower Z currents if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to 60% of their max current ; Homing check if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed ; If X & Y axes aren't homed echo "All axes aren't homed, aborting!" abort if move.axes[2].userPosition < {global.Nozzle_CL} ; If Z is less than global.Nozzle_CL G1 Z{global.Nozzle_CL} F9000 ; Move to Z global.Nozzle_CL ; ====================--------------------------------------------------------- ; Check if bed is trammed ; ==================== ; If the bed isn't trammed if !exists(global.bed_trammed) echo "global.bed_trammed missing, aborting!" abort elif global.bed_trammed = false ; LED status if exists(global.sb_leds) set global.sb_leds = "tramming" ; StealthBurner LED status ; Report whats going on M291 R"Bed tramming" P"Please wait..." T10 ; Tramming bed message ; ====================------------------------------------------------------- ; Tramming code ; ==================== ; Lower XY currents if fileexists("/sys/lib/current/xy_current_low.g") M98 P"/sys/lib/current/xy_current_low.g" ; Set low XY currents else M913 X40 Y40 ; Set X Y motors to 40% of their max current ; Lower Z currents if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to 60% of their max current ; Coarse tramming pass M558 K0 H10 F300 A1 ; Increase the depth range, gets the bed mostly trammed immediately M98 P"/sys/bed_probe_points.g" ; Probe the bed ; Probe the bed while true ; Probe near lead screws M558 K0 H2 F300:180 A3 ; Reduce depth range, probe slower for better repeatability M98 P"/sys/bed_probe_points.g" ; Probe the bed ; Check results - exit loop if results are good if move.calibration.initial.deviation < 0.02 ; If probing result is less than 0.02mm set global.bed_trammed = true ; Set global state break ; Stop probing ; Check pass limit - abort if pass limit reached if iterations = 5 ; If probed more than 5 times M291 P"Bed tramming aborted" R"Pass Limit Reached" ; Abort probing, something wrong set global.bed_trammed = false ; Set global state abort "Bed tramming aborted - Pass Limit Reached" ; Abort probing, something wrong ; ====================------------------------------------------------------- ; Finish up ; ==================== ; Uncomment the following lines to lower Z(bed) after probing G90 ; Absolute positioning G1 Z{global.Nozzle_CL} F2400 ; Move to Z global.Nozzle_CL ; Home Z ; Move to bed center and home Z M98 P"/sys/lib/goto/bed_center.g" ; Move to bed center G30 K0 Z-99999 ; Probe the center of the bed M400 ; Wait for moves to finish M291 R"Bed tramming" P"Done" T5 ; Bed tramming done message else ; ==================== ; Response if trammed ; ==================== ; Bed already trammed M291 S1 R"Bed tramming" P"Bed allready trammed" T4 ; Full currents if fileexists("/sys/lib/current/xy_current_high.g") M98 P"/sys/lib/current/xy_current_high.g" ; Set high XY currents else M913 X100 Y100 ; Set X Y motors to var.100% of their max current if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Set high Z currents else M913 Z100 ; Set Z motors to var.100% of their max current ; Uncomment the following lines to lower Z(bed) after probing G90 ; Absolute positioning G1 Z{global.Nozzle_CL} F2400 ; Move to Z global.Nozzle_CL ; If using Voron TAP, report that probing is completed if exists(global.TAPPING) set global.TAPPING = false M402 P0 ; Return the hotend to the temperature it had before probing echo "print_tram.g end"
-
It's for sure something off at least, even with the homing check in
print_tram.g
it didn't actually abort the sequence, as you can see it kept going and trammed the bed😂
. ( Refering to the console printout in the post above)I removed the the homing check in
print_tram.g
to see how things played out (since it's strictly not needed anyways). And it just steamrolls through the whole macro set without letting anything finish before moving along.Here's what it did with that homing check removed:
7.1.2023, 10:56:16 print_tram.g start print_tram.g end start.g end 7.1.2023, 10:55:57 print_tram.g end start.g end print_start.g start Error: No P or R parameter print_purge.g start Error: in file macro line 41 column 52: meta command: unknown variable 'x_origin' Cancelled printing file 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode, print time was 0h 0m 7.1.2023, 10:55:56 M32 "0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode" File 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode selected for printing start.g start start.g start print_tram.g start
print_start.g
:; /sys/lib/print/print_start.g v2.0 ; Called when starting a print (after start.g) at the end of your slicers start code ; Used to configure print parameters echo "print_start.g start" M140 S{global.bed_temp} ; Set bed temperature if exists(global.sb_leds) set global.sb_leds = "heating" ; StealthBurner LED status M116 H0 S5 ; Wait for the bed to reach its temperature +/-5�C M98 "/sys/lib/print/print_probe.g/" ; Pre print mesh macro, if it will probe a mesh or not i controlled by global.Print_Probe(true=on, false=off) and select a mesh accordinlgy M376 H5 ; Set bed compensation taper to 5mm G10 P{global.initial_extruder} R{global.hotend_temp} S{global.hotend_temp} ; Set active and standby temps for the initial tool if exists(global.sb_leds) set global.sb_leds = "heating" ; StealthBurner LED status M116 H1 ; Wait hotend to reach it's temperature M42 P0 S0.3 ; Turn on chamber lights to 30% G0 Z{(global.first_layer_height + 5)} F3000 ; Drop bed to first layer height + 5mm to reduce pucker factor M98 P"/sys/lib/print/print_purge.g" ; Purge the nozzle before starting print M400 ; Wait for moves to finish if exists(global.sb_leds) set global.sb_leds = "printing" ; StealthBurner LED status if exists(global.RunDaemon) set global.RunDaemon = false ; Disable daemon.g while printing because of bug in RRF 3.5.0b1+ echo "print_start.g end"
It looks like it totally overlooks
print_probe.g
, since those echo's didn't show up at all:; /sys/print/print_probe.g v2.0 ; Called when "M98 P"/sys/lib/print/print_probe.g" is sent ; Used to determine if you want to probe a new bed mesh at the start of a print echo "print_probe.g start" ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ;-------------------------------------------------------------------------------------------------------------------------------------- ; This macro checks if global.Print_Probe is declared, true(enabled) or false(disalbed) ; Based on global.Print_Probe and outcome of the deviation calculation it will either proceed to probe a adaptive mesh, or start the print with default mesh ;-------------------------------------------------------------------------------------------------------------------------------------- ; ====================--------------------------------------------------------- ; Do the checks ; ==================== ; Check if global.Print_Probe is defined if exists(global.Print_Probe) if global.Print_Probe if fileexists("/sys/lib/a_mesh.g") M291 P"Pre-print mesh probing enabled, probing new bed mesh!" T4 ; Display message about what's going to happen M98 P"/sys/lib/a_mesh.g" else echo "a_mesh.g missing, aborting!" abort else M291 P"Pre-print mesh probing disabed, using default mesh!" T4 ; Display message about what's going to happen G29 S1 P"default_heightmap.csv" ; Load height map file "full_heightmap.csv" and enable mesh bed compensation else echo "global.Print_Probe not defined" M291 P"Pre-print mesh probing failed, using default mesh!" T4 ; Display message about what's going to happen G29 S1 P"default_heightmap.csv" ; Load height map file "full_heightmap.csv" and enable mesh bed compensation echo "print_probe.g end"
print_purge.g
:; /sys/lib/print/print_purge.g v2.1 ; Called when "M98 P"/sys/lib/print/print_purge.g" is sent ; Used to purge the nozzle before a print echo "print_purge.g start" ; ====================--------------------------------------------------------- ; Settings section ; ==================== var prime_dist = 10 ; Distance from filament to nozzle before purging, this will require some tuning! ;This will be overwritten if you have global.unload_length defined! var z_height = 0.4 ; Height above the bed to purge var purge_amount = 20 ; Amount of filament to purge var flow_rate = 10 ; Desired flow rate in mm3/s var x_default = 5 ; X location to purge, overwritten if adaptive is True var y_default = 5 ; Y location to purge, overwritten if adaptive is True var size = 10 ; Size of the logo in mm var distance_to_object_x = 15 ; Distance in x to the print area var distance_to_object_y = 0 ; Distance in y to the print area var travel_speed = 300 ; Travel speed ; Don't touch anyting beyond this point(unless you know what you're doing)!! ; ====================--------------------------------------------------------- ; Prep phase ; ==================== if exists(global.unload_length) set var.prime_dist = {global.unload_length + 1} if global.paMinX = 0 var x_origin = var.x_default var y_origin = var.y_default elif global.paMinX >= 1 var x_origin = {global.paMinX - var.distance_to_object_x - var.size} var y_origin = {global.paMinY - var.distance_to_object_y - var.size} var prepurge_speed = (var.flow_rate / 2.405) var purge_move_speed = {2.31 * var.size * var.flow_rate / (var.purge_amount * 2.405)} ; Generate message var msg = "Purge location, X min: " ^ var.x_origin ^ "; Y min: " ^ var.y_origin ^ "; Purge move speed: " ^ var.purge_move_speed ^ "; Prepurge speed: " ^ var.prepurge_speed ; Info message M291 P{var.msg} T6 ; ====================--------------------------------------------------------- ; Purging code ; ==================== ; LED status if exists(global.sb_leds) set global.sb_leds = "cleaning" ; StealthBurner LED status G92 E0 G0 F{var.travel_speed * 60} ; Set travel speed G90 ; Absolute positioning G0 X{var.x_origin} Y{var.y_origin + var.size / 2} ; Move to purge position G0 Z{var.z_height} ; Move to purge Z height M83 ; Relative extrusion mode G1 E{var.prime_dist} F{var.prepurge_speed * 60} ; Move tip of filament to nozzle ; Purge first line of logo G1 X{var.x_origin + var.size * 0.289} Y{var.y_origin + var.size} E{var.purge_amount / 4} F{var.purge_move_speed * 60} G1 E-.5 F2100 ; Retract G0 Z{var.z_height * 2} ; Z hop G0 X{var.x_origin + var.size * 0.789} Y{var.y_origin + var.size} ; Move to second purge line origin G0 Z{var.z_height} ; Move to purge Z height G1 E.5 F2100 ; Recover ; Purge second line of logo G1 X{var.x_origin + var.size * 0.211} Y{var.y_origin} E{var.purge_amount / 2} F{var.purge_move_speed * 60} G1 E-.5 F2100 ; Retract G0 Z{var.z_height * 2} ; Z hop G0 X{var.x_origin + var.size * 0.711} Y{var.y_origin} ; Move to third purge line origin G0 Z{var.z_height} ; Move to purge Z height G1 E.5 F2100 ; Recover ; Purge third line of logo G1 X{var.x_origin + var.size} Y{var.y_origin + var.size / 2} E{var.purge_amount / 4} F{var.purge_move_speed * 60} G1 E-.5 F2100 ; Retract G92 E0 ; Reset extruder distance G0 Z{var.z_height * 2} ; Z hop M400 ; Wait for moves to finish echo "print_purge.g end"
-
@Exerqtor What are you doing to start this process? Are you starting a print? If so can you post the gcode. For some reason your start.g file seems to be running more than once...
File 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode selected for printing start.g start start.g start
and
start.g end 7.1.2023, 10:55:57 print_tram.g end start.g end
-
@gloomyandy
Yeah I'm simply selecting to print it in DWC or PD🤷♂️
Things showing up twice in DWC has happened since 3.4.5 (at least), first saw it when i started making some sensorless homing macros that i spread echos everywhere to debugging. But in 3.4.5 the second instance of an echo came up as a
M292
message in console if my memory serves me right. -
@Exerqtor Do you have anything in Daemon.g?
-
@gloomyandy
Yup!
daemon.g
:; /sys/daemon.g v1.1 ; Used to execute regular tasks, the firmware executes it and once the end of file is reached it waits. If the file is not found it waits and then looks for it again. ; Loop, to be able to turn on/off daemon.g while global.RunDaemon ; Stuff goes here ; Refresh chamber lights status if state.gpOut[0].pwm = 0 set global.chamber_leds = "off" elif state.gpOut[0].pwm > 0 set global.chamber_leds = state.gpOut[0].pwm * 100 ;Refresh stealthburner led status M98 P"/sys/lib/led/sb_leds-state.g" ; Check if global.sb_leds has changed since last run/loop ; ----------------- ; Daemon loop delay G4 S1
sb_leds-state.g
:; /sys/lib/led/sb_leds-state.g v1.0 ; Created by sb_leds.g to store the current/active LED colors ; Called by daemon.g to check if global.sb_leds status has changed since last run var sb_leds = "ready" if var.sb_leds = global.sb_leds ; Same status, do nothing else ; New status, change colors M98 P"/sys/lib/led/sb_leds.g"
-
@Exerqtor
Andsb-leds.g
:; Logo LED M150 R{var.l_r} U{var.l_u} B{var.l_b} W{var.l_w} S1 F1 ; Nozzle LEDs M150 R{var.n_r} U{var.n_u} B{var.n_b} W{var.n_w} S2 ; Create or ovewrite sb_leds-state.g with the new status echo >"/sys/lib/led/sb_leds-state.g" "; /sys/lib/led/sb_leds-state.g v1.0" ; create/overwrite file echo >>"/sys/lib/led/sb_leds-state.g" "; Created by sb_leds.g to store the current/active LED colors " ; save line to sb_leds-state echo >>"/sys/lib/led/sb_leds-state.g" "; Called by daemon.g to check if global.sb_leds status has changed since last run" ; save line to sb_leds-state echo >>"/sys/lib/led/sb_leds-state.g" echo >>"/sys/lib/led/sb_leds-state.g" "var sb_leds = "^ """"^{global.sb_leds}^"""" ; save line to sb_leds-state echo >>"/sys/lib/led/sb_leds-state.g" echo >>"/sys/lib/led/sb_leds-state.g" "if var.sb_leds = global.sb_leds" echo >>"/sys/lib/led/sb_leds-state.g" " ; Same status, do nothing" echo >>"/sys/lib/led/sb_leds-state.g" "else" echo >>"/sys/lib/led/sb_leds-state.g" " ; New status, change colors" echo >>"/sys/lib/led/sb_leds-state.g" " M98 P""/sys/lib/led/sb_leds.g"""
-
@Exerqtor If it is easy for you to do could you disable the Daemon.g stuff and run the print again.I suspect that it has nothing to do with the problem, but it cuts down the complexity for trying to reproduce things.
-
@gloomyandy
I can disable the loop inside of it by setting the global to false?It's nothing mission critical going on in it anyways, so I can just remove
daemon.g
entierly just for the sake of experimenting.I'm not at home now though so I can't test it STAT, but I'll do it once I get home.
-
@gloomyandy said in 3.5.0b1+ don't wait for commands to finish before moving on:
@Exerqtor If it is easy for you to do could you disable the Daemon.g stuff and run the print again.I suspect that it has nothing to do with the problem, but it cuts down the complexity for trying to reproduce things.
This is what spews out with
global.RunDaemon=false
/daemon.g
disabled:7.1.2023, 15:26:49 M292 S10 Error: M292: no active message box 7.1.2023, 15:26:46 print_tram.g start print_tram.g end start.g end 7.1.2023, 15:26:27 print_tram.g start print_tram.g end start.g end print_start.g start Error: No P or R parameter print_purge.g start Error: in file macro line 41 column 52: meta command: unknown variable 'x_origin' Cancelled printing file 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode, print time was 0h 0m 7.1.2023, 15:26:26 M32 "0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode" File 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode selected for printing start.g start start.g start
And with
daemon.g
removed from0:/sys/
:7.1.2023, 15:31:25 M292 S13 Error: M292: no active message box 7.1.2023, 15:31:21 print_tram.g start print_tram.g end start.g end 7.1.2023, 15:31:02 print_tram.g start print_tram.g end start.g end print_start.g start Error: No P or R parameter print_purge.g start Error: in file macro line 41 column 52: meta command: unknown variable 'x_origin' Cancelled printing file 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode, print time was 0h 0m 7.1.2023, 15:31:01 M32 "0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode" File 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode selected for printing start.g start start.g start
The "Error: in file macro line 41 column 52: meta command: unknown variable 'x_origin'" stems from
print_purge.g
, most likely because the global variables that gets parsed with the sliced print data for the max/min print coordinates haven't really been run yet since there obviously part of the start gcode from the slicer. But when everything has stopped moving (homing moves stoped) and i check out the object model browser the coordinates have been parsed correctly.So something is getting ahead of itself for some reason, almost like DWC reads thru the whole damn thing before RRF has actually had a chance to execute the commands "irl". But if it was a DWC problem the issue shouldn't manifest if i start a print from PD? Or is DWC handeling stuff in the background no matter whats being done?
-
@Exerqtor what I suspect is happening is that some commands - in particular, echo commands - are being executed by both file readers instead of by just one. It's normal for the second file reader to get ahead because in a "normal" print, the second motion system isn't used so the second file reader has nothing to do.
Apart from echo commands, which other commands are getting executed earlier than you expect?
-
@dc42
Ok, what order things get displayed really don't bother me as long as it works irl.Uhm where should I start, nothing get's executed as I expect it to at this point
😂
.I "want/think" this should happen:
- 1
start.g
gets called because i initialize a print. - 2
start.g
executes the codes in order from "line 1" downwards, with the first "visual" thing being that the the active bed temp changes to 65°C and starts heating up. - 3 Then continuing downwards, changing the toolhead lights, promting the
Print Started. Preheating and Homing
message for 10seconds (while in the background continuing to execute the code) until it gets toM190 S65
where it waits for the bed to reach 65°C. - 4 When the bed has reached 65°C it homes all the axis BEFORE, continuing to execute
print_tram.g
. - 5
print_tram.g
does it's thing, and that's the end ofstart.g
, so now it moves on the execute the actual sliced/job file. - 6 Runs the code in the sliced/job file from "line 1" downwards:
M107 M190 S110 ; set bed temperature and wait for it to be reached G10 S255 P0 ; set temperature ;TYPE:Custom ; Start G-code: START ; Inform of first layer height set global.first_layer_height = 0.2 ; Define print area set global.paMinX = 162.5 set global.paMaxX = 187.5 set global.paMinY = 162.5 set global.paMaxY = 187.5 ; Set temps & the initial extruder set global.bed_temp = 110 set global.hotend_temp = 255 set global.initial_extruder = 0 M83 ; use relative distances for extrusion
- 7 After executing
M83
it moves on to callingprint_start.g
. - 8
print_start.g
goes from "line 1" downwards, with first visual change being active bed temp changing to 110°C and it's starts heating up. - 9 The toolhead lights changes back to "heating-colors" and then
M116 H0 S5
get's executed, and everythings waits for the bed to reach 105°C before continuing. - 10 Bed temp has reached 105°C and
print_probe.g
gets called (for the sake of not writing a whole novel that does it things and we return to the next line ofprint_start.g
). - 11 Changes bed compensation taper in the background, then we see T0 active and standby temps change to 255°C and starts heating up.
- 12 The toolhead lights changes back to "heating-colors" again, and it executes
M116 H1
, so we wait for T0 to reach 255°C. - 13 T0 reaches 255°C, the chamber lights turn on, bed drops a tiny bit and
print_purge.g
gets called. - 14
print_purge.g
does it's thing and lays down the purge lines and the toolhead lights changes to "printing-colors". - 15
global.RunDaemon
changes tofalse
("turning off"daemon.g
) finishing ofprint_start.g
. - 16 We return to the sliced/job file and so on and so forth....
- 1
-
@Exerqtor thanks. What actually happens too soon, other than spurious output from echo commands? Do you see any motion before the bed has finished heating to 65C, or any other motion that happens too early ?
-
EDIT
Cleaned up the post.@dc42
It doesn't wait for the bed to reach 65°C even!😂😂
What happens is:- 1)
start.g
gets called because i initialize a print. - 2 Active bed temp changes to 65°C and
Print Started. Preheating and Homing
message gets displayed. - 3 Immediately while the message is displayed the active and standby hotend temps to 80°C and starts to home the axis.
- 4 The same millisecond the axis start to home it displays the "Response too long, see Console
- 5 It turns ONLY the hotend standby temp too 150°C while the homing sequence finish up.
- 6 I get the
M291 S1 R"Bed tramming" P"Bed allready trammed" T4
fromprint_tram.g
DESPITEglobal.bed_trammed
beingfalse
when i started the print. - 7 Then nothing more happens, both bed & hotend heaters gets turned off all movement stops, like the machine is in "limbo" (if I look at the DWC temp chart it's no visible changes in temps).
- 8 Switching over to DWC console this is what I see:
7.1.2023, 18:42:16 print_tram.g start print_tram.g end start.g end 7.1.2023, 18:41:57 print_tram.g start print_tram.g end start.g end Start G-code: START print_start.g start Error: No P or R parameter print_purge.g start Error: in file macro line 41 column 52: meta command: unknown variable 'x_origin' Cancelled printing file 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode, print time was 0h 0m 7.1.2023, 18:41:56 M32 "0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode" File 0:/gcodes/Shape-Box_0.2mm_ABS_0.4n_5m.gcode selected for printing start.g start start.g start
This all happens so fast that either the bed OR hotend (E3D Revo 24v, so it's quite responsive) have any visible change in the temp chart.
The 80°C hotend temp part is something I'm going to remove, but it's a good thing that I forgot to remove that step since it highlights the fact that only the standby temp gets upped to 150°C when
G10 P0 S150 R150
is executed. - 1)
-
I must also add that:
When I check the object model browser after what happens above. All the globals have been parsed with the values from the sliced/job file like intended. AND
global.bed_trammed
has changed fromfalse
totrue
despite the no tramming has been performed.For referance this is how
bed.g
looks, and it works just like intended when i run it:; bed.g v2.1 ; Called as response to G32 ; Used to tram the bed ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Question code ; ==================== ; Ask to make sure you want to tram the bed or not if !exists(global.bed_trammed) echo "global.bed_trammed missing, aborting! abort elif global.bed_trammed M291 S3 R"Bed tramming" P"The bed is allready trammed, want to tram it again?" else M291 S3 R"Bed tramming" P"Are you sure you want to tram the bed?" ; ====================--------------------------------------------------------- ; Prep phase ; ==================== ; LED status if exists(global.sb_leds) set global.sb_leds = "homing" ; Report whats going on M291 R"Bed tramming" P"Please wait..." T0 ; Tramming bed message M561 ; Clear any bed transform M290 R0 S0 ; Reset baby stepping M84 E0 ; Disable extruder stepper ; Lower Z currents if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to 60% of their max current ; ====================--------------------------------------------------------- ; Lower Z axis ; ==================== ; Lower Z relative to current position if needed if !move.axes[2].homed ; If Z ain't homed G91 ; Relative positioning G1 Z{global.Nozzle_CL} F9000 H1 ; Lower Z(bed) relative to current position G90 ; Absolute positioning elif move.axes[2].userPosition < {global.Nozzle_CL} ; If Z is homed and less than global.Nozzle_CL G1 Z{global.Nozzle_CL} F9000 ; Move to Z global.Nozzle_CL ; ====================--------------------------------------------------------- ; Homing check ; ==================== ; Make sure all axes are homed, and home Z again anyways if !move.axes[0].homed || !move.axes[1].homed ; If X & Y axes aren't homed ; Home X & Y axis M98 P"/sys/homex.g" Z A ; Home X axis, pass param.Z since we allready lowered Z & A to indicate this is part of a homing sequence M98 P"/sys/homey.g" Z C ; Home Y axis, pass param.Z since we allready lowered Z & C since XY currents/speeds are also ok ; ==================== ; Home Z axis ; ==================== M98 P"/sys/homez.g" Z A ; Home Z axis, pass param.Z since we allready lowered Z & A to indicate this is part of a homing sequence ; ====================--------------------------------------------------------- ; Tramming code ; ==================== ; LED status if exists(global.sb_leds) set global.sb_leds = "tramming" ; Coarse tramming pass M558 K0 H10 F300 A1 ; Increase the depth range, gets the bed mostly trammed immediately M98 P"/sys/bed_probe_points.g" ; Probe the bed ; Fine tramming pass while true ; Probe near lead screws - M558 K0 H2 F300:180 A3 ; Reduce depth range, probe slower for better repeatability M98 P"/sys/bed_probe_points.g" ; Probe the bed ; Check results - exit loop if results are good if move.calibration.initial.deviation < 0.02 ; If probing result is less than 0.02mm set global.bed_trammed = true ; Set global state break ; Stop probing ; Check pass limit - abort if pass limit reached if iterations = 5 ; If probed more than 5 times M291 P"Bed tramming aborted!" R"Pass Limit Reached!" ; Abort probing, something wrong set global.bed_trammed = false ; Set global state abort "Bed tramming aborted! - Pass Limit Reached!" ; Abort probing, something wrong ; ====================--------------------------------------------------------- ; Finish up ; ==================== ; Uncomment the following lines to lower Z(bed) after probing G90 ; Absolute positioning G1 Z{global.Nozzle_CL} F2400 ; Move to Z global.Nozzle_CL ; Home Z one last time now that the bed is trammed M98 P"/sys/lib/goto/bed_center.g" ; Move to bed center G30 K0 Z-99999 ; Probe the center of the bed M400 ; Wait for moves to finish ; Full currents if fileexists("/sys/lib/current/xy_current_high.g") M98 P"/sys/lib/current/xy_current_high.g" ; Set high XY currents else M913 X100 Y100 ; Set X Y motors to var.100% of their max current if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Set high Z currents else M913 Z100 ; Set Z motors to var.100% of their max current ; Uncomment the following lines to lower Z(bed) after probing G90 ; Absolute positioning G1 Z5 F2400 ; Move to Z 10 M291 R"Bed tramming" P"Done" T5 ; Bed tramming done message ; If using Voron TAP, report that probing is completed if exists(global.TAPPING) set global.TAPPING = false M402 P0 ; Return the hotend to the temperature it had before probing ; LED status if exists(global.sb_leds) set global.sb_leds = "ready"
As you can see it's more or less functionally the same as
print_tram.g
, except some question and homing steps inbed.g
. But the check to see if the bed is allready trammed works like intended and is carried out in the same manner inprint_tram.g
. -
Anyone else with 3.5.0b1+ thats willing to try recreating this issue?
Shouldn't be anything super exotic that needs to be changed to try this out on other machines
😅
I've looked to the code so many times now I'm sure I wouldn't find a fault if it jumped at me lol
-
@Exerqtor what's happening is that there are now two GCode File channels used to process print files, one for each motion system. Normally, only the first one of them executes commands. The other typically reaches end of file or the M0 command if there is one, and waits for the first to catch up.
What I hadn't allowed for is that both File channels will execute GCode meta commands such as echo, and set. This is why you are seeing some echo commands being executed ahead of time, and why global.bed_trammed is being set to true.
I propose to change the behaviour as follows, which I hope will resolve this for you:
- Only execute echo, global and set global commands commands from the File channel that is currently selected.
When either channel reaches a command that involves waiting for temperatures to be reached, add a sync point there so that both File channels wait. no, that would not be appropriate e.g. when changing tools and waiting for a hot end to heat.