some adjustments to stepper control mechanism

This commit is contained in:
2019-05-28 18:39:53 +03:00
parent 3ce647b2ab
commit 8b067426a1
4 changed files with 30 additions and 15 deletions

View File

@@ -13,4 +13,6 @@ platform = espressif8266
board = d1_mini
framework = arduino
monitor_speed = 115200
board_build.f_cpu = 160000000L
board_build.f_cpu = 160000000L
upload_port=/dev/ttyUSB0

View File

@@ -68,13 +68,19 @@ void loop() {
if (inChar == '\n') {
inString.trim();
sendCommand(parseGCode(inString));
unsigned long reqTime = millis();
while (waitingForNext) {
while (!Wire.available()) {
if (millis() - reqTime > 500) {
Wire.requestFrom(8, 1);
reqTime = millis();
}
}
int response = Wire.read();
if (response == WAIT) {
delay(1);
Wire.requestFrom(8, 1);
reqTime = millis();
} else if (response == NEXT) {
Serial.println("OK");
waitingForNext = false;