triggers
-
@deckingman Brilliant - many thanks.
-
Unless something has recently changed in the firmware (I'm using 3.5.6) a mechanical switch will provide erratic operation as the input chosen for the trigger is not "debounced".
This means that sometimes the trigger works as expected while other times both the "low to high" and the "high to low" triggers execute.
Unless this had been fixed or until it is fixed you need to use some electronic device to accept the connection from the switch and provide a clean, noise free input to the Duet.
Frederick
-
@fcwilt I've used relay contacts as trigger inputs. Also a "joystick" which was essentially just 4 cheap mechanical micro switches, none of which had any switch bounce problems.
I could be wrong but IIRC, trigger macros are blocking. That is to say, once a macro starts, it'll ignore any further triggers on the same pin until the macro ends. So that might explain why Ive never had any problems using cheap switches.
-
I didn't actually get to the point of trying to use the two test triggers - I simply had them "echo" to the DWC console. Perhaps they finished executing before the "bouncing" had ceased.
It could be that what I did was test for a falling edge with a NC switch and the trigger fired on opening the switch and holding it open.
I will have to go back and do more testing.
Thanks for the feedback.
Frederick
-
@fcwilt Depending on what the trigger macros actually does, I guess one could also add a pause of a few ms somewhere. That might prevent further "polling" of the input pin and thus negate any switch bounce issues if there are any.
-
@deckingman It's a momentary button that forms part of the Orbiter filament sensor.
I need it to perform two operations. Going from low to high, I need it to run a 'load filament' trigger. High to low, I need it to perform a 'run out' trigger.In the 'run out' trigger I will need to check what state the printer is in, so that if it is triggered while the printer is not actually printing it exits the trigger without completing. Is that something that can be done?
-
@Paddy yes that can be done by inspecting the printer state via the object model.
-
@deckingman It's a momentary button that forms part of the Orbiter filament sensor.
I need it to perform two operations. Going from low to high, I need it to run a 'load filament' trigger. High to low, I need it to perform a 'run out' trigger.In the 'run out' trigger I will need to check what state the printer is in, so that if it is triggered while the printer is not actually printing it exits the trigger without completing. Is that something that can be done?
Yes. You could do it as @oliof suggests but I think there is an easier way using the "R" parameter in M581. The default is R0 which will trigger at any time, but R1 will only trigger when printing (providing you are printing from the SD card which most people do) and R2 will only trigger when not printing from the SD card.
https://docs.duet3d.com/User_manual/Reference/Gcodes#m581-configure-external-trigger
-
@deckingman thanks for pointing out the R parameter, I wasn't aware. Advantage of using the object model is that the solution is portable to other macros/approaches.
-
It's a momentary button that forms part of the Orbiter filament sensor.
Also covered in this recent thread: https://forum.duet3d.com/topic/34132/orbiter-filament-sensor-setup
I don't think it's a click-on, click-off button, just a push button. I think you need to sense if there is filament in the filament sensor as well. If there is, it runs an load script. If not it runs a load macro. The other mode of operation is when you push filament into the sensor, and you want it to automatically start the load macro. And how to detect filament out during a print. All discussed in the thread linked above.
Ian
-
@droftarts Thanks guys for the replies.
I did see that thread but didn't really grasp what was said.
The sensor has two buttons one solely used to unload. The other detects filament.
My thought is using it like a endstop. Assume its normally low, when filament is present it will be held high.
if it runs out while printing, it will go from high to low and trigger a 'runout' routine.
If goes from low to high while not printing (i've pushed filament in) it will trigger a 'load' routine.
If it goes from high to low and it isn't printing (I've pressed the unload button' it will do nothing.
Is this feasible?
-
@Paddy Yes, that's pretty much what the other thread describes. Perhaps get in contact with @daninet and work together to get it working? He's already started another thread about it, here: https://forum.duet3d.com/topic/34140/if-statement-for-macro-trigger-in-rrf
Ian