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

    Trigger file not working as expected.

    Scheduled Pinned Locked Moved Solved
    General Discussion
    4
    15
    557
    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.
    • Chrissundefined
      Chriss @fcwilt
      last edited by

      @fcwilt

      Sorry, have forgotten:

      Mini5+
      3.4.0beta6

      fcwiltundefined Chrissundefined 2 Replies Last reply Reply Quote 0
      • fcwiltundefined
        fcwilt @Chriss
        last edited by

        @chriss

        Well I cannot help with any firmware problems as I don't use any of the betas - I'm on 3.3.

        Pull-ups are part of the hardware so you should not use the ! character.

        Triggers are activated on the transition from one state to another so it's not a question of holding the button down.

        By default they trigger on the rising edge which in your case would be when you release the button. You might want to add S0 to your M581 command to trigger when you press the button.

        You might try adding a G4 P250 at the end of the trigger code.

        Frederick

        Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

        1 Reply Last reply Reply Quote 0
        • Chrissundefined
          Chriss @Chriss
          last edited by

          @chriss

          Hi Frederick,

          I tried what you mentioned, that made it even worth. The push button acts now exactly as a push button. So the LEDs go one if I press the button and go of when I release it button.
          The plan was to toggle between the states. So first push = on, second push = off.

          Cheers, Chriss

          fcwiltundefined 1 Reply Last reply Reply Quote 0
          • fcwiltundefined
            fcwilt @Chriss
            last edited by

            @chriss said in Trigger file not working as expected.:

            @chriss

            Hi Frederick,

            I tried what you mentioned, that made it even worth. The push button acts now exactly as a push button. So the LEDs go one if I press the button and go of when I release it button.
            The plan was to toggle between the states. So first push = on, second push = off.

            Cheers, Chriss

            Mechanical switches don't change cleanly from one state to another - the contacts bounce and the state can change several times from one state to the other before the bouncing stops and the final state is obtained.

            That may be what you are seeing.

            Try upping the P parameter in the G4 to 1000 and see if that makes any difference.

            I use push buttons for triggers BUT I am not trying to toggle a state, just set a state.

            Frederick

            Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

            Chrissundefined 1 Reply Last reply Reply Quote 0
            • Chrissundefined
              Chriss @fcwilt
              last edited by

              @fcwilt said in Trigger file not working as expected.:

              That may be what you are seeing.
              Nope, this is not the case. I see it clearly when I press the button and hold it. It goes on, and it goes off when I release it.

              There is a other problem. The trigger2.g is triggered in both situations in my opinion. This explains perfectly what I see when I push and release the button. the actualValue and the requestedValue change accordingly int he Object Model.

              Try upping the P parameter in the G4 to 1000 and see if that makes any difference.

              I tried that, but this does not help. I understand what you mean, but this is not a problem with the bouncing of the switch. It is, in my opinion, the problem that the trigger get executed at the push and at the release.

              Cheers, Chriss

              fcwiltundefined cosmowaveundefined 2 Replies Last reply Reply Quote 0
              • fcwiltundefined
                fcwilt @Chriss
                last edited by

                @chriss said in Trigger file not working as expected.:

                It is, in my opinion, the problem that the trigger get executed at the push and at the release.

                Well, it is beta firmware so it could well be a bug. Or it could be a bug that has existed for some time but simply has gone unnoticed. As I mentioned it would not have effected they way I have used triggers.

                If I get a chance I will see if I can toggle a value in 3.3.

                Frederick

                Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                1 Reply Last reply Reply Quote 0
                • cosmowaveundefined
                  cosmowave @Chriss
                  last edited by

                  @chriss said in Trigger file not working as expected.:

                  It is, in my opinion, the problem that the trigger get executed at the push and at the release.

                  Normally this happens when the switch is bouncing...

                  Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                  Chrissundefined 1 Reply Last reply Reply Quote 0
                  • Chrissundefined
                    Chriss @cosmowave
                    last edited by

                    @cosmowave

                    Yes... I know what you mean... Anyway, I tried it now with:

                    config.g

                    M950 J1 C"^0.io1.in"
                    M581 P1 T2 S0
                    

                    trigger2.g

                    if fans[5].actualValue == 1
                       M106 P5 S0
                       G4 P1000			; Wait 1000ms
                    else
                       M106 P5 S255
                       G4 P1000			; Wait 1000ms
                    
                    G4 P1000			; Wait 1000ms
                    

                    The LEDs go on now for two seconds. (What a surprise. 🙂 )

                    I'm very sure that the trigger2.g gets executed twice, at the push and at the release.

                    😞

                    Cheers, Chriss

                    Chrissundefined OwenDundefined 2 Replies Last reply Reply Quote 0
                    • Chrissundefined
                      Chriss @Chriss
                      last edited by

                      @chriss OK, we can close it now....

                      It works now... do not ask me why but it works. I rebooted the printer for some other changes and it seems to work now as expected..... :?

                      Anyway, thanks for your hep @cosmowave, your direction with the S0 did it at the end.

                      Cheers, Chriss

                      fcwiltundefined 1 Reply Last reply Reply Quote 0
                      • OwenDundefined
                        OwenD @Chriss
                        last edited by OwenD

                        @chriss
                        Try this
                        EDIT
                        You need to check the pin twice to ensure it's finished bouncing
                        I should have had my coffee before posting

                        if sensors.gpIn[1].value=1
                           G4 P500
                           if sensors.gpIn[1].value=1
                              if fans[5].actualValue == 1
                                 M106 P5 S0
                              else
                                 M106 P5 S255
                        
                        

                        You may need to increase P500 depending on how long your button is bouncing

                        1 Reply Last reply Reply Quote 0
                        • Phaedruxundefined Phaedrux marked this topic as a question
                        • Phaedruxundefined Phaedrux has marked this topic as solved
                        • fcwiltundefined
                          fcwilt @Chriss
                          last edited by

                          @chriss said in Trigger file not working as expected.:

                          @chriss OK, we can close it now....

                          It works now... do not ask me why but it works. I rebooted the printer for some other changes and it seems to work now as expected..... :?

                          Anyway, thanks for your hep @cosmowave, your direction with the S0 did it at the end.

                          Cheers, Chriss

                          You sure?

                          I just tried it under firmware 3.3 and the results were inconsistent, sometimes worked, sometimes didn't. More often then not it would trigger on push and release.

                          I'm pretty sure it is contact bounce which is surprising because I would have thought the firmware code for triggers would have de-bounced the inputs.

                          Frederick

                          Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                          cosmowaveundefined Chrissundefined 2 Replies Last reply Reply Quote 0
                          • cosmowaveundefined
                            cosmowave @fcwilt
                            last edited by

                            @fcwilt No. The firmware makes no debounce.
                            My flowsensor of the watercooling switchs a relay, which has bouncing contacts.
                            I use also a G4 in my trigger2 macro for software de-bounce.

                            Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                            1 Reply Last reply Reply Quote 1
                            • Chrissundefined
                              Chriss @fcwilt
                              last edited by

                              @fcwilt said in Trigger file not working as expected.:

                              You sure?

                              Not 100% about the S0, but sure that it works now.
                              I guess that your "G4 250" makes the de bouncing here. And the behavior is consistent.
                              The 2nd press of the switch will not do anything when I press the switch fast enough. (Below 250ms)
                              With the finally final settings is that gone:

                              if fans[5].actualValue == 1
                                 M106 P5 S0
                                 G4 P25			; Wait 25ms
                              else
                                 M106 P5 S255
                                 G4 P25			; Wait 25ms
                              
                              G4 P10			; Wait 10ms
                              

                              It is not easy to press the button in 35ms after the first press.

                              I guess that something in the live configuration was mixed up and and have forgotten to reboot to verify the config.

                              Cheers, Chriss

                              1 Reply Last reply Reply Quote 1
                              • First post
                                Last post
                              Unless otherwise noted, all forum content is licensed under CC-BY-SA