From 06da9b8bb405e5b0b4e2d76ec189b0efd200d0f5 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lafreniere Date: Sat, 6 Apr 2019 12:47:06 -0400 Subject: [PATCH] Bug fixes Fix emergency state issue --- .../GcodeInterpreter/GcodeInterpreter.ino | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pcbdevice/opencrcontroler/GcodeInterpreter/GcodeInterpreter.ino b/pcbdevice/opencrcontroler/GcodeInterpreter/GcodeInterpreter.ino index 098703d..407c010 100644 --- a/pcbdevice/opencrcontroler/GcodeInterpreter/GcodeInterpreter.ino +++ b/pcbdevice/opencrcontroler/GcodeInterpreter/GcodeInterpreter.ino @@ -93,7 +93,8 @@ void setup() pinMode(xSwitchPin, INPUT_PULLUP); pinMode(ySwitchPin, INPUT_PULLUP); pinMode(zSwitchPin, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(emergencySwitchPin), LimiteSwitch, FALLING); + pinMode(emergencySwitchPin, INPUT_PULLUP); + attachInterrupt(digitalPinToInterrupt(emergencySwitchPin), LimiteSwitch, RISING); Serial.begin(57600); while(!Serial); // Open a Serial Monitor @@ -136,9 +137,9 @@ void loop() if (Serial.available()) { + String read_string = Serial.readStringUntil('\n'); if(!isEmegencyState) { - String read_string = Serial.readStringUntil('\n'); String words[] = {"", "", ""}; int start = 0; @@ -303,12 +304,6 @@ int MovingTick(uint8_t id, int32_t value){ void LimiteSwitch(){ if(!homing){ - TorqueOffAll(); - - Led(idX, !digitalRead(xSwitchPin)); - Led(idY, !digitalRead(ySwitchPin)); - Led(idZ, !digitalRead(zSwitchPin)); - isEmegencyState = true; } }