Skip to content

Problems with Cancel and Pause/Resume When Running File (Works Fine on GRBL) #901

@harinderbhinder

Description

@harinderbhinder

I was previously running my CNC using GRBL with an offline controller and everything worked normally. After switching to uCNC, I’m facing two issues:

Cancel issue:
When I cancel a running job (from file), uCNC shows when I jog or do anything:
ALARM: Reset to continue
This did not happen with GRBL — cancel worked normally without triggering an alarm.

Pause/Resume delay:
When I pause a job and then resume, the machine does not continue immediately.
There is a 2–3 second delay before motion starts again.

Both behaviors are only happening in uCNC.
Please check if this is expected behavior or a bug.

Thank you!

ucnc_build.json

cancel job code
bool checkCancelButton() {
static unsigned long lastCheck = 0;
if (millis() - lastCheck < 50) return false;

if (digitalRead(cancelPin) == LOW) {
delay(DEBOUNCE_DELAY);
if (digitalRead(cancelPin) == LOW) {
while (digitalRead(cancelPin) == LOW) {}

  if (fileRunning) {
    Serial.write(0x18);
    Serial.flush();
    
    unsigned long startTime = millis();
    char bootMsg[32];
    int idx = 0;
    
    while (millis() - startTime < 2000) {
      if (Serial.available()) {
        char c = Serial.read();
        if (c == '\n') {
          bootMsg[idx] = '\0';
          if (strncmp(bootMsg, "Grbl", 4) == 0) break;
          idx = 0;
        } else if (idx < 31) {
          bootMsg[idx++] = c;
        }
      }
    }

    while (Serial.available()) Serial.read();

    sendCodeLine("$X");

    fileRunning = false;
    filePaused = false;
    allLinesSent = false;
    jobCompleted = false;
    grblError = false;
    grblAlarm = false;
    awaitingOK = false;

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(F("Job Cancelled"));
    delay(2000);
  }

  showMainMenu();
  lastCheck = millis();
  return true;
}

}
lastCheck = millis();
return false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions