Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get filesize and cancle print for RepRapFirmware #1533

Merged
merged 15 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion TFT/src/User/API/Gcode/gcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ char *request_M33(char *filename)
long request_M23_M36(char *filename)
{
uint8_t offset = 5;
const char *sizeTag;
if (infoMachineSettings.firmwareType != FW_REPRAPFW) // all other firmwares except reprap firmware
{
resetRequestCommandInfo("File opened", // The magic to identify the start
Expand All @@ -145,6 +146,7 @@ long request_M23_M36(char *filename)
NULL); // The third error magic

mustStoreCmd("M23 %s\n", filename);
sizeTag = "Size:";
}
else // reprap firmware
{
Expand All @@ -156,6 +158,7 @@ long request_M23_M36(char *filename)

mustStoreCmd("M36 %s\n", filename);
offset = 6;
sizeTag = "size\":"; // reprap firmware reports size JSON
}

// Wait for response
Expand All @@ -169,7 +172,7 @@ long request_M23_M36(char *filename)
mustStoreCmd("M23 %s\n", filename); //send M23 for reprap firmware
// Find file size and report its.
char *ptr;
long size = strtol(strstr(requestCommandInfo.cmd_rev_buf, "Size:") + offset, &ptr, 10);
long size = strtol(strstr(requestCommandInfo.cmd_rev_buf, sizeTag) + offset, &ptr, 10);
clearRequestCommandInfo();
return size;
}
Expand Down Expand Up @@ -213,3 +216,12 @@ bool request_M27(int seconds)
mustStoreCmd("M27 S%d\n", seconds);
return true;
}

/**
* Stop or Unconditional stop in reprap firmware
**/
bool request_M0(void)
{
mustStoreCmd("M0 \n");
return true;
}
6 changes: 5 additions & 1 deletion TFT/src/User/API/Printing.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ void abortPrinting(void)
breakAndContinue();
breakAndContinue();
breakAndContinue();
request_M524();
if (infoMachineSettings.firmwareType == FW_REPRAPFW)
request_M0(); // M524 is not supportet in reprap firmware
else
request_M524();

break;

case TFT_UDISK:
Expand Down