From bf19c96113049994a4bda0a514820bb28ec3076d Mon Sep 17 00:00:00 2001 From: Anders Sandstrom Date: Tue, 8 Feb 2022 15:34:05 +0100 Subject: [PATCH] Test and fix auto start --- ecmc_plugin_grbl/ecmcGrbl.cpp | 12 +++++++++--- iocsh/test.script | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ecmc_plugin_grbl/ecmcGrbl.cpp b/ecmc_plugin_grbl/ecmcGrbl.cpp index 65a95d0..ac5c247 100644 --- a/ecmc_plugin_grbl/ecmcGrbl.cpp +++ b/ecmc_plugin_grbl/ecmcGrbl.cpp @@ -235,7 +235,7 @@ void ecmcGrbl::parseConfigStr(char *configStr) { } } -// Main program for writing configs and g-code to grbl +// Main program for grbl client (interaction with grbl, configs and g-code) void ecmcGrbl::doWriteWorker() { // simulate serial connection here (need mutex) std::string reply = ""; @@ -267,8 +267,8 @@ void ecmcGrbl::doWriteWorker() { delay_ms(2); } delay_ms(2); - - // Blocks until written + + // Write configs (blocks) if(cfgDbgMode_){ printf("GRBL: INFO: Configuration start\n"); } @@ -278,6 +278,12 @@ void ecmcGrbl::doWriteWorker() { // All configs done above writerBusy_ = false; + + if(cfgAutoStart_) { + setExecute(0); + setExecute(1); + } + for(;;) { // wait for execute diff --git a/iocsh/test.script b/iocsh/test.script index 475fa78..d1260db 100644 --- a/iocsh/test.script +++ b/iocsh/test.script @@ -84,7 +84,7 @@ epicsEnvSet("PLUGIN_VER" ,"develop") require ecmc_plugin_grbl $(PLUGIN_VER) epicsEnvSet(ECMC_PLUGIN_FILNAME,"/home/pi/epics/base-7.0.5/require/${E3_REQUIRE_VERSION}/siteMods/ecmc_plugin_grbl/$(PLUGIN_VER)/lib/${EPICS_HOST_ARCH=linux-x86_64}/libecmc_plugin_grbl.so") -epicsEnvSet(ECMC_PLUGIN_CONFIG,"DBG_PRINT=1;X_AXIS=1;Y_AXIS=2;SPINDLE_AXIS=3;AUTO_ENABLE=1;AUTO_START=0;") # Only one option implemented in this plugin +epicsEnvSet(ECMC_PLUGIN_CONFIG,"DBG_PRINT=1;X_AXIS=1;Y_AXIS=2;SPINDLE_AXIS=3;AUTO_ENABLE=1;AUTO_START=1;") # Only one option implemented in this plugin ${SCRIPTEXEC} ${ecmccfg_DIR}loadPlugin.cmd, "PLUGIN_ID=0,FILE=${ECMC_PLUGIN_FILNAME},CONFIG='${ECMC_PLUGIN_CONFIG}', REPORT=1" epicsEnvUnset(ECMC_PLUGIN_FILNAME) epicsEnvUnset(ECMC_PLUGIN_CONFIG) @@ -117,7 +117,7 @@ ecmcGrblLoadGCodeFile("./plc/gcode.nc",0) ############################################################################## ## PLC 0 -$(SCRIPTEXEC) $(ecmccfg_DIR)loadPLCFile.cmd, "PLC_ID=0, SAMPLE_RATE_MS=1000,FILE=./plc/grbl.plc") +#$(SCRIPTEXEC) $(ecmccfg_DIR)loadPLCFile.cmd, "PLC_ID=0, SAMPLE_RATE_MS=1000,FILE=./plc/grbl.plc") ############################################################################## ############# Configure diagnostics: