fix pen commands

Signed-off-by: Stepan Usatyuk <usaatyuk@ustk.me>
This commit is contained in:
2019-05-18 15:27:34 +03:00
parent 704fe420e7
commit a1d59ea6b0
5 changed files with 17 additions and 19 deletions

View File

@@ -5,7 +5,7 @@ float bytecode[4] = {-1, -1, -1, -1};
float* parseGCode(String gcode) {
for (int i = 0; i < 4; i++) {
bytecode[i] = -1.0F;
bytecode[i] = nanf("");
}
char commandStringIn[50];

View File

@@ -6,7 +6,7 @@
#include "common/Commands.h"
String inString;
bool waitingForNext;
bool waitingForNext = false;
void sendCommand(float *command) {
if (command[0] != unk) {
@@ -18,7 +18,7 @@ void sendCommand(float *command) {
}
Wire.endTransmission();
} else {
Serial.println("UNK");
Serial.println("OK");
return;
}

View File

@@ -84,21 +84,23 @@ void execCommand(float *command) {
needAdjust = false;
}
if (command[X] != -1) {
if (!isnan(command[X])) {
servoStepper.moveTo(command[X]);
}
if (command[Y] != -1) {
if (!isnan(command[Y])) {
eggStepper.moveTo(command[Y]);
}
if (command[Z] < 0) {
pen.engage();
if (!isnan(command[Z])) {
if (command[Z] < 0) {
pen.engage();
}
if (command[Z] >= 0) {
pen.disengage();
}
}
if (command[Z] >= 0) {
pen.disengage();
}
adjustRPM();
return;