Triggers within homing files
-
What are the mechanics, and what is the Goal?
-
I'm running prusa's mmu2 on a cartesian printer with the duet. The goal is to disallow the homing of the selector axis if filament is fed through the selector.
First M581 command will home the axis if the filament is not detected, the second M581 will hide the mmu axes and send the message.
-
Got it. Thank you.
Have you seen the new RRF3 conditional gcode? I believe it would be perfect for this.
-
Yes, that's the ultimate goal but it will be a steep learning curve for me. Last time I checked I couldn't find anything related to endstops states.
-
Fair point, it is very early in the release of conditionals.
The endstops will (should?) be in the object model. I don't have a machine accessible right now, but I believe they are down the "machine" > "sensors" part of the tree.
-
I can't see any machine part of the tree. I might be doing it wrong, I'm just running M409 in DWC and paste the return here .
-
M409 F"V" will get a much larger result.
-
No luck either,
M409 F"v"
returns:{"key":"","flags":"V","result":{"boards":[{"firmwareFileName":"Duet2CombinedFirmware.bin","firmwareVersion":"3.01-beta1+1","iapFileNameSD":"Duet2CombinedIAP.bin","mcuTemp":{"current":43.0,"max":43.4,"min":42.2},"name":"Duet 2 WiFi","shortName":"2WiFi","vIn":{"current":24.2,"max":24.3,"min":24.1}}],"heat":{"coldExtrudeTemperature":160.0,"coldRetractTemperature":90.0,"heaters":[{"current":25.0,"sensor":0,"state":"Off"},{"current":25.0,"sensor":1,"state":"Off"}],"sensors":[{"lastReading":25.0,"name":"","type":"Thermistor"},{"lastReading":25.0,"name":"","type":"Thermistor"}]},"job":{"file":{"filament":[],"firstLayerHeight":0.0,"generatedBy":"","height":0.0,"lastModified":"28115-10-29T03:41:51","layerHeight":0.0,"numLayers":0,"printTime":0,"simulatedTime":0,"size":0},"lastFileName":"","layer":0,"timesLeft":{"filament":0.0,"file":0.0,"layer":0.0}},"move":{"axes":[{"homed":false,"letter":"X","max":247.0,"min":0.0,"userPosition":0.000,"visible":true},{"homed":false,"letter":"Y","max":210.0,"min":0.0,"userPosition":0.000,"visible":true},{"homed":false,"letter":"Z","max":200.9,"min":0.0,"userPosition":0.002,"visible":true},{"homed":false,"letter":"U","max":75.0,"min":0.0,"userPosition":0.000,"visible":true},{"homed":false,"letter":"V","max":1000.0,"min":-1000.0,"userPosition":0.000,"visible":true},{"homed":false,"letter":"W","max":78.0,"min":0.0,"userPosition":0.000,"visible":true},{"homed":false,"letter":"A","max":1000.0,"min":-1000.0,"userPosition":0.000,"visible":true}],"calibrationDeviation":{"deviation":0.000,"mean":0.000},"currentMove":{"requestedSpeed":0.0,"topSpeed":0.0},"daa":{"enabled":false,"minimumAcceleration":10.0,"period":0.0},"idle":{"factor":0.3,"timeout":50000},"initialDeviation":{"deviation":0.000,"mean":0.000},"meshDeviation":{"deviation":0.000,"mean":0.000},"printingAcceleration":600.0,"speedFactor":100.0,"travelAcceleration":3000.0},"network":{"interfaces":[{"actualIP":"192.168.0.12","firmwareVersion":null,"gateway":"0.0.0.0","subnet":"0.255.255.255","type":"wifi"}]},"state":{"currentTool":-1,"machineMode":"FFF","status":"Idle","upTime":42}}}
-
Hmmm.... I'm near a machine now, and I don't see any signs of endstops in the object module either.
Let me keep looking.
-
I found them running the latest beta.
-
I am almost there with the homing file using conditional code.
if sensors.endstops[4].triggered && state.status.idle M291 P"MMU loaded. Selector homing not allowed.Please unload MMU manually." S2 if sensors.endstops[4].triggered && state.status.printing M25 M291 P"MMU loaded. Selector homing not allowed.Please unload MMU manually." S2 else M913 U50 ; reduce motor current to 50% to prevent bad noises M915 U S5 F0 ; set stall parameters G91 ; use relative positioning G1 H1 U5 F2000 ; move out 5mm G1 H1 U-100 F1000 ; move carriage to home G90 ; back to absolute positioning M400 ; make sure everything has stopped before we reset the motor currents M913 U100 ; motor currents back to normal
But , obviously is not working because
state.status.idle
is not the correct way of expressing the value of state.status.Here is the state tree. Surely this is trivial for anyone who is used to any type of coding, not for me unfortunately.
Edit: state.status == "Idle" .