Skip to content

Commit

Permalink
Merge pull request #169 from MaslowCNC/fix-for-issue-167
Browse files Browse the repository at this point in the history
Fix for issue #167
  • Loading branch information
BarbourSmith authored Apr 11, 2017
2 parents 3036328 + b96cf52 commit d7745c4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cnc_ctrl_v1/CNC_Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ RingBuffer ringBuffer;
float feedrate = 125;
float _inchesToMMConversion = 1;
bool useRelativeUnits = false;
bool stopFlag = false;
String prependString; //prefix ('G01' for ex) from the previous command
String readString; //command being built one character at a time
String readyCommandString; //next command queued up and ready to send
Expand Down Expand Up @@ -147,17 +148,24 @@ void readSerialCommands(){
Check to see if a new character is available from the serial connection, read it if one is.
*/
while (Serial.available() > 0) {
ringBuffer.write(Serial.read()); //gets one byte from serial buffer, writes it to the internal ring buffer
char c = Serial.read();
if (c == '!'){
stopFlag = true;
}
else{
ringBuffer.write(c); //gets one byte from serial buffer, writes it to the internal ring buffer
}
}
}

bool checkForStopCommand(){
/*
Check to see if the STOP command has been sent to the machine.
*/
if(readString.endsWith("STOP")){
if(stopFlag){
readString = "";
readyCommandString = "";
stopFlag = false;
return 1;
}
return 0;
Expand Down

0 comments on commit d7745c4

Please sign in to comment.