Remove rt block

This commit is contained in:
Anders Sandstrom
2022-01-31 14:40:02 +01:00
parent 5462f2ad5e
commit 33898dd058
4 changed files with 6852 additions and 410 deletions

View File

@@ -23,6 +23,7 @@
#include "ecmcMotion.h"
#include <iostream>
#include <fstream>
#include <time.h>
extern "C" {
#include "grbl.h"
@@ -626,6 +627,10 @@ int ecmcGrbl::grblRTexecute(int ecmcError) {
return 0;
}
struct timespec starttime, endtime;
clock_gettime(CLOCK_MONOTONIC,&starttime);
if((ecmcError_ == 0 && ecmcError>0) || (errorCode_>0 && errorCodeOld_ == 0)) {
setHalt(0);
setHalt(1);
@@ -648,7 +653,7 @@ int ecmcGrbl::grblRTexecute(int ecmcError) {
//auto enable, sync positions
preExeAxes();
double sampleRateMs = 0.0;
if(grblInitDone_ && autoEnableExecuted_) {
while(timeToNextExeMs_ < exeSampleTimeMs_ && sampleRateMs >= 0) {
@@ -663,9 +668,18 @@ int ecmcGrbl::grblRTexecute(int ecmcError) {
timeToNextExeMs_-= exeSampleTimeMs_;
}
}
int diffNs=0;
//update setpoints
postExeAxes();
clock_gettime(CLOCK_MONOTONIC,&endtime);
if(endtime.tv_sec > starttime.tv_sec) {
diffNs = 1E9-starttime.tv_nsec + endtime.tv_nsec;
}
else {
diffNs = endtime.tv_nsec - starttime.tv_nsec;
}
if(diffNs>5000) printf("DIFF %d\n",diffNs);
return errorCode_;
}

View File

@@ -177,7 +177,7 @@ void protocol_buffer_synchronize()
do {
protocol_execute_realtime(); // Check and execute run-time commands
if (sys.abort) { return; } // Check for system abort
delay_ms(1); // added for ecmc
delay_us(100); // added for ecmc
} while (plan_get_current_block() || (sys.state == STATE_CYCLE));
}

View File

@@ -270,7 +270,9 @@ void st_go_idle()
if (((settings.stepper_idle_lock_time != 0xff) || sys_rt_exec_alarm || sys.state == STATE_SLEEP) && sys.state != STATE_HOMING) {
// Force stepper dwell to lock axes for a defined amount of time to ensure the axes come to a complete
// stop and not drift from residual inertial forces at the end of the last movement.
delay_ms(settings.stepper_idle_lock_time);
// ecmc need to take away below setting because it blocks ecmc rt system. Consider add it in another way.
// delay_ms(settings.stepper_idle_lock_time);
pin_state = true; // Override. Disable steppers.
}
// if (bit_istrue(settings.flags,BITFLAG_INVERT_ST_ENABLE)) { pin_state = !pin_state; } // Apply pin invert.
@@ -716,7 +718,6 @@ void st_prep_buffer()
if (bit_istrue(sys.step_control,STEP_CONTROL_END_MOTION)) { return; }
while (segment_buffer_tail != segment_next_head) { // Check if we need to fill the buffer.
// Determine if we need to load a new planner block or if the block needs to be recomputed.
if (pl_block == NULL) {
@@ -994,6 +995,7 @@ void st_prep_buffer()
break; // **Complete** Exit loop. Segment execution time maxed.
}
}
} while (mm_remaining > prep.mm_complete); // **Complete** Exit loop. Profile complete.
#ifdef VARIABLE_SPINDLE
@@ -1130,7 +1132,6 @@ void st_prep_buffer()
plan_discard_current_block();
}
}
}
}

File diff suppressed because it is too large Load Diff