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) { float* parseGCode(String gcode) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
bytecode[i] = -1.0F; bytecode[i] = nanf("");
} }
char commandStringIn[50]; char commandStringIn[50];

View File

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

View File

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

View File

@@ -34,8 +34,8 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="0.7" inkscape:zoom="0.7"
inkscape:cx="770.76884" inkscape:cx="661.33551"
inkscape:cy="412.71372" inkscape:cy="332.89105"
inkscape:document-units="mm" inkscape:document-units="mm"
inkscape:current-layer="layer2" inkscape:current-layer="layer2"
showgrid="false" showgrid="false"
@@ -403,10 +403,6 @@
x="150">(None)</tspan></text> x="150">(None)</tspan></text>
</g> </g>
</g> </g>
<g
id="g328" />
<g
id="g952" />
</g> </g>
<g <g
inkscape:groupmode="layer" inkscape:groupmode="layer"

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -6,14 +6,14 @@ if len(sys.argv) != 3:
print("Not 2 arguments") print("Not 2 arguments")
exit() exit()
gcode = sys.argv[1] gcode = sys.argv[2]
if not os.path.isfile(gcode): if not os.path.isfile(gcode):
print("File doesn't exist!") print("File doesn't exist!")
exit() exit()
ser = serial.Serial() ser = serial.Serial()
ser.baudrate = 115200 ser.baudrate = 115200
ser.port = sys.argv[2] ser.port = sys.argv[1]
ser.open() ser.open()
if not ser.is_open: if not ser.is_open: