Time to revisit coolant mapping of M-codes in Linuxcnc

More
13 Oct 2024 23:27 #312012 by smc.collins
I haven't looked but I am fairly sure the the software supports mcode with decimal places ? M7.0 or m7.1  etc and so on. 

the current coolant/cutting fluid controls are way to limited and require to much special handling. It would make sense to update the current scheme with mcode that could be numbers 

M7.1 air blast
M7.2 mist
M7.3 flood
M7.4 through tool 

etc and so forth. I can modify the existing post processor but where exactly would this change have to be made in the core of the linuxcnc software base ? Also the existing mcodes for coolant can be left standing. I am just trying to avoid creating custom mcodes for controlling the various cooling systems I am adding to my machines, but many NEWER cnc machines also have many varying types of coolant schemes. 

Please Log in or Create an account to join the conversation.

More
14 Oct 2024 05:14 #312030 by spumco
Minor suggestion - leave the mist as M7, and flood as M8 and save the 'derivative' M-codes as M7.n or M8.n

M8 - main flood
M8.1 - supplemental
M8.2 - TSC
M8.3 - washdown

M7 - main mist
M7.1 - supplemental

Etc.
The following user(s) said Thank You: smc.collins

Please Log in or Create an account to join the conversation.

More
14 Oct 2024 06:46 #312034 by Aciera

haven't looked but I am fairly sure the the software supports mcode with decimal places ? M7.0 or m7.1 etc and so on.


As far as I'm aware Mcode numbers must be integers (Gcodes can have decimals)
You could create a single custom mcode with a P word though.
The following user(s) said Thank You: smc.collins

Please Log in or Create an account to join the conversation.

More
15 Oct 2024 17:16 - 15 Oct 2024 17:21 #312182 by smc.collins
Ok, so configure coolant m codes as follows

M7 p1 mist
M7 p2 derivative 

M8 p1 flood
M8 p2 through tool
M8 P3  high pressure through tool

M9  p01 mist off
M9 p100 all off 



As kind of a loose structure?

Thanks for the reply. If anyone knows where in the code base to look for this stuff it'd be nice to save me the time of having to dig through tons of folders and files

Thanks
Last edit: 15 Oct 2024 17:21 by smc.collins.

Please Log in or Create an account to join the conversation.

More
15 Oct 2024 17:48 #312183 by Aciera
I was actually picturing a remapped (ie currently unused Mcode). This would be a rather simple gcode remap where you could then use 'motion.digital-out' pins for the appropriate coolant flow.

Actually adding this to the source code will likely involve
a) a number of files in '/src/emc/rs274ngc'
b) pose the additional challenge of there not being a suitable NML command for all the different coolant variants you have in mind.
The following user(s) said Thank You: spumco

Please Log in or Create an account to join the conversation.

More
15 Oct 2024 21:21 #312202 by spumco

I was actually picturing a remapped (ie currently unused Mcode). This would be a rather simple gcode remap where you could then use 'motion.digital-out' pins for the appropriate coolant flow.

Actually adding this to the source code will likely involve
a) a number of files in '/src/emc/rs274ngc'
b) pose the additional challenge of there not being a suitable NML command for all the different coolant variants you have in mind.
 

This is what I did for my non-standard cooling stuff.  Just cooked up some Mnn.ngc files to take care of stuff like spindle taper air blast, washdown, and multi-mist nozzles on my gang lathe.

Please Log in or Create an account to join the conversation.

More
15 Oct 2024 21:58 #312203 by smc.collins

I was actually picturing a remapped (ie currently unused Mcode). This would be a rather simple gcode remap where you could then use 'motion.digital-out' pins for the appropriate coolant flow.

Actually adding this to the source code will likely involve
a) a number of files in '/src/emc/rs274ngc'
b) pose the additional challenge of there not being a suitable NML command for all the different coolant variants you have in mind.
 
This is what I did for my non-standard cooling stuff.  Just cooked up some Mnn.ngc files to take care of stuff like spindle taper air blast, washdown, and multi-mist nozzles on my gang lathe.

are you at liberty to share those mappings ? 

Please Log in or Create an account to join the conversation.

More
15 Oct 2024 21:59 #312204 by smc.collins

I was actually picturing a remapped (ie currently unused Mcode). This would be a rather simple gcode remap where you could then use 'motion.digital-out' pins for the appropriate coolant flow.

Actually adding this to the source code will likely involve
a) a number of files in '/src/emc/rs274ngc'
b) pose the additional challenge of there not being a suitable NML command for all the different coolant variants you have in mind.

The issue at hand, the lack of NML commands is a problem that requires a lot of extra effort for every retrofit that could be solve once and be done with. 

Please Log in or Create an account to join the conversation.

More
16 Oct 2024 01:47 #312216 by spumco

are you at liberty to share those mappings ? 

They're just basic xxx.ngc subroutine files, specified in the INI file. Not an actual remap of an existing M-code with new behavior and -P/-Q passthrough params.
[RS274NGC]
PARAMETER_FILE = lathe.var
USER_M_PATH = /home/lathe/linuxcnc/configs/LATHE_REV1.53/MCODES/
SUBROUTINE_PATH = /home/lathe/linuxcnc/configs/LATHE_REV1.53/subroutines
RS274NGC_STARTUP_CODE = F10 S0 G7 G18 G20 G40 G49 G54 G64 P0.001 G80 G90 G91.1 G92.1 G94 G97 G98
;ORIENT_OFFSET =
#REMAP=G12.1 ngc=g121
#REMAP=G13.1 ngc=g131
REMAP=M200  modalgroup=10   ngc=m200
REMAP=M201  modalgroup=10   ngc=m201
REMAP=M202  modalgroup=10   ngc=m202
REMAP=M203  modalgroup=10   ngc=m203
REMAP=M210  modalgroup=10   ngc=m210
REMAP=M211  modalgroup=10   ngc=m211
REMAP=M212  modalgroup=10   ngc=m212
REMAP=M213  modalgroup=10   ngc=m213
REMAP=M220  modalgroup=10   ngc=m220
REMAP=M221  modalgroup=10   ngc=m221
REMAP=M222  modalgroup=10   ngc=m222
REMAP=M223  modalgroup=10   ngc=m223
REMAP=M268  modalgroup=10   ngc=m268
REMAP=M269  modalgroup=10   ngc=m269

M210 to M213 are my extra mist valves.  Subroutines look like this:
o<m210> sub

;MIST 2 ON

;MIST2 VALVE             motion.digital-out-00
;MIST3 VALVE             motion.digital-out-01

M64 P0                                  ;TURN ON MIST2 VALVE

o<m210> endsub [1]
M2

The other ones are main and sub drawbars, and 268/269 are G10 front/back tool rotations (hoping to incorporate that in post processor so the display automatically flips to the right orientation).

I could have mapped them to a more logical M-code number... Maybe I'll see if m207.1.ngc & m207.2.ngc work and not cause LCNC to vomit.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
16 Oct 2024 09:04 #312226 by Aciera

The issue at hand, the lack of NML commands is a problem that requires a lot of extra effort for every retrofit that could be solve once and be done with.


Just to give you an idea of what you may be up against (there is likely a fair bit more):
./src/emc/task/emccanon.cc:2344:void FLOOD_OFF()
./src/emc/task/emccanon.cc:2346:    EMC_COOLANT_FLOOD_OFF flood_off_msg;
./src/emc/task/emccanon.cc:2353:void FLOOD_ON()
./src/emc/task/emccanon.cc:2355:    EMC_COOLANT_FLOOD_ON flood_on_msg;
./src/emc/task/emccanon.cc:2811:int GET_EXTERNAL_FLOOD()
./src/emc/task/taskclass.cc:646:    EMC_COOLANT_FLOOD_ON floodOnMsg;
./src/emc/task/taskclass.cc:655:    EMC_COOLANT_FLOOD_OFF floodOffMsg;
./src/emc/task/emctaskmain.cc:938:	    case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:939:	    case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/task/emctaskmain.cc:1051:		case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:1052:		case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/task/emctaskmain.cc:1164:                case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:1165:                case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/task/emctaskmain.cc:1228:		case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:1229:		case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/task/emctaskmain.cc:1323:                case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:1324:                case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/task/emctaskmain.cc:1393:	    case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:1394:	    case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/task/emctaskmain.cc:1541:    case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:1542:    case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/task/emctaskmain.cc:2048:    case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:2052:    case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/task/emctaskmain.cc:2474:    case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/task/emctaskmain.cc:2475:    case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/canterp/canterp.cc:29:  11 N0080  FLOOD_OFF()
./src/emc/canterp/canterp.cc:374:    if (!strcmp(the_command_name, "FLOOD_OFF")) {
./src/emc/canterp/canterp.cc:375:	FLOOD_OFF();
./src/emc/canterp/canterp.cc:384:    if (!strcmp(the_command_name, "FLOOD_ON")) {
./src/emc/canterp/canterp.cc:385:	FLOOD_ON();
./src/emc/rs274ngc/rs274ngc_pre.cc:2036:  _setup.flood = GET_EXTERNAL_FLOOD();
./src/emc/rs274ngc/rs274ngc_pre.cc:2198:        tag.flags[GM_FLAG_MIST] ? 7 : tag.flags[GM_FLAG_FLOOD] ? -1 : 9;
./src/emc/rs274ngc/rs274ngc_pre.cc:2200:        tag.flags[GM_FLAG_FLOOD] ? 8 : -1;
./src/emc/rs274ngc/interp_convert.cc:3537:      enqueue_FLOOD_ON();
./src/emc/rs274ngc/interp_convert.cc:3542:      enqueue_FLOOD_OFF();
./src/emc/rs274ngc/interp_convert.cc:4552:9. Coolant is turned off (like M9)                    - FLOOD_OFF & MIST_OFF
./src/emc/rs274ngc/interp_convert.cc:4679:      FLOOD_OFF();
./src/emc/rs274ngc/interp_namedparams.cc:79:    NP_FLOOD,
./src/emc/rs274ngc/interp_namedparams.cc:625:    case NP_FLOOD: // flood
./src/emc/rs274ngc/interp_namedparams.cc:911:  init_readonly_param("_flood", NP_FLOOD, PA_USE_LOOKUP);
./src/emc/rs274ngc/interp_queue.hh:19:                                QMIST_ON, QMIST_OFF, QFLOOD_ON, QFLOOD_OFF,
./src/emc/rs274ngc/interp_queue.hh:114:void enqueue_FLOOD_ON(void);
./src/emc/rs274ngc/interp_queue.hh:115:void enqueue_FLOOD_OFF(void);
./src/emc/rs274ngc/interp_queue.cc:132:void enqueue_FLOOD_ON(void) {
./src/emc/rs274ngc/interp_queue.cc:135:        FLOOD_ON();
./src/emc/rs274ngc/interp_queue.cc:139:    q.type = QFLOOD_ON;
./src/emc/rs274ngc/interp_queue.cc:144:void enqueue_FLOOD_OFF(void) {
./src/emc/rs274ngc/interp_queue.cc:147:        FLOOD_OFF();
./src/emc/rs274ngc/interp_queue.cc:151:    q.type = QFLOOD_OFF;
./src/emc/rs274ngc/interp_queue.cc:507:        case QFLOOD_ON:
./src/emc/rs274ngc/interp_queue.cc:509:            FLOOD_ON();
./src/emc/rs274ngc/interp_queue.cc:511:        case QFLOOD_OFF:
./src/emc/rs274ngc/interp_queue.cc:513:            FLOOD_OFF();
./src/emc/rs274ngc/gcodemodule.cc:460:void FLOOD_OFF() {}
./src/emc/rs274ngc/gcodemodule.cc:462:void FLOOD_ON() {}
./src/emc/rs274ngc/gcodemodule.cc:583:int GET_EXTERNAL_FLOOD() { return 0; }
./src/emc/rs274ngc/interp_write.cc:317:    state.flags[GM_FLAG_FLOOD] = (settings->flood);
./src/emc/rs274ngc/canonmodule.cc:123:    def("FLOOD_OFF",&FLOOD_OFF);
./src/emc/rs274ngc/canonmodule.cc:124:    def("FLOOD_ON",&FLOOD_ON);
./src/emc/rs274ngc/canonmodule.cc:134:    def("GET_EXTERNAL_FLOOD",&GET_EXTERNAL_FLOOD);
./src/emc/rs274ngc/canonmodule.cc:256:    def("enqueue_FLOOD_ON", &enqueue_FLOOD_ON);
./src/emc/rs274ngc/canonmodule.cc:257:    def("enqueue_FLOOD_OFF", &enqueue_FLOOD_OFF);
./src/emc/motion/state_tag.h:51:    GM_FLAG_FLOOD,
./src/emc/nml_intf/emc.hh:219:#define EMC_COOLANT_FLOOD_ON_TYPE                    ((NMLTYPE) 1406)
./src/emc/nml_intf/emc.hh:220:#define EMC_COOLANT_FLOOD_OFF_TYPE                   ((NMLTYPE) 1407)
./src/emc/nml_intf/canon.hh:647:extern void FLOOD_OFF();
./src/emc/nml_intf/canon.hh:649:extern void FLOOD_ON();
./src/emc/nml_intf/canon.hh:785:extern int GET_EXTERNAL_FLOOD();
./src/emc/nml_intf/emc.cc:141:    case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/nml_intf/emc.cc:142:	((EMC_COOLANT_FLOOD_OFF *) buffer)->update(cms);
./src/emc/nml_intf/emc.cc:144:    case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/nml_intf/emc.cc:145:	((EMC_COOLANT_FLOOD_ON *) buffer)->update(cms);
./src/emc/nml_intf/emc.cc:544:    case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/nml_intf/emc.cc:545:	return "EMC_COOLANT_FLOOD_OFF";
./src/emc/nml_intf/emc.cc:546:    case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/nml_intf/emc.cc:547:	return "EMC_COOLANT_FLOOD_ON";
./src/emc/nml_intf/emc.cc:2555:*	NML/CMS Update function for EMC_COOLANT_FLOOD_OFF
./src/emc/nml_intf/emc.cc:2559:void EMC_COOLANT_FLOOD_OFF::update(CMS * cms)
./src/emc/nml_intf/emc.cc:2695:*	NML/CMS Update function for EMC_COOLANT_FLOOD_ON
./src/emc/nml_intf/emc.cc:2699:void EMC_COOLANT_FLOOD_ON::update(CMS * cms)
./src/emc/nml_intf/emc_nml.hh:1942:class EMC_COOLANT_FLOOD_ON:public EMC_COOLANT_CMD_MSG {
./src/emc/nml_intf/emc_nml.hh:1944:    EMC_COOLANT_FLOOD_ON():EMC_COOLANT_CMD_MSG(EMC_COOLANT_FLOOD_ON_TYPE,
./src/emc/nml_intf/emc_nml.hh:1946:					       (EMC_COOLANT_FLOOD_ON)) {
./src/emc/nml_intf/emc_nml.hh:1953:class EMC_COOLANT_FLOOD_OFF:public EMC_COOLANT_CMD_MSG {
./src/emc/nml_intf/emc_nml.hh:1955:    EMC_COOLANT_FLOOD_OFF():EMC_COOLANT_CMD_MSG(EMC_COOLANT_FLOOD_OFF_TYPE,
./src/emc/nml_intf/emc_nml.hh:1957:						(EMC_COOLANT_FLOOD_OFF)) {
./src/emc/iotask/ioControl_v2.cc:1223:        case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/iotask/ioControl_v2.cc:1224:            rtapi_print_msg(RTAPI_MSG_DBG, "EMC_COOLANT_FLOOD_ON\n");
./src/emc/iotask/ioControl_v2.cc:1229:        case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/iotask/ioControl_v2.cc:1230:            rtapi_print_msg(RTAPI_MSG_DBG, "EMC_COOLANT_FLOOD_OFF\n");
./src/emc/iotask/ioControl.cc:1071:        case EMC_COOLANT_FLOOD_ON_TYPE:
./src/emc/iotask/ioControl.cc:1072:            rtapi_print_msg(RTAPI_MSG_DBG, "EMC_COOLANT_FLOOD_ON\n");
./src/emc/iotask/ioControl.cc:1077:        case EMC_COOLANT_FLOOD_OFF_TYPE:
./src/emc/iotask/ioControl.cc:1078:            rtapi_print_msg(RTAPI_MSG_DBG, "EMC_COOLANT_FLOOD_OFF\n");
grep: ./src/emc/usr_intf/gmoccapy/__pycache__/gmoccapy.cpython-310.pyc: binary file matches
./src/emc/usr_intf/gmoccapy/gmoccapy.py:4122:            self.command.flood(linuxcnc.FLOOD_ON)
./src/emc/usr_intf/gmoccapy/gmoccapy.py:4125:            self.command.flood(linuxcnc.FLOOD_OFF)
./src/emc/usr_intf/axis/extensions/emcmodule.cc:57:#define LOCAL_FLOOD_ON (1)
./src/emc/usr_intf/axis/extensions/emcmodule.cc:58:#define LOCAL_FLOOD_OFF (0)
./src/emc/usr_intf/axis/extensions/emcmodule.cc:1051:        case LOCAL_FLOOD_ON:
./src/emc/usr_intf/axis/extensions/emcmodule.cc:1053:            EMC_COOLANT_FLOOD_ON m;
./src/emc/usr_intf/axis/extensions/emcmodule.cc:1057:        case LOCAL_FLOOD_OFF:
./src/emc/usr_intf/axis/extensions/emcmodule.cc:1059:            EMC_COOLANT_FLOOD_OFF m;
./src/emc/usr_intf/axis/extensions/emcmodule.cc:1064:            PyErr_Format(PyExc_ValueError,"FLOOD should be FLOOD_ON or FLOOD_OFF");
./src/emc/usr_intf/axis/extensions/emcmodule.cc:2471:    ENUMX(6, LOCAL_FLOOD_ON);
./src/emc/usr_intf/axis/extensions/emcmodule.cc:2472:    ENUMX(6, LOCAL_FLOOD_OFF);
./src/emc/usr_intf/shcom.cc:674:    EMC_COOLANT_FLOOD_ON emc_coolant_flood_on_msg;
./src/emc/usr_intf/shcom.cc:688:    EMC_COOLANT_FLOOD_OFF emc_coolant_flood_off_msg;
./src/emc/usr_intf/stepconf/build_HAL.py:198:        if SIG.FLOOD in outputs:
./src/emc/usr_intf/stepconf/stepconf.py:177:            self.MIST, self.FLOOD, self.ESTOP, self.AMP,
grep: ./src/emc/usr_intf/stepconf/__pycache__/stepconf.cpython-310.pyc: binary file matches
grep: ./src/emc/usr_intf/stepconf/__pycache__/build_HAL.cpython-310.pyc: binary file matches
./src/emc/usr_intf/pncconf/private_data.py:177:            S.MIST,S.FLOOD,S.ESTOP,S.AMP,
grep: ./src/emc/usr_intf/pncconf/__pycache__/private_data.cpython-310.pyc: binary file matches
./src/emc/usr_intf/halui.cc:1096:    EMC_COOLANT_FLOOD_ON emc_coolant_flood_on_msg;
./src/emc/usr_intf/halui.cc:1103:    EMC_COOLANT_FLOOD_OFF emc_coolant_flood_off_msg;
./src/emc/usr_intf/emcrsh.cc:480:  "TIME", "ESTOP", "MACHINE", "MODE", "MIST", "FLOOD", "LUBE", "LUBE_LEVEL",
./src/emc/usr_intf/emcrsh.cc:1629:  const char *pFloodStr = "FLOOD %s";
./src/emc/sai/saicanon.cc:617:void FLOOD_OFF()
./src/emc/sai/saicanon.cc:619:  PRINT("FLOOD_OFF()\n");
./src/emc/sai/saicanon.cc:623:void FLOOD_ON()
./src/emc/sai/saicanon.cc:625:  PRINT("FLOOD_ON()\n");
./src/emc/sai/saicanon.cc:748:int GET_EXTERNAL_FLOOD()

Consider the effort it would take to expand that against spending maybe an hour to create a new Mcode remap for a more granular coolant handling and adding a filter script to change the PP output to the new Mcode (or adjusting the PP itself).
The following user(s) said Thank You: smc.collins

Please Log in or Create an account to join the conversation.

Time to create page: 0.115 seconds
Powered by Kunena Forum