Identify ok or error from grbl

This commit is contained in:
Anders Sandstrom
2022-01-25 19:00:43 +01:00
parent 218ade3e2a
commit 1f9c162555
2 changed files with 11 additions and 6 deletions
+10 -6
View File
@@ -281,12 +281,16 @@ void ecmcGrbl::doWriteWorker() {
char c = ecmc_get_char_from_grbl_tx_buffer();
reply += c;
if(c == '\n'&& reply.length() > 1) {
printf("Reply from grbl: %s\n",reply.c_str());
//if not below strinsg then push messages.. how to handle?!
//#define ECMC_PLUGIN_GRBL_GRBL_OK_STRING "ok"
//#define ECMC_PLUGIN_GRBL_GRBL_ERR_STRING "error"
//Example "error:2"
break;
if(reply.find(ECMC_PLUGIN_GRBL_GRBL_OK_STRING) != std::string::npos) {
printf("Reply OK from grbl: %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());
break;
} else {
// lkeep waiting
printf("Non protocol value: %s\n",reply.c_str());
}
}
}
}
+1
View File
@@ -68,6 +68,7 @@ epicsEnvUnset(ECMC_PLUGIN_CONFIG)
ecmcGrblAddCommand("G1X20Y20F180");
ecmcGrblAddCommand("G2X0Y0R20");
ecmcGrblAddCommand("G0X10Y10");
ecmcGrblAddCommand("G2X0adadsdY0R20");
ecmcGrblAddCommand("G1X0Y20");
ecmcGrblAddCommand("G1X10Y0F360");
ecmcGrblAddCommand("G4P1");