This is called on a fileGCode when we stop a print. It closes the file and re-initialises the buffer.
| 1090 | |
| 1091 | // This is called on a fileGCode when we stop a print. It closes the file and re-initialises the buffer. |
| 1092 | void GCodeBuffer::ClosePrintFile() noexcept |
| 1093 | { |
| 1094 | #if HAS_SBC_INTERFACE |
| 1095 | if (reprap.UsingSbcInterface()) |
| 1096 | { |
| 1097 | FileId printFileId = OriginalMachineState().fileId; |
| 1098 | if (printFileId != NoFileId) |
| 1099 | { |
| 1100 | for (GCodeMachineState *ms = machineState; ms != nullptr; ms = ms->GetPrevious()) |
| 1101 | { |
| 1102 | if (ms->fileId == printFileId) |
| 1103 | { |
| 1104 | ms->fileId = NoFileId; |
| 1105 | } |
| 1106 | } |
| 1107 | } |
| 1108 | } |
| 1109 | else |
| 1110 | #endif |
| 1111 | { |
| 1112 | #if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES |
| 1113 | FileData& fileBeingPrinted = OriginalMachineState().fileState; |
| 1114 | GetFileInput()->Reset(fileBeingPrinted); |
| 1115 | if (fileBeingPrinted.IsLive()) |
| 1116 | { |
| 1117 | fileBeingPrinted.Close(); |
| 1118 | } |
| 1119 | #endif |
| 1120 | } |
| 1121 | } |
| 1122 | |
| 1123 | #if HAS_SBC_INTERFACE |
| 1124 |
no test coverage detected