Orbiter filament sensor setup
-
Hello,
I have orbiter sensor setup with my duet2 board. The orbiter sensor has 2 trigger switches, one inside the sensor and a button on the top. The intended operation is pressing the button unloads a filament and while there is no filament putting filament in the sensor starts loading the filament. The problem with this is there is no filament sensing defined, this is no more than just a faster way to load and unload filament.
So the logical way to do is to define the filament sensor switch with M591.So this is how the settings look like:
M591 D0 P1 C"!zstop" S1 ; set filament sensor switch for extruder 0 M950 J1 C"!zstop" ;define logical input for filament auto load M581 P1 T2 S0 R0 ;define trigger for filament auto load triggers trigger2.g M950 J2 C"^connlcd.encb" ;define logical input for filament unload M581 P2 T3 S0 R0 ;define trigger for filament auto unload triggers trigger3.g
But once you do that you no longer have the option to load the filament. M591 invalidates the M950 line.
I believe the orbiter sensor was mainly designed for klipper, so there they might be able to use the sensor switch for sensing and loading.
As a workaround now I'm simply doing filament loading with a macro from panel due and not use the filament load feature. Question is: would there be a way to use the M591 and M950 at the same time with conditions? For example if the switch is not triggered (no filemant) and becomes triggered start the filament load macro? But when triggered and becomes untriggered (filament runs out) pause the print like it should?
If this could not be done can we define double or long press triggers on buttons? So single press on the button would unload filament, double press would load the filament. -
@daninet Usually filament sensing only happens during a job (see M591 S parameter), so you could define the sensor as a trigger in config.g so it works at startup, then undefine it and define it as a filament monitor in your start gcode, and then undefine it as a filament monitor and redefine it as a trigger in your end gcode. As you say, you can't define a pin to do two things, so switching between them at the appropriate moment is the best you can do.
Ian
-
@droftarts this sounds like a possible workaround. How do I undefine a config entry in my start gcode?
-
C"name" Pin name(s) and optional inversion status, see Pin Names. Pin name "nil" frees up the pin.
M950 J1 C"nil"
disables the trigger, and frees up the zstop pin to use as a filament sensor.
M591 D0 P0
disables the filament sensor, and frees up the zstop pin to use it as a trigger.Ian
-
@daninet A couple of alternatives I've thought of, though it does depend what firmware version you are running.
If you're running RRF 3.5.0-rc1 or later, you can configure the filament sensor to sense all the time with
M591 D0 S2
. You can then handle what happens in filament-error.g, checking with the Object Model state.status if the printer is printing, idle, paused, processing etc. Eg, if printing, do a normal pause and alert that filament is out, if idle (or not printing) run the autochange macro.Alternatively, define it as a trigger all the time, and check the state.status in the trigger macro for the same thing.
Both of these might need a bit of tweaking for you want to achieve in each state, because for example, if you have filament loaded, and press the button to eject filament, the sensor will trigger as the filament comes out. So you might need to turn the trigger off for the duration of that movement.
So it might turn out one way around is better than the other. I'd probably err towards doing it the trigger way, as then you can sense when filament is pushed in; if it's defined as a filament sensor, it won't trigger the filament-error macro when the state changes from no filament to filament present. You can also set up two triggers on the same input (I think), one for when it changes from inactive to active, and another for active to inactive.
Hope that helps.
Ian
-
@droftarts Ok I never thought of this. So:
I do something like this in a macro and call this in the trigger2.g:; Macro to check printer status and load filament or pause print M408 S0 P"status" ; Retrieve the status information ; Check the status response - I'm just assuming here the reply is printing or idle, needs to be checked IF {[state.status] = "printing"} M98 P"pause.g" ; Execute pause.g to pause print ELSEIF {[state.status] = "idle"} M98 P"loadfil.g" ; Execute loadfil.g to load filament ENDIF
Am I thinking about this the right way?
-
@daninet Yes, that looks about right, though check the Meta Gcode wiki page for syntax - it's not my strong point!
I don't think you need to retrieve the status with M408, your OM queries should be enough.
You just have to think about all the different states, and what you want it to do. You can query the object model for the state of the switch, too. Also, you can use
!=
to test if it's not printing, rather than having to catch all the other states, egif state.status != "printing" ... do something because it's not printing
Ian
-
@droftarts thanks, this will get me started. If I have a working solution I will post it here for anyone in the future.
-
-
@droftarts I need some brainstorming here.
I thought about it a lot and the following scenario is working while the printer is idle:idle && no filament -> press button to start loading filament
idle && filament present -> press button to start unloading filamentI think this is clear so far and working in the macro.
However there are two tricky situations need to be covered:- Print paused manually for filament change so filament is present but status is paused
- Filament runs out and print is paused
For case 1 we can use the original macro as filament is present, but I'm not sure how I could handle when print is paused with error. I have looked up all the available statuses and printer status is same when manually paused and when paused with error. I'm wondering what other parameter we could use this case to determine if the print was halted by error or manually.
-
-