From ca82717dc7f4e4cb98057a5d5ae385fff5213622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Sandstr=C3=B6m?= Date: Mon, 16 Dec 2024 09:14:08 +0100 Subject: [PATCH] New plg concept --- GNUmakefile | 5 ++++- ecmc_plugin_grbl/ecmcPluginGrbl.c | 37 +++++++++++++------------------ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 31e8442..e562e8c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -2,6 +2,9 @@ include /ioc/tools/driver.makefile MODULE = ecmc_plugin_grbl +# "Transfer" module name to plugin +USR_CFLAGS +=-DECMC_PLUGIN_MODULE_NAME=${MODULE} + BUILDCLASSES = Linux ARCH_FILTER = deb10% @@ -17,7 +20,7 @@ OPT_CXXFLAGS_YES = -O3 # dependencies ECmasterECMC_VERSION = v1.1.0 motorECMC_VERSION = 7.0.7-ESS -ecmc_VERSION = v9.0.1_RC1 +ecmc_VERSION = sandst_a ################################################################################ # THIS RELATES TO THE EtherCAT MASTER LIBRARY diff --git a/ecmc_plugin_grbl/ecmcPluginGrbl.c b/ecmc_plugin_grbl/ecmcPluginGrbl.c index cd2bfb0..b91be67 100644 --- a/ecmc_plugin_grbl/ecmcPluginGrbl.c +++ b/ecmc_plugin_grbl/ecmcPluginGrbl.c @@ -47,7 +47,7 @@ pthread_t tid; * Return value other than 0 will be considered error. * configStr can be used for configuration parameters. **/ -int grblConstruct(char *configStr) +static int grblConstruct(char *configStr) { // only allow one loaded module if(alreadyLoaded) { @@ -64,7 +64,7 @@ int grblConstruct(char *configStr) /** Optional function. * Will be called once at unload. **/ -void grblDestruct(void) +static void grblDestruct(void) { if(lastConfStr){ free(lastConfStr); @@ -78,7 +78,7 @@ void grblDestruct(void) * this plugin to react on ecmc errors * Return value other than 0 will be considered to be an error code in ecmc. **/ -int grblRealtime(int ecmcError) +static int grblRealtime(int ecmcError) { lastEcmcError = ecmcError; return realtime(ecmcError); @@ -87,7 +87,7 @@ int grblRealtime(int ecmcError) /** Link to data source here since all sources should be availabe at this stage * (for example ecmc PLC variables are defined only at enter of realtime) **/ -int grblEnterRT(){ +static int grblEnterRT(){ return enterRT(); } @@ -95,63 +95,58 @@ int grblEnterRT(){ * Will be called once just before leaving realtime mode * Return value other than 0 will be considered error. **/ -int grblExitRT(void){ +static int grblExitRT(void){ return 0; } // Plc function for execute grbl code -double grbl_set_execute(double exe) { +static double grbl_set_execute(double exe) { return setExecute((int)exe); } // Plc function for halt grbl -double grbl_mc_halt(double halt) { +static double grbl_mc_halt(double halt) { return setHalt((int)halt); } // Plc function for resume grbl -double grbl_mc_resume(double halt) { +static double grbl_mc_resume(double halt) { return setResume((int)halt); } // Plc function for reset grbl -//double grbl_mc_reset(double halt) { -// return setReset((int)halt); -//} - -// Plc function for reset grbl -double grbl_get_busy() { +static double grbl_get_busy() { return getBusy(); } // Plc function for reset grbl -double grbl_get_parser_busy() { +static double grbl_get_parser_busy() { return getParserBusy(); } // Plc function for reset grbl -double grbl_get_code_row_num() { +static double grbl_get_code_row_num() { return getCodeRowNum(); } -double grbl_reset_error() { +static double grbl_reset_error() { return resetError(); } -double grbl_get_error() { +static double grbl_get_error() { return getError(); } -double grbl_get_all_enabled() { +static double grbl_get_all_enabled() { return getAllAxesEnabled(); } -double grbl_set_all_enable(double enable) { +static double grbl_set_all_enable(double enable) { return setAllAxesEnable(enable); } // Register data for plugin so ecmc know what to use -struct ecmcPluginData pluginDataDef = { +static struct ecmcPluginData pluginDataDef = { // Allways use ECMC_PLUG_VERSION_MAGIC .ifVersion = ECMC_PLUG_VERSION_MAGIC, // Name