MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / ClosePrintFile

Method ClosePrintFile

src/GCodes/GCodeBuffer/GCodeBuffer.cpp:1092–1121  ·  view source on GitHub ↗

This is called on a fileGCode when we stop a print. It closes the file and re-initialises the buffer.

Source from the content-addressed store, hash-verified

1090
1091// This is called on a fileGCode when we stop a print. It closes the file and re-initialises the buffer.
1092void 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

Callers 1

GCodes.cppFile · 0.80

Calls 5

UsingSbcInterfaceMethod · 0.80
IsLiveMethod · 0.80
GetPreviousMethod · 0.45
ResetMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected