How do I configure Z-Probe Offset(s) for different nozzles?
-
How do I configure the Z-Probe offset(s) for different nozzles?
I'm using the BL Touch for z-axis homing, which is a problem because this means that the bed's 0 position along the z-axis is relative to the bed height.
When the leveling nuts or z-axis motors are used to adjust the bed offset to match the new nozzle, this is rendered undone when the z-axis is homed again... the new bed height will be seen as 0.
How does one go about solving this in an efficient and repeatable manner?
Device: Duet 3 6HC
-
@hunterschoonover
Are you just changing the nozzle in a single tool?
Or do you have two tools where the nozzles are different heights?
For the former, you need to adjust the G31 trigger height, not move the bed (unless there's a big difference).
For the latter you can adjust the tool offset
You can set up a macro to help quickly adjust the trigger offset on the BL Touch.
This is mine;Calibrate BL Touch ; Reprap firmware version 3.3b2 or later required! ; If macro is called using parameters these will be used in testing ; parameters which can be passed are ; T - Tool to use ; B - bed temperature to use ; R - Nozzle temperature to use (may be turned off before probing commences if configuerd to do so in config.g by M558 B1) ; P - probe number to use ; F - X/Y travel speed to use (in mm/sec) ; Z - Z travel speed to use ; S - Probe speed to use (in mm/sec) ; I - Number of times to probe (high and low value will be discarded) var NumTests = 10 ; modify this value to define default number of tests var travelSpeed = 3600 ; modify this value to define the default travel speed in mm/min var ZtravelSpeed = 360 ; modify this value to define default Z travel speed in mm/min (not probe speed) var probeSpeed = 60 ; modify this value to define default Z travel speed during probing in m/min var ProbePointX = (move.axes[0].min + move.axes[0].max)/2 ; modify to specify the X probe point. var ProbePointY = (move.axes[1].min + move.axes[1].max)/2 ; modify to specify the Y probe point. var ThisTool=0 ; default tool to use ; Do not change below this line if exists(param.T) set var.ThisTool=param.T var bedTemp = 0 ; default to not heating bed if exists(param.B) set var.bedTemp = param.B if !(var.bedTemp >=0) || (var.bedTemp > heat.heaters[heat.bedHeaters[0]].max) abort "invalid bed temp - test aborted" var nozzleTemp = 0 ; default to not heating nozzle if exists(param.R) if !exists(param.T) abort "Nozzle temp set, but no tool specified" set var.nozzleTemp = param.R if !(var.nozzleTemp >= 0) || (var.nozzleTemp > heat.heaters[tools[var.ThisTool].heaters[0]].max); validate temp abort "Invalid nozzle temp - test aborted" var probeNumber = 0 if exists(param.P) set var.probeNumber = param.P if (var.probeNumber > #sensors.probes - 1) || (var.probeNumber < 0) ; validate probe number echo "Invalid probe number (" ^ var.probeNumber ^ ") , test will be carried out using probe 0" set var.probeNumber = 0 if exists(param.I) if param.I<=2 abort "I parameter must be > 2 - Test aborted" else set var.NumTests = param.I if exists(param.F) set var.travelSpeed = param.F * 60 if exists(param.Z) set var.ZtravelSpeed = param.Z * 60 if exists(param.S) set var.probeSpeed = param.S * 60 if var.probeSpeed <=0 ; validate set var.probeSpeed = 60 ; set to 1mm/sec if invalid parameter passed ; if two speed probing is configured in M558,we probably want to reduce the speed for this test var ProbeSpeedHigh = sensors.probes[0].speeds[0] ; save currently configured speed for fast probe var ProbeSpeedLow = sensors.probes[0].speeds[1] ; save currently configured speed for slow probe ; validate probe speed if var.probeSpeed > var.ProbeSpeedLow var ErrorMsg = "Probe speed (" ^ var.probeSpeed ^ "mm/min) is set higher than defined in config.g (" ^ var.ProbeSpeedLow ^ "mm/min) Continue?" M291 S3 R"Warning" P{var.ErrorMsg} M558 F{var.probeSpeed} ; reduce probe speed for accuracy var RunningTotal=0 var Average=0 var Lowest=0 var Highest=0 if (var.nozzleTemp > 0) || (var.bedTemp > 0) if exists(param.T) if param.T > {#tools - 1} abort "Invalid T parameter - cannot be higher than " ^ {#tools - 1} T{var.ThisTool} ; select the tool passed else T0 ; default to T0 if (var.nozzleTemp > 0) M568 P{var.ThisTool} S{var.nozzleTemp} S{var.nozzleTemp} A2 ; set active temperatures for tool if (var.bedTemp > 0) M140 H0 S{var.bedTemp} if state.gpOut[0].pwm=0.03 ; check if probe is already deployed echo "Probe ia already deployed - retracting" M280 P0 S80 ; retract BLTouch G4 S0.5 if sensors.endstops[2].triggered ; check if probe is already triggered echo "Probe ia already triggered - resetting" M280 P0 S160 ; reset BL Touch G4 S0.5 if sensors.probes[0].value[0]=1000 ; check if probe is in error state echo "Probe in error state - resetting" M280 P0 S160 I1 ; reset BL Touch G4 S0.5 M280 P0 S80 ; retract BLTouch G4 S0.5 M561 ; clear any bed transform M290 R0 S0 ; clear babystepping ; If the printer hasn't been homed, home it if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28 else G1 Z{sensors.probes[0].diveHeight} F{var.ZtravelSpeed} ; if axes homed move to dive height M291 P{"Press OK to move to probe point X" ^ floor(var.ProbePointX) ^ " Y" ^ floor(var.ProbePointY)} R"Ready?" S3; ; move nozzle to defined probe point G1 X{var.ProbePointX} Y{var.ProbePointY} F{var.travelSpeed} if (var.nozzleTemp > 0) || (var.bedTemp > 0) echo "Waiting for temps to stabilise" M116 ; wait for temps M564 S0 H0 ; Allow movement beyond limits ;ensure you have room for the probe if move.axes[2].machinePosition < sensors.probes[0].diveHeight G1 Z{sensors.probes[0].diveHeight} F{var.ZtravelSpeed} ; Notify user to jog nozzle to start position M291 P"Jog nozzle to touch bed" R"Set nozzle to zero" S3 Z1 G92 Z0 ; set Z position to zero M291 P"Press OK to begin probing" R"Ready?" S3; ; Move probe over top of same point that nozzle was when zero was set G1 Z{sensors.probes[0].diveHeight} F{var.ZtravelSpeed}; lift head G1 X{move.axes[0].machinePosition - sensors.probes[0].offsets[0]} Y{move.axes[1].machinePosition - sensors.probes[0].offsets[1]} F{var.travelSpeed} echo "Current probe offset = " ^ sensors.probes[0].triggerHeight ^ "mm" ; carry out 10 probes (or what is set in NumTests variable) while iterations < var.NumTests G1 Z{sensors.probes[0].diveHeight} F{var.ZtravelSpeed}; move to dive height if state.gpOut[0].pwm=0.03 echo "Probe ia already deployed - retracting" M280 P0 S80 ; retract BLTouch G4 S0.5 if sensors.endstops[2].triggered echo "Probe ia already triggered - resetting" M280 P0 S160 ; reset BL Touch G4 S0.5 if sensors.probes[0].value[0]=1000 ; if probe is in error state echo "Probe in error state - resetting" M280 P0 S160 I1 ; reset BL Touch G4 S0.5 M280 P0 S80 ; retract BLTouch G4 S0.5 G30 S-1 ; do probe at current point M118 P2 S{"Test # " ^ (iterations+1) ^ " Triggered @ " ^ move.axes[2].machinePosition ^ "mm"} ; send trigger height to Paneldue console M118 P3 S{"Test # " ^ (iterations+1) ^ " Triggered @ " ^ move.axes[2].machinePosition ^ "mm"} ; send trigger height to DWC console if iterations == 0 set var.Lowest={move.axes[2].machinePosition} ; set the new lowest reading to first probe height set var.Highest={move.axes[2].machinePosition} ; set the new highest reading to first probe height if move.axes[2].machinePosition < var.Lowest set var.Lowest={move.axes[2].machinePosition} ; set the new lowest reading ;M118 P3 S{"new low reading = " ^ move.axes[2].machinePosition} ; send trigger height to DWC console G4 S0.3 if move.axes[2].machinePosition > var.Highest set var.Highest={move.axes[2].machinePosition} ; set the new highest reading ;M118 P3 S{"new high reading = " ^ move.axes[2].machinePosition} ; send trigger height to DWC console G4 S0.3 set var.RunningTotal={var.RunningTotal + move.axes[2].machinePosition} ; set new running total ;M118 P3 S{"running total = " ^ var.RunningTotal} ; send running total to DWC console G4 S0.5 set var.Average = {(var.RunningTotal - var.Highest - var.Lowest) / (var.NumTests - 2)} ; calculate the average after discarding the high & low reading ;M118 P3 S{"running total = " ^ var.RunningTotal} ; send running total to DWC console ;M118 P3 S{"low reading = " ^ var.Lowest} ; send low reading to DWC console ;M118 P3 S{"high reading = " ^ var.Highest} ; send high reading to DWC console M118 P2 S{"Average excluding high and low reading = " ^ var.Average} ; send average to PanelDue console M118 P3 S{"Average excluding high and low reading = " ^ var.Average} ; send average to DWC console ;suggest new G31 values echo "suggested edit for G31 in config.g if not saved to config-overide.g" echo "change G31 Z parameter from Z" ^ sensors.probes[0].triggerHeight ^ " to Z" ^ var.Average G31 P500 Z{var.Average} ; set Z probe offset to the average reading M564 S1 H1 ; Reset limits M558 F{var.ProbeSpeedHigh}:{var.ProbeSpeedLow} ; reset probe speed to original G1 Z{sensors.probes[0].diveHeight} F{var.ZtravelSpeed} ; move head back to dive height if var.bedTemp > 0 M140 R0 S0 ; set bed to zero M140 S-276 ; turn off bed if (var.nozzleTemp > 0) && (state.currentTool >-1) M568 R0 S0 ; set heater to zero M568 A0 ; turn off heater on current tool M291 P{"Trigger height set to : " ^ sensors.probes[0].triggerHeight ^ "mm. Press OK to save to config-overide.g, cancel to use until next restart"} R"Finished" S3 M500 P31 ; optionally save result to config-overide.g M291 P{"Reload config.g to restore defaults?"} R"Restore?" S3 M98 P"0:/sys/config.g"
-
You're the man.
I was able to implement your code with very few changes. Your help is much appreciated!
Currently, there is one command that is not supported on my device, but I haven't narrowed down which one it is yet... the error output to console doesn't specify the command that's failing. I'll post updated code for others that need it after I resolve the issue.
It's currently working and has led to several successful prints. Thanks Owen!
-
What firmware version are you using? Please send M122 in the gcode console and copy and paste here. You might also find the error message in the console window.
-
@Phaedrux said in How do I configure Z-Probe Offset(s) for different nozzles?:
What firmware version are you using? Please send M122 in the gcode console and copy and paste here. You might also find the error message in the console window.
=== Diagnostics ===
RepRapFirmware for Duet 3 MB6HC version 3.4.0 (2022-03-15 18:57:24) running on Duet 3 MB6HC v1.01 or later (standalone mode)
Board ID: 08DJM-956BA-NA3TN-6J9D4-3SJ6Q-KV8LU
Used output buffers: 3 of 40 (14 max)
=== RTOS ===
Static ram: 151000
Dynamic ram: 97052 of which 44 recycled
Never used RAM 99240, free system stack 134 words
Tasks: NETWORK(ready,67.9%,175) ETHERNET(notifyWait,2.3%,170) HEAT(notifyWait,1.3%,321) Move(notifyWait,34.6%,248) CanReceiv(notifyWait,0.0%,944) CanSender(notifyWait,0.0%,356) CanClock(delaying,0.6%,333) TMC(notifyWait,55.2%,58) MAIN(running,152.0%,1083) IDLE(ready,0.7%,30), total 314.5%
Owned mutexes: HTTP(MAIN)
=== Platform ===
Last reset 43:41:28 ago, cause: power up
Last software reset at 2023-01-08 23:36, reason: User, GCodes spinning, available RAM 100284, slot 1
Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0044a000 BFAR 0x00000000 SP 0x00000000 Task MAIN Freestk 0 n/a
Error status: 0x00
Step timer max interval 176
MCU temperature: min 34.1, current 43.9, max 45.0
Supply voltage: min 22.9, current 23.4, max 24.3, under voltage events: 0, over voltage events: 0, power good: yes
12V rail voltage: min 11.9, current 12.0, max 12.1, under voltage events: 0
Heap OK, handles allocated/used 99/1, heap memory allocated/used/recyclable 2048/706/692, gc cycles 2
Events: 0 queued, 0 completed
Driver 0: ok, SG min 0, mspos 858, reads 55503, writes 60 timeouts 0
Driver 1: standstill, SG min 0, mspos 392, reads 55507, writes 56 timeouts 0
Driver 2: standstill, SG min 0, mspos 632, reads 55495, writes 68 timeouts 0
Driver 3: standstill, SG min 0, mspos 632, reads 55495, writes 68 timeouts 0
Driver 4: ok, SG min 0, mspos 304, reads 55515, writes 48 timeouts 0
Driver 5: standstill, SG min 0, mspos 8, reads 55553, writes 11 timeouts 0
Date/time: 2023-01-16 19:22:31
Slowest loop: 345.50ms; fastest: 0.04ms
=== Storage ===
Free file entries: 9
SD card 0 detected, interface speed: 25.0MBytes/sec
SD card longest read time 3.9ms, write time 3.7ms, max retries 0
=== Move ===
DMs created 125, segments created 20, maxWait 62800492ms, bed compensation in use: mesh, comp offset 0.000
=== MainDDARing ===
Scheduled moves 711, completed 705, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 36], CDDA state 3
=== AuxDDARing ===
Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
=== Heat ===
Bed heaters 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0
Heater 0 is on, I-accum = 0.3
Heater 1 is on, I-accum = 0.9
=== GCodes ===
Segments left: 1
Movement lock held by null
HTTP is ready with "M122 " in state(s) 0
Telnet is idle in state(s) 0
File is doing "G1 X197.007 Y189.339 E4.4092" in state(s) 0
USB is idle in state(s) 0
Aux is idle in state(s) 0
Trigger is idle in state(s) 0
Queue is idle in state(s) 0
LCD is idle in state(s) 0
SBC is idle in state(s) 0
Daemon is idle in state(s) 0
Aux2 is idle in state(s) 0
Autopause is idle in state(s) 0
Code queue is empty
=== CAN ===
Messages queued 1415591, received 0, lost 0, boc 0
Longest wait 0ms for reply type 0, peak Tx sync delay 0, free buffers 50 (min 50), ts 786441/0/0
Tx timeouts 0,0,786440,0,0,629149 last cancelled message type 30 dest 127
=== Network ===
Slowest loop: 4829.05ms; fastest: 0.02ms
Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0), 0 sessions Telnet(0), 0 sessions
HTTP sessions: 1 of 8- Ethernet -
State: active
Error counts: 0 0 1 0 0
Socket states: 5 2 2 2 2 0 0 0
- Ethernet -
-
The error message I get at after the macro finishes is:
M292 Warning: M918: Command is not supported
However, I don't see anywhere in the macro that M292 and M918 are used...?
-
@hunterschoonover
M292 is returned when a message box is closed, so the firmware is logging that.
M918 says
This command is used to tell RepRapFirmware about a directly-connected LCD such as a 12864 or compatible display. Supported on Duet 2 Maestro.Check all your configuration files and macros. Maybe you have a typo in there that's trying to call M918?
-
@hunterschoonover said in How do I configure Z-Probe Offset(s) for different nozzles?:
Duet 3 MB6HC version 3.4.0
It also wouldn't hurt to update your firmware by uploading this zip file to the system tab in DWC.
https://github.com/Duet3D/RepRapFirmware/releases/download/3.4.5/Duet2and3Firmware-3.4.5.zip