correct parameter white list for motor x2

pull/55/head
TimEversWw 2017-02-01 22:03:49 +01:00
parent b512468612
commit ccb2570634
4 changed files with 6 additions and 114 deletions

View File

@ -24,35 +24,14 @@ long msgQueue = 0;
CommandCodeEnum commandCodeEnum = CODE_UNDEFINED;
//Command::Command(String commandString) {
Command::Command(char * commandChar) {
//temp = String(commandString);
//temp = String(commandChar);
//temp = String(commadString);
String temp = String(commandChar);
Serial.print("Command: ");
Serial.print(temp);
Serial.print("\r\n");
//commandString = commandString + " ";
//char charBuf[commandString.length()];
//commandString.toCharArray(charBuf, commandString.length());
char * charBuf = commandChar;
char* charPointer;
bool invalidCommand = false;
charPointer = strtok(charBuf, " ");
//String par1(charPointer);
//temp = String(charPointer);
//Serial.print("R99 char ");
//Serial.print(temp);
//Serial.print("\r\n");
if (charPointer[0] == 'G' || charPointer[0] == 'F') {
commandCodeEnum = getGCodeEnum(charPointer);
} else {
@ -65,20 +44,7 @@ Command::Command(char * commandChar) {
charPointer = strtok(NULL, " \n\r");
//String temp = String(charPointer);
//Serial.print("Command: ");
//Serial.print(temp);
//Serial.print("\r\n");
//String par2(charPointer);
//Serial.print("R99 x ");
//Serial.print(par2);
//Serial.print("\r\n");
//Serial.print("x");
}
//Serial.print("R99 einde parameters ");
//Serial.print("\r\n");
}
CommandCodeEnum Command::getGCodeEnum(char* code) {

View File

@ -18,11 +18,7 @@ GCodeProcessor::~GCodeProcessor() {
void GCodeProcessor::printCommandLog(Command* command) {
Serial.print("command == NULL: ");
//Serial.print(command == NULL);
Serial.println("\r\n");
//Serial.print("command->getCodeEnum() == CODE_UNDEFINED: ");
//Serial.print(command->getCodeEnum() == CODE_UNDEFINED);
//Serial.println("\r\n");
}
int GCodeProcessor::execute(Command* command) {
@ -31,17 +27,8 @@ int GCodeProcessor::execute(Command* command) {
long Q = command->getQ();
//Q = 77;
CurrentState::getInstance()->setQ(Q);
//Serial.print("exec cmd Q: ");
//Serial.print(Q);
//Serial.print("\r\n");
//Serial.print("start execute command\r\n");
if(command == NULL) {
if(LOGGING) {
printCommandLog(command);
@ -49,8 +36,6 @@ int GCodeProcessor::execute(Command* command) {
return -1;
}
//Serial.print("c2\r\n");
if(command->getCodeEnum() == CODE_UNDEFINED) {
if(LOGGING) {
printCommandLog(command);
@ -58,14 +43,6 @@ int GCodeProcessor::execute(Command* command) {
return -1;
}
//Serial.print("c3: ");
//Serial.print(command->getCodeEnum());
//Serial.print("\r\n");
// GCodeHandler* handler = getGCodeHandler(command->getCodeEnum());
GCodeHandler* handler = getGCodeHandler(command->getCodeEnum());
if(handler == NULL) {
@ -76,28 +53,13 @@ int GCodeProcessor::execute(Command* command) {
Serial.print(COMM_REPORT_CMD_START);
CurrentState::getInstance()->printQAndNewLine();
//Serial.print(" Q");
//Serial.print(Q);
//Serial.print("\r\n");
//Serial.print("EXECUTION DISABLED");
//CurrentState::getInstance()->printQAndNewLine();
execution = handler->execute(command);
if(execution == 0) {
Serial.print(COMM_REPORT_CMD_DONE);
CurrentState::getInstance()->printQAndNewLine();
//Serial.print(" Q");
//Serial.print(Q);
//Serial.print("\n\r");
} else {
Serial.print(COMM_REPORT_CMD_ERROR);
CurrentState::getInstance()->printQAndNewLine();
//Serial.print(" Q");
//Serial.print(Q);
//Serial.print("\n\r");
}
CurrentState::getInstance()->resetQ();
@ -106,25 +68,7 @@ int GCodeProcessor::execute(Command* command) {
GCodeHandler* GCodeProcessor::getGCodeHandler(CommandCodeEnum codeEnum) {
/*
switch(codeEnum) {
case G00:
Serial.print("G00 detected\r\n");
return G00Handler::getInstance();
case G28:
return G28Handler::getInstance();
}
*/
GCodeHandler* handler = NULL;
/*
Serial.print("code Enum A");
Serial.print(" - ");
Serial.print(codeEnum);
Serial.print("\r\n");
*/
if (codeEnum == G00) {handler = G00Handler::getInstance();}
@ -213,18 +157,6 @@ GCodeHandler* GCodeProcessor::getGCodeHandler(CommandCodeEnum codeEnum) {
*/
// Serial.print("code Enum C");
// Serial.print(" - ");
// Serial.print(codeEnum);
// Serial.print("\r\n");
// return G00Handler::getInstance();
// return NULL;
// return NULL;
return handler;
}

View File

@ -61,6 +61,8 @@ int ParameterList::writeValue(int id, int value) {
Serial.print("R99 Error: invalid parameter id\r\n");
}
/*
// Debugging output
Serial.print("R99");
Serial.print(" ");
@ -75,6 +77,7 @@ int ParameterList::writeValue(int id, int value) {
Serial.print(value);
//Serial.print("\r\n");
CurrentState::getInstance()->printQAndNewLine();
*/
// If any value is written,
// trigger the loading of the new configuration in all other modules
@ -260,6 +263,8 @@ bool ParameterList::validParam(int id) {
case MOVEMENT_INVERT_MOTOR_X:
case MOVEMENT_INVERT_MOTOR_Y:
case MOVEMENT_INVERT_MOTOR_Z:
case MOVEMENT_SECONDARY_MOTOR_X:
case MOVEMENT_SECONDARY_MOTOR_INVERT_X:
case MOVEMENT_STEPS_ACC_DEC_X:
case MOVEMENT_STEPS_ACC_DEC_Y:
case MOVEMENT_STEPS_ACC_DEC_Z:

View File

@ -151,7 +151,6 @@ void loop() {
String currentCommand = String(commandString);
//if (commandString && commandString.length() > 0) {
if (incomingCommandPointer > 1) {
@ -159,12 +158,6 @@ void loop() {
// because there are issues with passing the
// string to the command object
// Serial.print("\r\n");
// Serial.print("-");
// Serial.print(commandChar);
// Serial.print("-");
// Serial.print("\r\n");
// Create a command and let it execute
//Command* command = new Command(commandString);
Command* command = new Command(commandChar);
@ -173,8 +166,6 @@ void loop() {
command->print();
}
command->print();
gCodeProcessor->execute(command);
free(command);
@ -184,13 +175,11 @@ command->print();
}
}
//delay(10);
// Test
//StepperControl::getInstance()->test();
currentTime = millis();
if (currentTime < lastAction) {
// If the device timer overruns, reset the idle counter
lastAction = millis();
}