Alternatively, you could just set up your M102 code to just setp your hal pin(s) and then use a subroutine o-sub call for the G-code part including the M-code. Then instead of issuing a remapped g-code you just use "o<your_sub_name> call".
Todd Zuercher P. Graham Dunn Inc. 630 Henry Street Dalton, Ohio 44618 Phone: (330)828-2105ext. 2031 -----Original Message----- From: andy pugh <bodge...@gmail.com> Sent: Monday, February 28, 2022 7:12 AM To: Enhanced Machine Controller (EMC) <emc-users@lists.sourceforge.net> Subject: Re: [Emc-users] Custom m codes [EXTERNAL EMAIL] Be sure links are safe. On Mon, 28 Feb 2022 at 10:51, andrew beck <andrewbeck0...@gmail.com> wrote: > > I want to issue a m102 > > And get this code run > > S5m3 > Halcmd setp hm2 7i77etc pin output on This is slightly tricky, as you want to both issue a G-code command and a Halcmd command. I think you need to do a G-code remap to create a new M-code that runs G-code, and then have that G-code include a custom M-code that calls the halcmd. Or: Create a Python remap that includes an MDI to run the G-code then a command to set the HAL pin. (import linxcnc / import hal: https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Flinuxcnc.org%2Fdocs%2F2.8%2Fhtml%2Fconfig%2Fpython-interface.html%23_code_linuxcnc_command_code_attributes&data=04%7C01%7Ctoddz%40pgrahamdunn.com%7Ca17c2381dda144b5cfc808d9fab3c60c%7C5758544c573f47cebee96c3e0806fb43%7C0%7C0%7C637816472649963804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=XxVYdWZVS2%2FDEr7hPiNzf%2B2takJzNEdC5wLe6ndheMI%3D&reserved=0 https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Flinuxcnc.org%2Fdocs%2Fdevel%2Fhtml%2Fhal%2Fhalmodule.html%23_set_p&data=04%7C01%7Ctoddz%40pgrahamdunn.com%7Ca17c2381dda144b5cfc808d9fab3c60c%7C5758544c573f47cebee96c3e0806fb43%7C0%7C0%7C637816472649963804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=GINhJoeDid%2BvP5sjZ70Wb9oBhf98sQV6x5Dvg2NM30s%3D&reserved=0 Or: Use a G-code remap and the little-documented (py, ...) "magic comment" I have never seen docs for this, but alongside the other documented "magic comments" there are: https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FLinuxCNC%2Flinuxcnc%2Fblob%2Fmaster%2Fsrc%2Femc%2Frs274ngc%2Finterp_convert.cc%23L1447&data=04%7C01%7Ctoddz%40pgrahamdunn.com%7Ca17c2381dda144b5cfc808d9fab3c60c%7C5758544c573f47cebee96c3e0806fb43%7C0%7C0%7C637816472649963804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=Yon3OqdIcfxdZNsqfF%2F%2BuhfM%2Bf5QcLFNpfc0atgUUMw%3D&reserved=0 -- atp "A motorcycle is a bicycle with a pandemonium attachment and is designed for the especial use of mechanical geniuses, daredevils and lunatics." - George Fitch, Atlanta Constitution Newspaper, 1912 _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Femc-users&data=04%7C01%7Ctoddz%40pgrahamdunn.com%7Ca17c2381dda144b5cfc808d9fab3c60c%7C5758544c573f47cebee96c3e0806fb43%7C0%7C0%7C637816472649963804%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=jzYEC%2FNw0My3j%2FAIykh0iOCvVRM1TRGxQj8oYPfeS1E%3D&reserved=0 _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users