Do not execute if exe time<0

This commit is contained in:
Anders Sandstrom
2022-01-24 11:17:40 +01:00
parent 02cb9cd6e4
commit 56c588690b
3 changed files with 9 additions and 9 deletions

View File

@@ -383,10 +383,10 @@ void ecmcGrbl::grblRTexecute() {
autoEnableAtStart();
double sampleRateMs =.0;
double sampleRateMs =0.0;
if(grblInitDone_ && autoEnableExecuted_) {
while(timeToNextExeMs_ < exeSampleTimeMs_) {
while(timeToNextExeMs_ < exeSampleTimeMs_ && sampleRateMs >= 0) {
sampleRateMs=ecmc_grbl_main_rt_thread();
timeToNextExeMs_ = timeToNextExeMs_ + sampleRateMs;
}

View File

@@ -373,7 +373,7 @@ double ecmc_grbl_main_rt_thread()
{
//printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
if (busy || !stepperInterruptEnable) { return 0.0; } // The busy-flag is used to avoid reentering this interrupt
if (busy || !stepperInterruptEnable) { return -1.0; } // The busy-flag is used to avoid reentering this interrupt
// Set the direction pins a couple of nanoseconds before we step the steppers
//DIRECTION_PORT = (DIRECTION_PORT & ~DIRECTION_MASK) | (st.dir_outbits & DIRECTION_MASK);
@@ -464,7 +464,7 @@ double ecmc_grbl_main_rt_thread()
if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(SPINDLE_PWM_OFF_VALUE); }
#endif
system_set_exec_state_flag(EXEC_CYCLE_STOP); // Flag main program for cycle end
return 0.0; // Nothing to do but exit.
return -1.0; // Nothing to do but exit.
}
}
@@ -541,7 +541,7 @@ double ecmc_grbl_main_rt_thread()
busy = false;
if(!st.exec_segment) {
return 0.0;
return -1.0;
}
return st.exec_segment->ecmc_interrupt_time_ms;
}

View File

@@ -63,16 +63,16 @@ ${SCRIPTEXEC} ${ecmccfg_DIR}loadPlugin.cmd, "PLUGIN_ID=0,FILE=${ECMC_PLUGIN_FILN
epicsEnvUnset(ECMC_PLUGIN_FILNAME)
epicsEnvUnset(ECMC_PLUGIN_CONFIG)
ecmcGrblAddCommand("G1X20Y20F300");
ecmcGrblAddCommand("G1X20Y20F180");
ecmcGrblAddCommand("G4P1");
ecmcGrblAddCommand("G2X0Y0R20");
ecmcGrblAddCommand("G0X10Y10");
ecmcGrblAddCommand("G4P1");
ecmcGrblAddCommand("G1X10Y0F200");
ecmcGrblAddCommand("G1X10Y0F360");
ecmcGrblAddCommand("G4P1");
ecmcGrblAddCommand("G1X50Y50F300");
ecmcGrblAddCommand("G1X50Y50F180");
ecmcGrblAddCommand("G4P1");
ecmcGrblAddCommand("G1X0Y0F180");
ecmcGrblAddCommand("G1X0Y0F360");
#
#ecmcGrblAddCommand("$");
#