Hi!
Now I’m working on a custom pick and place delta robot solution, based on smoothie.
I’m using a misc switch to control solenoid valve of vacuum ejector.
Config of switch:
switch.misc.enable true
switch.misc.input_on_command M42
switch.misc.input_off_command M43
switch.misc.output_pin 0.17
switch.misc.output_type digital
All is working perfectly, but it takes too much time to turning off this switch.
And I don’t have any idea why.
This is a log from my custom writed host, with using comands to turn ON and OFF misc switch:
object detected = 0.19020
start moving = 0.19194
turn on vacuum = 0.23800
near to object = 0.27578
go down to take object = 0.28497
go up with object = 0.29475
go to point of placement = 0.30717
sending М43 = 0.30728
vacuum is off = 1.16620
placing object in a box = 1.17320
On parking! Done! = 1.18360
Time from sending M43 to get an “ok” from smoothie - almost a one second! It’s really criticall for me, because my robot is fast. But now it just hangs in place, waiting turning off the vacuum.
And in this case why turn ON command (M42) worked instantly?
Here is a log, when I don’t use any of switch command, just movement:
object detected = 0.25767
start moving = 0.25882
near to object = 0.29923
go down to take object = 0.32037
go up with object = 0.33453
go to point of placement = 0.34480
placing object in a box = 0.51749
On parking! Done! = 0.67044
Smoothie doesn’t execute commands when it gets them, it places them in a queue and executes them once it’s their turn ( or it couldn’t do predictive acceleration )
Add M600 ( wait for execution ) before and after your M43 and this should get fixed.
Thank you for answer!
But according to http://smoothieware.org/supported-g-codes M600 - it’s a suspend print.
Maybe you mean M400?
But I tried put M600 like you say - there’s no effect, smoothie just said that print “already suspended”.
I’m sending this gcode like this via serial port on every cycle:
M42
ok
G1 X-24 Y-104 Z130 F80000
ok
G1 Z92
ok
G1 Z130
ok
G1 X-110 Y130 Z90 E-75 F80000
ok
M43
ok
G1 Z20
ok
G1 Z105
ok
M400
ok
New command sending only after ‘ok’ is received. New cycle starting only when M400 answers “ok”.
Time from start streaming to answer of M400 takes about 1.2 second with using switch M42 and M43, and about 0.6 secs without it.
I checked how much time my host is waiting for ‘ok’ when sending M43:
sending М43 = 0.28486
----start sending = 0.00000
----sended = 0.00090
----ok received = 0.87310
No, Smoothie will always wait for the queue to be empty to execure switch commands. The code of Smoothie would need to be massively rewritten to enable real-time M-codes.