CustomNMLMessage - rmu75/linuxcnc-wiki GitHub Wiki


date: '2005-03-28T16:15:29' title: CustomNMLMessage

Right, EMC is pretty awsome, but some parts need some tweaking. As you know communication is done through NML channels, the data sent through souch a channel is one of the classes defined in emc.hh (implemented in emc.cc). If somebody needs a message type that doesn't exist, he should follow these steps to add a new one. (The Message I added in the example is called EMC_IO_GENERIC (inherits EMC_IO_CMD_MSG (inherits RCS_CMD_MSG)))

  1. add the definition of the EMC_IO_GENERIC class to emc2/src/emc/nml_intf/emc.hh
  2. add the type define: #define EMC_IO_GENERIC_TYPE ((NMLTYPE) 1605) - (I chose 1605, because it was available) to emc2/src/emc/nml_intf/emc.hh
  3. add case EMC_IO_GENERIC_TYPE to emcFormat in emc2/src/emc/nml_intf/emc.cc
  4. add case EMC_IO_GENERIC_TYPE to emc_symbol_lookup in emc2/src/emc/nml_intf/emc.cc
  5. added EMC_IO_GENERIC::update function to emc2/src/emc/nml_intf/emc.cc

recompile, and the new message should be there. The next part is to send such messages from somewhere, and receive them in another place, and do some stuff with it.