PlottWare/PlottWareFirmware/gcodeutils.h
2019-08-08 17:02:07 +03:00

54 lines
1.1 KiB
C

#ifndef GCODEUTILS_H_INCLUDED
#define GCODEUTILS_H_INCLUDED
#include "Utils.h"
#include "commandParsers.h"
void parseGcode(String code){
code=removeComments(code);
String cmd=getCommand(code);
char scmd=code[0];
if(cmd=="G0"){
cmdG0(getParameter(code, 'X'), getParameter(code, 'Y'));
}
else if(cmd=="G1"){
cmdG0(getParameter(code, 'X'), getParameter(code, 'Y'));
}
else if(cmd=="G4"){
cmdG4(getParameter(code, 'P'));
}
else if(cmd=="G28"){
cmdG28();
}
else if(cmd=="G90"){
cmdG90();
}
else if(cmd=="G91"){
cmdG91();
}
else if(cmd=="T" || scmd=='T'){
cmdT(getParameter(code, 'T'));
}
else if(cmd=="M2"){
cmdM2();
}
else if(cmd=="M112"){
cmdM112();
}
else if(cmd=="M114"){
cmdM114();
}
else if(cmd=="M115"){
cmdM115();
}
else if(cmd=="M118"){
cmdM118(code.substring(code.indexOf("M118")+4));
}
else{
cmdM118("Command not supported.");
}
}
#endif // GCODEUTILS_H_INCLUDED