diff --git a/src/GCodeProcessor.cpp b/src/GCodeProcessor.cpp index 9ba8e90..c1d281a 100644 --- a/src/GCodeProcessor.cpp +++ b/src/GCodeProcessor.cpp @@ -182,7 +182,8 @@ int GCodeProcessor::execute(Command *command) // if movemement failed after retry // and parameter for emergency stop is set // set the emergency stop - if (execution == 0) + + if (execution != 0) { if (isMovement) { diff --git a/src/farmbot_arduino_controller.cpp b/src/farmbot_arduino_controller.cpp index 1415c7d..8e1bb0b 100644 --- a/src/farmbot_arduino_controller.cpp +++ b/src/farmbot_arduino_controller.cpp @@ -285,6 +285,9 @@ void setup() Serial.print("R99 ARDUINO STARTUP COMPLETE\r\n"); } +//char commandIn[100]; +char commandChar[INCOMING_CMD_BUF_SIZE + 1]; + // The loop function is called in an endless loop void loop() { @@ -325,28 +328,31 @@ void loop() if (incomingChar == '\n' || incomingCommandPointer >= INCOMING_CMD_BUF_SIZE) { - char commandChar[incomingCommandPointer + 1]; + //char commandChar[incomingCommandPointer + 1]; for (int i = 0; i < incomingCommandPointer - 1; i++) { - if (incomingChar) - commandChar[i] = incomingCommandArray[i]; + commandChar[i] = incomingCommandArray[i]; } - commandChar[incomingCommandPointer] = 0; + commandChar[incomingCommandPointer-1] = '\0'; if (incomingCommandPointer > 1) { - // Copy the command to another string object. - // because there are issues with passing the - // string to the command object + // Report back the received command + Serial.print(COMM_REPORT_CMD_ECHO); + Serial.print(" "); + 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); - // Report back the received command - Serial.print(COMM_REPORT_CMD_ECHO); - Serial.print(commandChar); + //strcpy() + //commandEcho + // Log the values if needed for debugging if (LOGGING || debugMessages)