m144.sh (m100-m199) to timestamp begin/end of G-code run?

More
9 years 11 months ago #82502 by clunc
Would this work? (Not sure where m144.sh would need to be stored.)
Thank you.
--
cLUnc

[inside G-code]
Code:
... at beginning of G-code M144 201 1 ; M144, relies on m144.sh, reminiscent of old AT&T 411 service, followed by modelnumber and "begin" flag ... do the program M144 201 0 ; "begin" flag not equal 1, thus, "end" M5 M2
[the m144.sh bash script]
Code:
#!/bin/bash # Filename: m144.sh # LinuxCNC log modelnumber and time-of-day modelnumber=$1 # first arg begin=$2 # second arg, begin = 1, end = 0 #daat = `date` # FAIL no spaces allowed daat=`date` # fine, call linux os 'date' command echo "Model$modelnumber: $daat" >> /CNCMODELS/m144_time.log if [ $begin -eq 0 ] ; then # my, what strange syntax you have my dear... echo '' >> /CNCMODELS/m144_time.log & fi exit 0

Please Log in to join the conversation.

More
9 years 11 months ago #82503 by clunc
> (Not sure where m144.sh would need to be stored.)

...but a reasonable guess is in the directory specified by the "SUBROUTINE_PATH = " entry in the "[RS274NGC]" section of the "~/linuxcnc/configs/<machine-name>/<machine_name>.ini" file.

whew.

Please Log in to join the conversation.

More
9 years 11 months ago #82504 by dgarrett
Search rules for user-defined M commands:
linuxcnc.org/docs/2.7/html/config/ini-config.html
Code:
2.4 [RS274NGC] Section


File requirements for user-defined M commands:
linuxcnc.org/docs/2.7/html/gcode/m-code.html
Code:
23. M100-M199 User Defined Commands

note:

no extension and a capitol M are expected

Please Log in to join the conversation.

More
9 years 11 months ago #82509 by clunc
Very nice. Thank you for the hand-up.

dgarrett wrote: Search rules for user-defined M commands:
linuxcnc.org/docs/2.7/html/config/ini-config.html

Code:
2.4 [RS274NGC] Section

The "USER_M_PATH" parameter "specifies a colon (:) separated list of up to 10 directories to be searched when single-file subroutines are specified in gcode."

dgarrett wrote: File requirements for user-defined M commands:
linuxcnc.org/docs/2.7/html/gcode/m-code.html

Code:
23. M100-M199 User Defined Commands

note:

no extension and a capitol M are expected


Indeed,
Code:
The error Unknown M code used denotes one of the following: * The specified User Defined Command does not exist * The file is not an executable file * The file name has an extension * The file name does not follow this format M1nn where nn = 00 through 99 * The file name used a lower case M

So, I'll:
* add a "USER_M_PATH=" line under the RS274NGC section of the INI file
* rename 'm144.sh' to 'M144'
* and double-check that it's executable

(NOW I remember the word: "homage". "144 is an homage to AT&T's old 411 directory assistance service." That's what I wanted to say.)

Thanks, dgarrett!

Please Log in to join the conversation.

Time to create page: 0.626 seconds
Powered by Kunena Forum