Buffered commands
I wrote my own Gcode interpreter and still have an outstanding question and issue. The implementation of buffered and unbuffered commands. The Receive ISR receives all buffered and unbuffered commands and places them into the circular buffer, however unbuffered commands are not acknowledged until they are completed, while buffered commands are acknowledged before they are buffered. The G code document however simply says that the unbuffered command is saved and implemented after the circular buffer is emptied, which means that until the nonbuffered command finally gets to be the next command to implement and finish. So why can't they share a common circular buffer if the results appear to be the same? Must there be separate storage for a single unbuffered command because all of the circular buffer space is reserved only for buffered commands? That seems to be simpler.
Comments
int cs = 0;
for(i = 0; cmd[i] != '*' && cmd[i] != NULL; i++)
cs = cs ^ cmd[i];
cs &= 0xff; // Defensive programming...