Quick confirmation of M950, please....
-
I've got a normally open switch configured in config.g like this:
; Pause button M950 J9 C"io0.in" ; create input 9 on io0.in M581 P9 T2 S1 ; invoke trigger 2 inactive-to-active edge is detected on input 9
On the advice of others, I'm changing the NO to NC, so is it simply a case of changing tit to this, please?
; Pause button M950 J9 C"!io0.in" ; create input 9 on io0.in M581 P9 T2 S1 ; invoke trigger 2 inactive-to-active edge is detected on input 9
Thanks
-
@nightowl999 said in Quick confirmation of M950, please...:
I've got a normally open switch configured in config.g like this:
; Pause button M950 J9 C"io0.in" ; create input 9 on io0.in M581 P9 T2 S1 ; invoke trigger 2 inactive-to-active edge is detected on input 9
On the advice of others, I'm changing the NO to NC, so is it simply a case of changing tit to this, please?
; Pause button M950 J9 C"!io0.in" ; create input 9 on io0.in M581 P9 T2 S1 ; invoke trigger 2 inactive-to-active edge is detected on input 9
Thanks
That is part of the process but you also have to change the wiring to the switch to use the NC connection - if it has one, not all do.
Here is a microswitch with the contacts marked as C for common, NO for normally open and NC for normally closed.
Frederick
-
Thanks, @fcwilt
Yeah, the switch I'm using has both, so I'll change the connection, too.
Thanks again
-
Hmm, that doesn't seem to work. Should I also change the M581 line from this:
M581 P9 T2 S1 ; invoke trigger 2 inactive-to-active edge is detected on input 9
...to this...
M581 P9 T2 S0 ; invoke trigger 2 active-to-inactive edge is detected on input 9
Thanks
-
@nightowl999 said in Quick confirmation of M950, please...:
Hmm, that doesn't seem to work. Should I also change the M581 line from this:
M581 P9 T2 S1 ; invoke trigger 2 inactive-to-active edge is detected on input 9
...to this...
M581 P9 T2 S0 ; invoke trigger 2 active-to-inactive edge is detected on input 9
Thanks
That would control if the trigger was activate when the switch was pushed or released. If it doesn't work as desired change the setting to the other edge.
A NC switch would have a rising signal, on the input to the Duet, when pressed and a falling signal when released.
Perhaps the ! character doesn't apply in this case since you can control the edge responded to.
Frederick
-
@fcwilt
I think I'm being a bit slow with this - or it's well past my bed time...The NC switch is connected across the io0.in and GND, so I'd assumed I would only need to make the first change above, i.e. inverting the input by using the C"!io0.in" parameter.
Doing that didn't work, which led me to think I should change the S1 parameter in the M581 line to S0, which invokes trigger 2 on the inactive-to-active edge.
Are you saying I might only need to do the last part and leave the C parameter not inverted, i.e. C"io0.in".
Thanks
-
@nightowl999 said in Quick confirmation of M950, please...:
@fcwilt
I think I'm being a bit slow with this - or it's well past my bed time...The NC switch is connected across the io0.in and GND, so I'd assumed I would only need to make the first change above, i.e. inverting the input by using the C"!io0.in" parameter.
Doing that didn't work, which led me to think I should change the S1 parameter in the M581 line to S0, which invokes trigger 2 on the inactive-to-active edge.
Are you saying I might only need to do the last part and leave the C parameter not inverted, i.e. C"io0.in".
Thanks
It is a bit confusing. Normally to change the state of something like a switch you add or remove the ! character so the inactive state of the switch is seen by the firmware as inactive.
With triggers having the option to select rising/falling edge that does somewhat the same thing.
I'm away from home at the moment so I cannot verify what I have done.
But I would think you would not want the ! character but would want the rising edge option.
Frederick
-
@nightowl999 your original configuration looks correct for a NC switch to me. Are you sure you didn't already have it wired as NC ?
-
@dc42
No, the original config.g file settings were for a no switch, and it worked.I think @fcwilt is suggesting I should leave the M950 as it was originally and change only the M581 line, so it would look like this:
; Pause button M950 J9 C"io0.in" ; create input 9 on io0.in M581 P9 T2 S0 ; invoke trigger 2 active-to-inactive edge is detected on input 9
This seems to work, except the Resume is triggered immediately after the Pause code has completed, so it looks like I'll need to check the trigger2.g file, as using the Pause/Resume buttons in DWC work as they should. Hmmm...
Here's the trigger2.g code:
echo "Called at " ^ state.time G4 S1 ; delay 10ms to debounce if sensors.gpIn[9].value=1 echo "Debounce" M99 ; break out if sensor value is zero again (bouncing) if job.file.fileName !=null ; if there's a job filename then it's reasonably safe to say we are printing if global.PausePress == false ; the button hasn't been pressed so we'll pause echo "Pause" M25 ; pause the current toolpath else echo "Resume" ; resume the current toolpath M24
Perhaps I've missed an indent somewhere...
Thank you.
-
@nightowl999
Yep, sorted.
The M950 line doesn't need the io0.in pin inverted
The M581 line S parameter needs to be changed to S0...and I had the indents in the trigger2.g file wrong. Here's what it should look like:
; trigger2.g echo "Called at " ^ state.time G4 S1 ; delay 10ms to debounce if sensors.gpIn[9].value=1 echo "Debounce" M99 ; break out if sensor value is zero again (bouncing) if job.file.fileName !=null ; if there's a job filename then it's reasonably safe to say we are printing if global.PausePress == false ; the button hasn't been pressed so we'll pause echo "Pause" M25 ; pause the current toolpath else echo "Resume" ; resume the current toolpath M24
Thanks, guys!
-
undefined dc42 marked this topic as a question
-
undefined dc42 has marked this topic as solved