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

Function CloseDataCollectionFile

src/ClosedLoop/ClosedLoop.cpp:92–101  ·  view source on GitHub ↗

Close the data collection file. Avoid a race between the two tasks that access it.

Source from the content-addressed store, hash-verified

90
91// Close the data collection file. Avoid a race between the two tasks that access it.
92static void CloseDataCollectionFile() noexcept
93{
94 FileStore *const f = closedLoopFile.exchange(nullptr);
95 if (f != nullptr)
96 {
97 f->Truncate(); // truncate the file in case we didn't write all the preallocated space
98 f->Close();
99 reprap.GetExpansion().AddClosedLoopRun(expectedRemoteBoardAddress, expectedRemoteSampleNumber);
100 }
101}
102
103// Handle M569.5 - Collect closed loop data
104GCodeResult ClosedLoop::StartDataCollection(DriverId driverId, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException)

Callers 2

THROWSFunction · 0.85
ProcessReceivedDataMethod · 0.85

Calls 3

TruncateMethod · 0.80
AddClosedLoopRunMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected