• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Multiple Motion System - Second motion system start delay

Scheduled Pinned Locked Moved
Gcode meta commands
3
6
270
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    SANJR
    last edited by SANJR 31 Dec 2023, 18:40

    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 seconds

    What 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 = 0

    daemon.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 P50

    PrintHeadState ON
    M42 P3 S1 ; start the PrintHeadState Relay
    M42 P4 S1 ; switch to high end
    ; set the PrintHeadState to ON
    set global.PrintHeadState = 1

    PrintHeadState OFF
    M42 P3 S0 ; start the PrintHeadState Relay
    M42 P4 S0 ; switch to high end
    ; set the PrintHeadState to ON
    set global.PrintHeadState = 0

    Kindly request your insights on solving this issue please.

    undefined 1 Reply Last reply 1 Jan 2024, 10:10 Reply Quote 0
    • undefined
      o_lampe @SANJR
      last edited by 1 Jan 2024, 10:10

      @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 a G4 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
      1 Reply Last reply Reply Quote 1
      • undefined
        OwenD
        last edited by 1 Jan 2024, 10:59

        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.

        undefined 1 Reply Last reply 1 Jan 2024, 22:37 Reply Quote 1
        • undefined
          SANJR @OwenD
          last edited by SANJR 1 Jan 2024, 22:39 1 Jan 2024, 22:37

          @o_lampe , @OwenD

          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?

          undefined 1 Reply Last reply 2 Jan 2024, 09:41 Reply Quote 0
          • undefined
            o_lampe @SANJR
            last edited by 2 Jan 2024, 09:41

            @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.

            undefined 1 Reply Last reply 3 Jan 2024, 16:41 Reply Quote 0
            • undefined
              SANJR @o_lampe
              last edited by 3 Jan 2024, 16:41

              @o_lampe

              Thanks, the second motion system is working.

              1 Reply Last reply Reply Quote 0
              3 out of 6
              • First post
                3/6
                Last post
              Unless otherwise noted, all forum content is licensed under CC-BY-SA