Retrigger seems to work

This commit is contained in:
Anders Sandstrom
2022-02-08 15:11:45 +01:00
parent a358499141
commit 050412fb22
4 changed files with 119 additions and 2328 deletions

View File

@@ -289,19 +289,22 @@ void ecmcGrbl::doWriteWorker() {
}
// Execute auto enable
if(cfgDbgMode_){
printf("GRBL: INFO: auto enable\n");
if( cfgAutoEnable_) {
if(cfgDbgMode_){
printf("GRBL: INFO: auto enable\n");
}
autoEnableAxesSuccess();
}
autoEnableAxesSuccess();
// Write g-code commands
if(cfgDbgMode_){
printf("GRBL: INFO: Start load g-code\n");
}
if(!WriteGCodeSuccess()) {
return; // Something went seriously wrong, kill thread
}
}
executeCmd_ = 0;
writerBusy_ = false;
}
}
}
@@ -372,6 +375,7 @@ bool ecmcGrbl::WriteGCodeSuccess() {
if(command.length() == 0) {
continue;
}
printf("KHEWALHsl:dh:lashdlöaskd_akndsa_skjndläasldkjnlkasjfd\n");
//Write command (will block untill written)
grblWriteCommand(command);
@@ -393,9 +397,8 @@ bool ecmcGrbl::WriteGCodeSuccess() {
grblCommandBufferIndex_++;
}
else {
if( (( grblCommandBufferIndex_ >= grblCommandBuffer_.size()) || !executeCmd_ ) &&
grblInitDone_) {
writerBusy_ = 0;
if( ( (grblCommandBufferIndex_ >= grblCommandBuffer_.size()) || !executeCmd_) && grblInitDone_) {
writerBusy_ = 0;
return true; // code executed once
}
@@ -848,11 +851,15 @@ void ecmcGrbl::postExeAxes() {
// trigg start of g-code
int ecmcGrbl::setExecute(int exe) {
if(getParserBusy() && exe && !executeCmd_) {
return ECMC_PLUGIN_GRBL_BUSY_WARNING_CODE;
}
if(!executeCmd_ && exe) {
grblCommandBufferIndex_ = 0;
writerBusy_ = 1;
}
executeCmd_ = exe;
return 0;
}
@@ -914,8 +921,15 @@ void ecmcGrbl::addCommand(std::string command) {
if(cfgDbgMode_){
printf("%s:%s:%d:command %s\n",__FILE__,__FUNCTION__,__LINE__,command.c_str());
}
// ignore comments
std::string commandStrip = command.substr(0, command.find(ECMC_CONFIG_FILE_COMMENT_CHAR));
if (commandStrip.length()==0) {
return;
}
epicsMutexLock(grblCommandBufferMutex_);
grblCommandBuffer_.push_back(command.c_str());
grblCommandBuffer_.push_back(commandStrip.c_str());
epicsMutexUnlock(grblCommandBufferMutex_);
if(cfgDbgMode_){
printf("%s:%s:%d: GRBL: INFO: Buffer size %d\n",

View File

@@ -35,6 +35,8 @@
#define ECMC_PLUGIN_AUTO_ENABLE_TIMEOUT_ERROR_CODE 0x106
#define ECMC_PLUGIN_CONFIG_ERROR_CODE 0x107
#define ECMC_PLUGIN_GRBL_BUSY_WARNING_CODE 0x200
#define ECMC_PLUGIN_AUTO_ENABLE_TIME_OUT_SEC 10
#define ECMC_PLUGIN_GRBL_GRBL_STARTUP_STRING "for help]"

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,15 @@
# Test nc g-code
G1X20Y20F360
S1000
M03
G4P2
G2X0Y0R20
G4P2
G0X10Y10
G2X10Y-10R10
M05
G4P2
G1X0Y0
G1X20Y20F360
G4P2
G2X0Y0R20
#G4P2
#G0X10Y10
#G2X10Y-10R10
#M05
#G4P2
#G1X0Y0
#G1X20Y20F360
#G4P2
#G2X0Y0R20