diff --git a/ecmc_plugin_grbl/ecmcGrbl.cpp b/ecmc_plugin_grbl/ecmcGrbl.cpp index c1bc11e..882df79 100644 --- a/ecmc_plugin_grbl/ecmcGrbl.cpp +++ b/ecmc_plugin_grbl/ecmcGrbl.cpp @@ -263,7 +263,7 @@ void ecmcGrbl::doWriteWorker() { printf("GRBL: INFO: Wait for IOC state RUN \n"); } // wait for epics state - while(getEcmcEpicsIOCState()!=16) { + while(getEcmcEpicsIOCState()!=16 && getEcmcEpicsIOCState()!=29) { delay_ms(2); } delay_ms(2); @@ -391,7 +391,7 @@ bool ecmcGrbl::WriteGCodeSuccess() { setReset(0); setReset(1); setReset(0); - printf("SOMETHING BAD HAPPEND!!!!\n"); + printf("GRBL: ERROR: Grbl reply not OK (motion stopped)\n"); grblCommandBufferIndex_ = 0; return false; // for loop } @@ -399,7 +399,7 @@ bool ecmcGrbl::WriteGCodeSuccess() { grblCommandBufferIndex_++; } else { - printf("NO MORE COMMANDS in buffer!!!\n"); + printf("GRBL: INFO: No more commands in buffer!!!\n"); if( ( (grblCommandBufferIndex_ >= grblCommandBuffer_.size()) || !executeCmd_) && grblInitDone_) { writerBusy_ = 0; return true; // code executed once @@ -415,8 +415,8 @@ bool ecmcGrbl::WriteGCodeSuccess() { void ecmcGrbl::grblWriteCommand(std::string command) { // wait for grbl while(serial_get_rx_buffer_available() <= strlen(command.c_str()+1)) { - printf("WAITING for freee in buffer %d %d\n",serial_get_rx_buffer_available(),strlen(command.c_str()+1)); - delay_ms(1000); + //printf("WAITING for free in buffer %d %d\n",serial_get_rx_buffer_available(),strlen(command.c_str()+1)); + delay_ms(10); } ecmc_write_command_serial(strdup(command.c_str())); if(cfgDbgMode_){ @@ -889,7 +889,7 @@ int ecmcGrbl::getBusy() { return getEcmcEpicsIOCState()!=16 || writerBusy_ || stepperInterruptEnable || !grblInitDone_; } -int ecmcGrbl::getParserBusy() { +int ecmcGrbl::getParserBusy() { return getEcmcEpicsIOCState()!=16 || writerBusy_ || !grblInitDone_; } @@ -987,7 +987,7 @@ void ecmcGrbl::addConfig(std::string command) { __FILE__,__FUNCTION__,__LINE__,ECMC_PLUGIN_CONFIG_ERROR_CODE); return; } - + commandStrip+='\n'; epicsMutexLock(grblConfigBufferMutex_); diff --git a/grbl/grbl_gcode.c b/grbl/grbl_gcode.c index 637cde6..08ac0c5 100644 --- a/grbl/grbl_gcode.c +++ b/grbl/grbl_gcode.c @@ -69,7 +69,7 @@ void gc_sync_position() uint8_t gc_execute_line(char *line) { PRINTF_DEBUG(""); - printf("gc_execute_line: %s\n",line); + //printf("gc_execute_line: %s\n",line); if(strlen(line)<2) { return(STATUS_OK); } diff --git a/grbl/grbl_protocol.c b/grbl/grbl_protocol.c index c894d9f..2f4866c 100644 --- a/grbl/grbl_protocol.c +++ b/grbl/grbl_protocol.c @@ -104,7 +104,7 @@ void protocol_main_loop() report_status_message(STATUS_SYSTEM_GC_LOCK); } else { // Parse and execute g-code block. - printf("protocol: Line to gc_execute %s\n",line); + //printf("protocol: Line to gc_execute %s\n",line); if(strlen(line)>1) { report_status_message(gc_execute_line(line)); diff --git a/grbl/grbl_serial.c b/grbl/grbl_serial.c index 6cdf7b8..73a34f7 100644 --- a/grbl/grbl_serial.c +++ b/grbl/grbl_serial.c @@ -291,20 +291,20 @@ void ecmc_write_command_serial(char* line) { //ecmc_add_char_to_buffer('\n'); - printf("Serial Buffer tail %u head %u, avail %u\n",serial_rx_buffer_tail,serial_rx_buffer_head,serial_get_rx_buffer_available()); - for(i = 0;i