Test and fix autoenable
This commit is contained in:
@@ -28,7 +28,7 @@ extern "C" {
|
||||
#include "grbl.h"
|
||||
}
|
||||
|
||||
// Global vars
|
||||
// Global grbl vars
|
||||
int enableDebugPrintouts = 0;
|
||||
int stepperInterruptEnable = 0;
|
||||
|
||||
@@ -126,10 +126,8 @@ ecmcGrbl::ecmcGrbl(char* configStr,
|
||||
throw std::runtime_error("GRBL: ERROR: Failed create mutex for command buffer.");
|
||||
}
|
||||
|
||||
|
||||
parseConfigStr(configStr); // Assigns all configs
|
||||
|
||||
|
||||
ecmcData_.xAxis.axisId = cfgXAxisId_;
|
||||
ecmcData_.yAxis.axisId = cfgYAxisId_;
|
||||
ecmcData_.zAxis.axisId = cfgZAxisId_;
|
||||
@@ -348,11 +346,11 @@ bool ecmcGrbl::autoEnableAxesSuccess() {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!cfgAutoEnable_ && !errorCode_) {
|
||||
if(cfgAutoEnable_ && !errorCode_) {
|
||||
setAllAxesEnable(1);
|
||||
}
|
||||
|
||||
int loopCounter=0;
|
||||
int loopCounter = 0;
|
||||
while(!ecmcData_.allEnabled || loopCounter >= 100) {
|
||||
delay_ms(cfgAutoEnableTimeOutSecs_*10); //*1000/100
|
||||
loopCounter++;
|
||||
@@ -375,7 +373,6 @@ 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);
|
||||
@@ -901,13 +898,6 @@ int ecmcGrbl::getCodeRowNum() {
|
||||
return grblCommandBufferIndex_;
|
||||
}
|
||||
|
||||
// Avoid issues with std:to_string()
|
||||
std::string ecmcGrbl::to_string(int value) {
|
||||
std::ostringstream os;
|
||||
os << value;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
int ecmcGrbl::getError() {
|
||||
return errorCode_;
|
||||
}
|
||||
|
||||
@@ -70,14 +70,14 @@ class ecmcGrbl : public asynPortDriver {
|
||||
double exeSampelTimeMs);
|
||||
~ecmcGrbl();
|
||||
|
||||
void doMainWorker();
|
||||
void doWriteWorker();
|
||||
void doMainWorker(); // Simulated grbl main.c
|
||||
void doWriteWorker(); // Simulated grbl client
|
||||
void addCommand(std::string command);
|
||||
void addConfig(std::string command);
|
||||
void loadGCodeFile(std::string filename, int append);
|
||||
void loadConfigFile(std::string fileName, int append);
|
||||
int enterRT();
|
||||
int grblRTexecute(int ecmcError);
|
||||
int grblRTexecute(int ecmcError); //ecmc rt thread (main)
|
||||
int setExecute(int exe);
|
||||
int setHalt(int halt);
|
||||
int setResume(int resume);
|
||||
@@ -91,25 +91,24 @@ class ecmcGrbl : public asynPortDriver {
|
||||
int getAllAxesEnabled();
|
||||
|
||||
private:
|
||||
void parseConfigStr(char *configStr);
|
||||
void readEcmcStatus(int ecmcError);
|
||||
void preExeAxes();
|
||||
void postExeAxes();
|
||||
void preExeAxis(ecmcAxisStatusData ecmcAxisData, int grblAxisId);
|
||||
void postExeAxis(ecmcAxisStatusData ecmcAxisData, int grblAxisId);
|
||||
void giveControlToEcmcIfNeeded();
|
||||
void syncAxisPosition(ecmcAxisStatusData ecmcAxisData, int grblAxisId);
|
||||
bool getEcmcAxisEnabled(int ecmcAxisId);
|
||||
double getEcmcAxisActPos(int axis);
|
||||
int getEcmcAxisTrajSource(int ecmcAxisId);
|
||||
bool getEcmcAxisLimitBwd(int ecmcAxisId);
|
||||
bool getEcmcAxisLimitFwd(int ecmcAxisId);
|
||||
static std::string to_string(int value);
|
||||
grblReplyType grblReadReply();
|
||||
void grblWriteCommand(std::string command);
|
||||
bool applyConfigsSuccess();
|
||||
bool WriteGCodeSuccess();
|
||||
bool autoEnableAxesSuccess();
|
||||
void parseConfigStr(char *configStr); // constructor (iocsh thread)
|
||||
void readEcmcStatus(int ecmcError); // ecmc rt thread
|
||||
void preExeAxes(); // ecmc rt thread
|
||||
void postExeAxes(); // ecmc rt thread
|
||||
void preExeAxis(ecmcAxisStatusData ecmcAxisData, int grblAxisId); //ecmc rt thread
|
||||
void postExeAxis(ecmcAxisStatusData ecmcAxisData, int grblAxisId); //ecmc rt thread
|
||||
void giveControlToEcmcIfNeeded(); //ecmc rt thread
|
||||
void syncAxisPosition(ecmcAxisStatusData ecmcAxisData, int grblAxisId); //ecmc rt thread
|
||||
bool getEcmcAxisEnabled(int ecmcAxisId); //ecmc rt thread
|
||||
double getEcmcAxisActPos(int axis); //ecmc rt thread
|
||||
int getEcmcAxisTrajSource(int ecmcAxisId); //ecmc rt thread
|
||||
bool getEcmcAxisLimitBwd(int ecmcAxisId); //ecmc rt thread
|
||||
bool getEcmcAxisLimitFwd(int ecmcAxisId); //ecmc rt thread
|
||||
grblReplyType grblReadReply(); // doWriteWorker thread
|
||||
void grblWriteCommand(std::string command); // doWriteWorker thread
|
||||
bool applyConfigsSuccess(); // doWriteWorker thread
|
||||
bool WriteGCodeSuccess(); // doWriteWorker thread
|
||||
bool autoEnableAxesSuccess(); // doWriteWorker thread
|
||||
|
||||
int cfgDbgMode_;
|
||||
int cfgXAxisId_;
|
||||
|
||||
@@ -13,14 +13,15 @@ ax2.reset:=0;
|
||||
ax3.reset:=0;
|
||||
|
||||
# Enable axis in state 0
|
||||
if(static.state==0) {
|
||||
if(not(grbl_get_busy()) and not(grbl_get_error())) {
|
||||
grbl_set_all_enable(1);
|
||||
};
|
||||
if(grbl_get_all_enabled()) {
|
||||
static.state:=1;
|
||||
};
|
||||
};
|
||||
#if(static.state==0) {
|
||||
# if(not(grbl_get_busy()) and not(grbl_get_error())) {
|
||||
# grbl_set_all_enable(1);
|
||||
# };
|
||||
# if(grbl_get_all_enabled()) {
|
||||
# static.state:=1;
|
||||
# };
|
||||
#};
|
||||
static.state:=1;
|
||||
|
||||
# Trigg motion
|
||||
if(static.state == 1) {
|
||||
|
||||
@@ -84,7 +84,7 @@ epicsEnvSet("PLUGIN_VER" ,"develop")
|
||||
require ecmc_plugin_grbl $(PLUGIN_VER)
|
||||
|
||||
epicsEnvSet(ECMC_PLUGIN_FILNAME,"/home/pi/epics/base-7.0.5/require/${E3_REQUIRE_VERSION}/siteMods/ecmc_plugin_grbl/$(PLUGIN_VER)/lib/${EPICS_HOST_ARCH=linux-x86_64}/libecmc_plugin_grbl.so")
|
||||
epicsEnvSet(ECMC_PLUGIN_CONFIG,"DBG_PRINT=1;X_AXIS=1;Y_AXIS=2;SPINDLE_AXIS=3;AUTO_ENABLE=0;AUTO_START=0;") # Only one option implemented in this plugin
|
||||
epicsEnvSet(ECMC_PLUGIN_CONFIG,"DBG_PRINT=1;X_AXIS=1;Y_AXIS=2;SPINDLE_AXIS=3;AUTO_ENABLE=1;AUTO_START=0;") # Only one option implemented in this plugin
|
||||
${SCRIPTEXEC} ${ecmccfg_DIR}loadPlugin.cmd, "PLUGIN_ID=0,FILE=${ECMC_PLUGIN_FILNAME},CONFIG='${ECMC_PLUGIN_CONFIG}', REPORT=1"
|
||||
epicsEnvUnset(ECMC_PLUGIN_FILNAME)
|
||||
epicsEnvUnset(ECMC_PLUGIN_CONFIG)
|
||||
|
||||
Reference in New Issue
Block a user