WIP
This commit is contained in:
@@ -974,7 +974,7 @@ void ecmcGrbl::addConfig(std::string command) {
|
||||
}
|
||||
|
||||
if (getEcmcEpicsIOCState() == 16) {
|
||||
printf("%s:%s:%d: GRBL: ERROR: Configuratoin can only be applied during startup:(0x%x)\n",
|
||||
printf("%s:%s:%d: GRBL: ERROR: Configuration can only be applied during startup:(0x%x)\n",
|
||||
__FILE__,__FUNCTION__,__LINE__,ECMC_PLUGIN_CONFIG_ERROR_CODE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ void gc_sync_position()
|
||||
// coordinates, respectively.
|
||||
uint8_t gc_execute_line(char *line)
|
||||
{
|
||||
PRINTF_DEBUG("");
|
||||
PRINTF_DEBUG("gc_execute_line\n");
|
||||
//printf("gc_execute_line: %s\n",line);
|
||||
if(strlen(line)<2) {
|
||||
return(STATUS_OK);
|
||||
@@ -124,6 +124,8 @@ uint8_t gc_execute_line(char *line)
|
||||
else { char_counter = 0; }
|
||||
|
||||
while (line[char_counter] != 0) { // Loop until no more g-code words in line.
|
||||
|
||||
PRINTF_DEBUG("gc_execute_line::while\n");
|
||||
//printf("1\n");
|
||||
// Import the next g-code word, expecting a letter followed by a value. Otherwise, error out.
|
||||
letter = line[char_counter];
|
||||
|
||||
@@ -117,24 +117,8 @@ void delay_sec(float seconds, uint8_t mode)
|
||||
clock_gettime(CLOCK_MONOTONIC,&deadline);
|
||||
deadline.tv_sec+=1*seconds;
|
||||
clock_nanosleep(CLOCK_MONOTONIC,TIMER_ABSTIME, &deadline,NULL);
|
||||
|
||||
// NOTE!!!: mode not used!!!!
|
||||
|
||||
//uint16_t i = ceil(1000/DWELL_TIME_STEP*seconds);
|
||||
//while (i-- > 0) {
|
||||
// if (sys.abort) { return; }
|
||||
// if (mode == DELAY_MODE_DWELL) {
|
||||
// protocol_execute_realtime();
|
||||
// } else { // DELAY_MODE_SYS_SUSPEND
|
||||
// // Execute rt_system() only to avoid nesting suspend loops.
|
||||
// protocol_exec_rt_system();
|
||||
// if (sys.suspend & SUSPEND_RESTART_RETRACT) { return; } // Bail, if safety door reopens.
|
||||
// }
|
||||
// _delay_ms(DWELL_TIME_STEP); // Delay DWELL_TIME_STEP increment
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
// Delays variable defined milliseconds. Compiler compatibility fix for _delay_ms(),
|
||||
// which only accepts constants in future compiler releases.
|
||||
void delay_ms(uint16_t ms)
|
||||
@@ -147,8 +131,6 @@ void delay_ms(uint16_t ms)
|
||||
deadline.tv_sec++;
|
||||
}
|
||||
clock_nanosleep(CLOCK_MONOTONIC,TIMER_ABSTIME, &deadline,NULL);
|
||||
|
||||
//while ( ms-- ) { _delay_ms(1); }
|
||||
}
|
||||
|
||||
|
||||
@@ -165,23 +147,6 @@ void delay_us(uint32_t us)
|
||||
deadline.tv_sec++;
|
||||
}
|
||||
clock_nanosleep(CLOCK_MONOTONIC,TIMER_ABSTIME, &deadline,NULL);
|
||||
|
||||
|
||||
//while (us) {
|
||||
// if (us < 10) {
|
||||
// _delay_us(1);
|
||||
// us--;
|
||||
// } else if (us < 100) {
|
||||
// _delay_us(10);
|
||||
// us -= 10;
|
||||
// } else if (us < 1000) {
|
||||
// _delay_us(100);
|
||||
// us -= 100;
|
||||
// } else {
|
||||
// _delay_ms(1);
|
||||
// us -= 1000;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ static void protocol_exec_rt_suspend();
|
||||
*/
|
||||
void protocol_main_loop()
|
||||
{
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
// Perform some machine checks to make sure everything is good to go.
|
||||
#ifdef CHECK_LIMITS_AT_INIT
|
||||
if (bit_istrue(settings.flags, BITFLAG_HARD_LIMIT_ENABLE)) {
|
||||
@@ -75,10 +73,12 @@ void protocol_main_loop()
|
||||
uint8_t c;
|
||||
delay_ms(1); // added for ecmc (I think..)
|
||||
for (;;) {
|
||||
|
||||
// Process one line of incoming serial data, as the data becomes available. Performs an
|
||||
// initial filtering by removing spaces and comments and capitalizing all letters.
|
||||
delay_us(100); // added for ecmc
|
||||
while((c = serial_read()) != SERIAL_NO_DATA) {
|
||||
|
||||
if ((c == '\n') || (c == '\r')) { // End of line reached
|
||||
|
||||
protocol_execute_realtime(); // Runtime command check point.
|
||||
@@ -154,11 +154,11 @@ void protocol_main_loop()
|
||||
line[char_counter++] = c;
|
||||
}
|
||||
}
|
||||
|
||||
delay_us(100);
|
||||
}
|
||||
delay_us(100); // added for ecmc
|
||||
}
|
||||
delay_us(100); // added for ecmc
|
||||
delay_us(1000); // added for ecmc
|
||||
// If there are no more characters in the serial read buffer to be processed and executed,
|
||||
// this indicates that g-code streaming has either filled the planner buffer or has
|
||||
// completed. In either case, auto-cycle start, if enabled, any queued moves.
|
||||
@@ -241,12 +241,11 @@ void protocol_exec_rt_system()
|
||||
// the user and a GUI time to do what is needed before resetting, like killing the
|
||||
// incoming stream. The same could be said about soft limits. While the position is not
|
||||
// lost, continued streaming could cause a serious crash if by chance it gets executed.
|
||||
delay_us(100); // added for ecmc
|
||||
} while (bit_isfalse(sys_rt_exec_state,EXEC_RESET));
|
||||
}
|
||||
system_clear_exec_alarm(); // Clear alarm
|
||||
}
|
||||
|
||||
delay_us(10); // added for ecmc
|
||||
rt_exec = sys_rt_exec_state; // Copy volatile sys_rt_exec_state.
|
||||
if (rt_exec) {
|
||||
|
||||
@@ -774,4 +773,5 @@ static void protocol_exec_rt_suspend()
|
||||
delay_us(100); // added for ecmc
|
||||
protocol_exec_rt_system();
|
||||
}
|
||||
delay_us(100); // added for ecmc
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user