Load grbl cfg file works

This commit is contained in:
Anders Sandstrom
2022-02-08 12:00:18 +01:00
parent b9d97d08bd
commit 5e6be3c4f1
4 changed files with 1108 additions and 422 deletions

View File

@@ -957,15 +957,21 @@ void ecmcGrbl::addConfig(std::string command) {
return;
}
std::size_t found = command.find(ECMC_CONFIG_GRBL_CONFIG_CHAR);
// ignore comments
std::string commandStrip = command.substr(0, command.find(ECMC_CONFIG_FILE_COMMENT_CHAR));
if (commandStrip.length()==0) {
return;
}
std::size_t found = commandStrip.find(ECMC_CONFIG_GRBL_CONFIG_CHAR);
if (found==std::string::npos) {
printf("%s:%s:%d: GRBL: ERROR: Configuration command not valid (0x%x)\n",
__FILE__,__FUNCTION__,__LINE__,ECMC_PLUGIN_CONFIG_ERROR_CODE);
return;
}
epicsMutexLock(grblConfigBufferMutex_);
grblConfigBuffer_.push_back(command.c_str());
epicsMutexLock(grblConfigBufferMutex_);
grblConfigBuffer_.push_back(commandStrip.c_str());
epicsMutexUnlock(grblConfigBufferMutex_);
if(cfgDbgMode_){
printf("%s:%s:%d: GRBL: INFO: Buffer size %d\n",

20
iocsh/cfg/grbl.cfg Normal file
View File

@@ -0,0 +1,20 @@
# Configuration file for grbl
#
# Supported variables:
# $11 - Junction deviation, mm
# $12 Arc tolerance, mm
# $30 - Max spindle speed, RPM
# $31 - Min spindle speed, RPM
# $100, $101 and $102 [X,Y,Z] steps/mm
# $110, $111 and $112 [X,Y,Z] Max rate, mm/min
# $120, $121, $122 [X,Y,Z] Acceleration, mm/sec^2
#
# Example: Set Max spindle speed to 1000rpm
# $30=1000
#
# More info can be found (only the above commands/variables are supported):
# https://github.com/gnea/grbl/blob/master/doc/markdown/settings.md
#
$120=1234
$121=1234
$122=1234

File diff suppressed because it is too large Load Diff

View File

@@ -97,10 +97,12 @@ epicsEnvUnset(ECMC_PLUGIN_CONFIG)
# $100, $101 and $102 [X,Y,Z] steps/mm\n
# $110, $111 and $112 [X,Y,Z] Max rate, mm/min\n
# $120, $121, $122 [X,Y,Z] Acceleration, mm/sec^2\n
ecmcGrblAddConfig("$120=1234");
ecmcGrblAddConfig("$121=1234");
ecmcGrblAddConfig("$122=1234");
ecmcGrblLoadConfigFile("./cfg/grbl.cfg")
#ecmcGrblAddConfig("$120=1234");
#ecmcGrblAddConfig("$121=1234");
#ecmcGrblAddConfig("$122=1234");
# Load g-code
ecmcGrblLoadGCodeFile("./plc/gcode.nc",0)