Multiple Motion System - Second motion system start delay
-
Multiple Motion System - A feeder motor is configured as U axis connected to Driver 4 of mainboard 6HC is planned to move asynchronoulsy with the X,Y,Z axis. A daemon.g file defines to monitor the state of the PrintHeadState AND interface the U axis feeder motor to start and Stop feeding via two macrofiles named PrintHeadState ON and PrintHeadState OFF. After a lot of trials major errors were rectified.
However one of them still persists and unable to solve.
During the PrintHeadState ON there is a time delay (inconsistent) for the motor to start feeding. But when the PrintHeadState is OFF the motor stops immediately.Here are the values of few trials
Trial1 : 6.7 seconds
Trial2 : 10.7 seconds
Trial3 : 4.0 seconds
Trial4 : 4.95 seconds
Trial5 : 10.37 seconds
Trial6 : 4.9 secondsWhat could be the source of this error? How to solve this isse?
Placing the daemon.g, PrintHeadState ON, PrintHeadState OFF macro files for reference.
config.g
global PrintHeadState = 0daemon.g
M596 P1 ; use second motion system
G91 ; use relative cordinates
while (global.PintHeadState == 1)
G1 H4 U9999 F1000 ; feed untill simulated endstop relay P4 toggles to lowend
G4 P50PrintHeadState ON
M42 P3 S1 ; start the PrintHeadState Relay
M42 P4 S1 ; switch to high end
; set the PrintHeadState to ON
set global.PrintHeadState = 1PrintHeadState OFF
M42 P3 S0 ; start the PrintHeadState Relay
M42 P4 S0 ; switch to high end
; set the PrintHeadState to ON
set global.PrintHeadState = 0Kindly request your insights on solving this issue please.
-
@SANJR Hi,
it would be much better for us readers when you put code snippets in</>
brackets, because subroutines in meta code are indented. We can't see such mistakes with your copy/paste method.My first observation is a typo here : while
(global.PintHeadState == 1)
I'm sure PrintHeadState is meant...The delay thing is probably related to the fact that daemon.g runs only every 10sec by default. But that doesn't explain, why switching off works immediately.
To have daemon.g run more frequently, you have to wrap the whole code in a while (true) loop which also contains aG4 Sn
line to set the new timestamp.// example of calling daemon.g every second while (true) //every code is indented from here *code* while (global.PrintHeadState == 1) // even more indented in nested while loops *code* *code* G4 S1 // 1 second timestamp
-
Try changing the M42 calls to include an expression for the S parameter
M42 P3 S{1}
or if that doesn't work try
; if value is currently 0 set it to 1 ; if value is currently 1 , set it to zero M42 P3 S{mod(global.printHeadState+3,2)}
This may force RRF to not add it to the movement queue.
-
Thanks o_lampe and Owen D for your inputs. Summarized the changes to be done is as follows. Request to check whether my understanding is correct plz...
First to put the daemon.g code in a while (true) loop, this will act as a continuous loop.
; daemon.g
<while (true)>
<M596 P1 ; use second motion system>
<G91 ; use relative cordinates>
<while (global.PrintHeadState == 1)>
<G1 H4 U9999 F1000 ; feed untill simulated endstop relay P4 toggles to lowend>
<G4 S0.5>Second the use of {} brackets for the S parameter would force the firmware to not add it to the movement que. So the motor would respond to the state of the torch and feeder motor as soon as the command is received, is my understanding correct?
Updated macros files would be as follows,
PrintHeadState ON
<M42 P3 S{1} ; start the PrintHeadState Relay>
<M42 P4 S{1} ; switch to high end>
; set the PrintHeadState to ON
<set global.PrintHeadState = 1>PrintHeadState OFF
<M42 P3 S{0} ; start the PrintHeadState Relay>
<M42 P4 S{0} ; switch to high end>
; set the PrintHeadState to ON
<set global.PrintHeadState = 0>Lastly which software do u guys suggest to use for placing the code. Like jupyter or something like that.....I am unaware but wanted to know about it for a long time. And to put code snippets in <> means the one that i applied above....is my understanding correct?
-
@SANJR said in Multiple Motion System - Second motion system start delay:
to put code snippets in <> means the one that i applied above.
No, there is a menu list above this editor window where you can see the symbols to edit your post. (add pictures, code or links a.s.o.)
There you'll find </> for quoting code. -
Thanks, the second motion system is working.