M581 in RRF3 not triggering trigger2.g
-
You may need to enable the pull-up by adding a '^' to the P parameter
M581 P"^!io2.in" T2 C0
Also there is no space between the P and T params - not sure if relevant or not.
-
@chas2706 said in M581 in RRF3 not triggering trigger2.g:
The file trigger2.g in config.g
does not compute. which folder is trigger2.g in?
@tekkydave said in M581 in RRF3 not triggering trigger2.g:
Also there is no space between the P and T params - not sure if relevant or not.
very much so, good catch!i believe lack of space is okay while additional space is not when the parser is reading the g-code. i.e.X0Y0
is equivalent toX0 Y0
but not necessarily the other way around (could be wrong again) -
@deckingman
Hi it is wired to io2.in which are the general io pins on duet3.If I configure io.2 as an end stop, it works so therefore proves the wiring is ok.
-
@bearer
I have put trigger2.g in the /sys folder as per documentation.
I have tried with and without spaces between P and T parameters, neither of them work. -
@chas2706 have you tried adding the '^' to the P parameter. You have it configured for a High->Low transition but if it is not already set High by the pullup the Board wont see it.
-
@tekkydave
Ok thanks. I will try that later. I'm printing at the minute.
Cheers. -
@chas2706 I use this M581 P"!0.io3.in" T2 C0 which is pretty much the same as you. I also have a file called trigger2.g in the .sys folder. The reason I asked which pins you use are so that I could compare your configuration with my known working one. Mine is connected between io3in and gnd so I ask again, "which pins are you using"??
-
@deckingman
It is wired the same as your only on io2in. Connection is between io2in and gnd. -
Like I said above, if I change M581 code in config.g to M574 P"!io2.in" , the switch acts as an end stop and works as such and so proves the wiring is correct.
-
@chas2706 said in M581 in RRF3 not triggering trigger2.g:
I have put trigger2.g in the /sys folder as per documentation.
its not what you wrote so there we ask to confirm..
-
@bearer
Snippet from M581 Gcode documentation...…..
Any trigger number # greater then 1 causes the macro file sys/trigger#.g to be executed.
…….That is what I have done.
In my sys folder where config.g etc resides I have placed the trigger2.g file as per documentation.
-
@bearer
Sorry, there was a typo error in the first post. It should have said:The file trigger2.g in the sys/ folder has the following code...…..
-
If I put M581 ^P"!io2.in"T2 C0 in config.g as you suggested I get the following error:
Error: M581: Missing port name string when config.g reloads.
-
^
goes inside the""
is it safe to try and execute the trigger macro to see if there are any issues with the code?
M98 P"/sys/trigger2.g"
should to the trick to see if its okay... or just post the config.g and trigger2.g contents so people can see whats going on.
-
@bearer
Running M98 P"trigger2.g"in the console works.
adding ^ inside "" does not.Here is my config.g:
; Configuration file for Duet 3 (firmware version 3)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v2.1.1 on Mon Nov 04 2019 16:21:57 GMT+0000 (Greenwich Mean Time); General preferences
M555 P2 ; Set Marlin-style output
G21 ; Set dimensions to millimetres
G90 ; send absolute coordinates...
M83 ; ...but relative extruder moves
M550 P"Duet3" ; set printer name
M586 P0 S1 ; Enable HTTP
M586 P1 S1 ; Enable FTP
M586 P2 S1 ; Enable TelnetM669 K1 ; select CoreXY mode
; Drives
M569 P0 S1 ; X physical drive 0.0 goes forwards
M569 P1 S1 ; Y physical drive 0.1 goes forwards
M569 P2 S0 ; Z0 physical drive 0.2 goes forwards
M569 P3 S0 ; Z1 physical drive 0.3 goes forwards
M569 P4 S0 ; E0 physical drive 0.4 goes forwards; Set drive mapping
M584 X0 Y1 Z2:3 E4 ; Dual Z make sure drive 2 is left hand Z and 3 is right hand
M92 X80.00 Y80.00 Z400.00 E96.00 ; set steps per mm
M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
M566 X600.00 Y600.00 Z12.00 E120.00 ; Set maximum instantaneous speed changes (mm/min) - Jerk
M203 X18000.00 Y18000.00 Z180.00 E1500.00 ; set maximum speeds (mm/min)
M201 X3000.00 Y3000.00 Z100.00 E10000.00 ; set accelerations (mm/s^2) (print moves)
M906 X1000 Y1000 Z1000 E1100 I30 ; set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout; Leadscrew positions: The measurement is taken from X=0, Y=0. Therefore X will be negative, Y positive and middle of bed = 160
M671 X-100:415 Y160:160 S2.0; Axis Limits
M208 X-15 Y-12 Z0 S1 ; Set axis minima (adjust to make X=0 and Y=0 the edges of the bed)
M208 X310 Y310 Z380 S0 ; set axis maxima; Endstops
M574 X1 S1 P"!io0.in" ; configure active-low endstop for low end on X via pin io0.in
M574 Y1 S1 P"!io1.in" ; configure active-low endstop for low end on Y via pin io1.in
M581 P"!io2.in" T2 C0 ; configure active-low endstop to run a macro called trigger2.g
; created in sys/ and let it trigger at any time without restrictions; Z-Probe
M558 P1 C"io3.in" H5 F120 T6000 ; set Z probe type to unmodulated and the dive height + speeds
; G31: the P is the reported Z value when triggered. X,Y are offset coordinates. Z is trigger height, you can decrease value if nozzle is too close
; or increase if too far away.
G31 P500 X-30 Y-5 Z2.18 ; set Z probe trigger value, offset and trigger height; Mesh Grid
; The following M557 commands are not needed if you are using a bed.g file to perform bed compensation
;*** Adjust the XY coordinates in the following M557 commands to suit your build and the position of the Z probe
M557 X10:280 Y20:280 S50 ; Define small mesh grid
;M557 X10:280 Y10:280 S20 ; Define large mesh grid; Heaters/temperature sensors
M308 S0 P"temp0" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin temp0
M950 H0 C"out0" T0 ; create bed heater output on out0 and map it to sensor 0
M143 H0 S120 ; set temperature limit for heater 0 to 120C
M307 H0 B0 S1.00 ; disable bang-bang mode for the bed heater and set PWM limit
M140 H0 ; map heated bed to heater 0
M308 S1 P"temp1" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin temp1
M950 H1 C"out1" T1 ; create nozzle heater output on out1 and map it to sensor 1
M143 H1 S280 ; set temperature limit for heater 1 to 280C
M307 H1 B0 S1.00 ; disable bang-bang mode for the nozzle heater and set PWM limit
M307 H1 A299.8 C109.4 D4.0 S1.00 V12.3 B0 ; Autotune result for hotend
M307 H0 A109.8 C457.8 D2.1 S1.00 V12.3 B0 ; Autotune result for bed;CPU Temperature Calibration
M912 P0 S-10.0; Fans
M950 F0 C"out7" Q500 ; create fan 0 on pin out7 and set its frequency (parts fan)
M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned off
M950 F1 C"out8" Q500 ; create fan 1 on pin out8 and set its frequency (ext fan)
M106 P1 S1 H1 T45 ; set fan 1 value. Thermostatic control is turned on;Re-assigned fan pins
;CPU fan
M950 F2 C"out9" ; create fan 2 (CPU fan)
M308 S3 Y"mcutemp" A"mcutemp" ; set up a virtual sensor for cpu fan
M106 P2 T45 H3 ; set fan 2 value. Fan comes on when cpu temp is above 45 degrees
;Led Lighting
M950 F3 C"out4" Q500 ; create a fan 3 output to use for led lighting control on pin out4
M106 P3 S0 ; set output default to off; Tools
M563 P0 S"Extruder0" D0 H1 F0 ; define tool 0
G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets
G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C; Custom settings
;CPU Temperature Calibration
;M912 P0 S-15.8 ; Find correct value
;M42 P2 S255 ; Turn led lighting on full
;M98 P"LevelLeadscrews.g" ; Option to perform leadscrew levelling
;M98 PEnable Mesh Levelling ; Option to enable on start up
T0 ; select first tooland my trigger2.g:
;trigger2.g
; Macro to safeguard machine upon failure of Z probing;M291 P"Upper limit has been triggered!" R"Probe Failure!" S2
G91 ; relative positioning
G1 H2 Z5 F6000 ; lift Z relative to current position
G90 ; back to absolute positioning -
Ok here's what ive found:
In the M581 command I re-introduced the missing space between the "io2.in" and T2.
I operated the microswitch connected to io2.in and nothing happened.
I started a print and operated the microswitch and the trigger2.g executed.
It seems that the "C0" parameter to set the code to execute at anytime does not work and only operates when printing.
Or am I missing something? -
In the Gcode description for M581 it says:
M581 - RepRapFirmware 3
Parameters
P Specify one or more pin names
Tnn Logical trigger number to associate the endstop input(s) with, from zero up to a firmware-specific maximum
C Condition: whether to trigger at any time (C0, default) or only when printing a file from SD card (C1)The Condition for C indicates that when set to C0 will trigger at any time. This is not entirely true. It will trigger AFTER all current moves have finished.
So it is useless for my purpose. -
@chas2706 said in M581 in RRF3 not triggering trigger2.g:
It will trigger AFTER all current moves have finished.
i belive that could be a bug as it did behave like described in the documentation a while ago.
which versio are you using?
M115
will show it. -
@bearer
Oh right maybe it is a bug.I'm on version 3.0RC2.
-
Hmmm... I'd expect the trigger to instantly start executing the trigger2.g... however, I'd expect the commands inside that file to enter the planner Q like anything else.
Phrased another way: If there is a long running single G-Code command executing at the moment of trigger, the first command (other than M112 estop, which is handled in a special way) inside the file cannot start until the current command finishes. It also might be true that a chain of short moves that have been treated by the planner as a connected chain, that (dynamic) group of commands might have to finish.
I have no hands on to current or past behaviors. The above is just what I'd expect from the way the planner works.