From 61bfb33edbdc0bd0becad69b4db0d0d8f85512e3 Mon Sep 17 00:00:00 2001 From: Anders Sandstrom Date: Tue, 25 Jan 2022 19:37:34 +0100 Subject: [PATCH] WIP --- ecmc_plugin_grbl/ecmcGrbl.cpp | 12 +++++------- ecmc_plugin_grbl/ecmcGrblDefs.h | 4 ++-- iocsh/test.script | 3 ++- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ecmc_plugin_grbl/ecmcGrbl.cpp b/ecmc_plugin_grbl/ecmcGrbl.cpp index d5ddfbc..b34ebee 100644 --- a/ecmc_plugin_grbl/ecmcGrbl.cpp +++ b/ecmc_plugin_grbl/ecmcGrbl.cpp @@ -258,13 +258,10 @@ void ecmcGrbl::doWriteWorker() { // GRBL ready, now we can send comamnds for(;;) { if(grblCommandBuffer_.size()>0 && getEcmcEpicsIOCState()==16 && autoEnableExecuted_) { - //printf("%s:%s:%d: Command in buffer!!!\n",__FILE__,__FUNCTION__,__LINE__); epicsMutexLock(grblCommandBufferMutex_); std::string command = grblCommandBuffer_.front(); grblCommandBuffer_.pop(); epicsMutexUnlock(grblCommandBufferMutex_); - //printf("%s:%s:%d: Command length %d!!!\n",__FILE__,__FUNCTION__,__LINE__,strlen(command.c_str())); - //printf("%s:%s:%d: Available bytes %d!!!\n",__FILE__,__FUNCTION__,__LINE__,serial_get_rx_buffer_available()); // wait for grbl while(serial_get_rx_buffer_available() <= strlen(command.c_str())+1) { delay_ms(1); @@ -282,14 +279,15 @@ void ecmcGrbl::doWriteWorker() { reply += c; if(c == '\n'&& reply.length() > 1) { if(reply.find(ECMC_PLUGIN_GRBL_GRBL_OK_STRING) != std::string::npos) { - printf("Reply OK from grbl: %s\n",reply.c_str()); + printf("GRBL Reply: OK: %s\n",reply.c_str()); break; } else if(reply.find(ECMC_PLUGIN_GRBL_GRBL_ERR_STRING) != std::string::npos) { - printf("Reply ERROR from grbl: %s\n",reply.c_str()); + printf("GRBL Reply: ERROR: %s\n",reply.c_str()); + break; } else { - // lkeep waiting - printf("Non protocol value: %s\n",reply.c_str()); + // keep waiting + printf("GRBL Reply: Non protocol: %s\n",reply.c_str()); } } } diff --git a/ecmc_plugin_grbl/ecmcGrblDefs.h b/ecmc_plugin_grbl/ecmcGrblDefs.h index ce04a4f..57c7f2b 100644 --- a/ecmc_plugin_grbl/ecmcGrblDefs.h +++ b/ecmc_plugin_grbl/ecmcGrblDefs.h @@ -23,9 +23,9 @@ #define ECMC_PLUGIN_ASYN_PREFIX "plugin.grbl" -#define ECMC_PLUGIN_GRBL_GENERAL_ERROR_CODE 1 +#define ECMC_PLUGIN_GRBL_GENERAL_ERROR_CODE 0x100 #define ECMC_PLUGIN_GRBL_GRBL_STARTUP_STRING "for help]" #define ECMC_PLUGIN_GRBL_GRBL_OK_STRING "ok" -#define ECMC_PLUGIN_GRBL_GRBL_ERR_STRING "err" +#define ECMC_PLUGIN_GRBL_GRBL_ERR_STRING "error" #endif /* ECMC_GRBL_DEFS_H_ */ diff --git a/iocsh/test.script b/iocsh/test.script index 5cd5997..4b32745 100644 --- a/iocsh/test.script +++ b/iocsh/test.script @@ -113,7 +113,8 @@ $(SCRIPTEXEC) ($(ecmccfg_DIR)setAppMode.cmd) #asynSetTraceMask(MC_CPU1, -1, 0x41) # Note need to test 0x21 later.. -asynSetTraceMask(MC_CPU1, -1, 0x0) +#asynSetTraceMask(MC_CPU1, -1, 0x21) +asynSetTraceMask(MC_CPU1, -1, 0x41) iocInit() dbpf $(IOC):Axis1.SPAM 0