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

Method WriteToFile

src/GCodes/GCodeBuffer/StringParser.cpp:1790–1815  ·  view source on GitHub ↗

Write the current line of GCode to file

Source from the content-addressed store, hash-verified

1788
1789// Write the current line of GCode to file
1790void StringParser::WriteToFile() noexcept
1791{
1792 DecodeCommand();
1793 if (GetCommandLetter() == 'M')
1794 {
1795 if (GetCommandNumber() == 29) // end of file?
1796 {
1797 fileBeingWritten->Close();
1798 fileBeingWritten = nullptr;
1799 Init();
1800 const char *_ecv_array const r = (gb.LatestMachineState().compatibility == Compatibility::Marlin) ? "Done saving file." : "";
1801 reprap.GetGCodes().HandleReply(gb, GCodeResult::ok, r);
1802 return;
1803 }
1804 }
1805
1806 size_t indent = commandIndent;
1807 while (indent != 0)
1808 {
1809 fileBeingWritten->Write(' ');
1810 --indent;
1811 }
1812 fileBeingWritten->Write(gb.buffer);
1813 fileBeingWritten->Write('\n');
1814 Init();
1815}
1816
1817// Write a character to file, returning true if we finished doing the binary upload
1818bool StringParser::WriteBinaryToFile(char b) noexcept

Callers

nothing calls this directly

Calls 4

HandleReplyMethod · 0.80
WriteMethod · 0.60
InitFunction · 0.50
CloseMethod · 0.45

Tested by

no test coverage detected