Adding "Q"

pull/44/head
TimEversWw 2016-09-30 23:06:13 +02:00
parent af4b5ea7e1
commit 20660d9c3b
4 changed files with 25 additions and 1 deletions

View File

@ -9,6 +9,7 @@ const char parameterValue2Code= 'W';
const char elementCode = 'E';
const char timeCode = 'T';
const char modeCode = 'M';
const char msgQueueCode = 'Q';
double axisValue[3] = { 0.0, 0.0, 0.0 };
long axisSpeedValue[3] = { 0, 0, 0 };
@ -19,6 +20,7 @@ long parameterValue2 = 0;
long element = 0;
long time = 0;
long mode = 0;
long msgQueue = 0;
CommandCodeEnum commandCodeEnum = CODE_UNDEFINED;
@ -161,6 +163,8 @@ void Command::getParameter(char* charPointer) {
time = atof(charPointer + 1 );
} else if (charPointer[0] == modeCode ){
mode = atof(charPointer + 1 );
} else if (charPointer[0] == msgQueueCode ){
msgQueue = atof(charPointer + 1 );
}
}
@ -189,6 +193,8 @@ void Command::print() {
Serial.print(element);
Serial.print(", M: ");
Serial.print(mode);
Serial.print(", Q: ");
Serial.print(msgQueue);
Serial.print("\r\n");
}
@ -243,3 +249,7 @@ long Command::getE() {
long Command::getM() {
return mode;
}
long Command::getQ() {
return msgQueue;
}

View File

@ -55,6 +55,7 @@ public:
long getT();
long getE();
long getM();
long getQ();
private:
CommandCodeEnum getGCodeEnum(char* code);

View File

@ -23,7 +23,7 @@ G28Handler::G28Handler() {
int G28Handler::execute(Command* command) {
Serial.print("home\r\n");
//Serial.print("home\r\n");
StepperControl::getInstance()->moveToCoords(0,0,0, 0,0,0, false, false, true);
StepperControl::getInstance()->moveToCoords(0,0,0, 0,0,0, true, true, false);

View File

@ -23,6 +23,8 @@ void GCodeProcessor::printCommandLog(Command* command) {
}
int GCodeProcessor::execute(Command* command) {
long Q = command->getQ();
if(command == NULL || command->getCodeEnum() == CODE_UNDEFINED) {
if(LOGGING) {
printCommandLog(command);
@ -35,11 +37,22 @@ int GCodeProcessor::execute(Command* command) {
return -1;
}
Serial.println(COMM_REPORT_CMD_START);
Serial.print(" Q");
Serial.print(Q);
Serial.print("\n\r");
int execution = handler->execute(command);
if(execution == 0) {
Serial.println(COMM_REPORT_CMD_DONE);
Serial.print(" Q");
Serial.print(Q);
Serial.print("\n\r");
} else {
Serial.println(COMM_REPORT_CMD_ERROR);
Serial.print(" Q");
Serial.print(Q);
Serial.print("\n\r");
}
return execution;
};