currentline = nextline;
}
+ bool sent_ok= false; // used for G1 optimization
while(possible_command.size() > 0) {
// assumes G or M are always the first on the line
size_t nextcmd = possible_command.find_first_of("GM", 2);
}
new_message.stream->printf("ok\n");
delete gcode;
- continue;
+ return;
}else if(!is_allowed_mcode(gcode->m)) {
// ignore everything, return error string to host
// makes it handle the parameters as a machine position
THEROBOT->next_command_is_MCS= true;
+ } else if(gcode->g == 1) {
+ // optimize G1 to send ok immediately (one per line) before it is planned
+ if(!sent_ok) {
+ sent_ok= true;
+ new_message.stream->printf("ok\n");
+ }
}
// remember last modal group 1 code
new_message.stream->printf("Entering Alarm/Halt state\n");
THEKERNEL->call_event(ON_HALT, nullptr);
- }else{
+ }else if(!sent_ok) {
if(gcode->add_nl)
new_message.stream->printf("\r\n");