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

Method Spin

src/PrintMonitor/PrintMonitor.cpp:213–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void PrintMonitor::Spin() noexcept
214{
215#if HAS_SBC_INTERFACE
216 if (reprap.UsingSbcInterface())
217 {
218 if (!printingFileParsed)
219 {
220 return;
221 }
222 }
223 else
224#endif
225 {
226#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
227 // File information about the file being printed must be available before layer estimations can be made
228 if (!filenameBeingPrinted.IsEmpty() && !printingFileParsed)
229 {
230 WriteLocker locker(printMonitorLock);
231 printingFileParsed = (MassStorage::GetFileInfo(filenameBeingPrinted.c_str(), printingFileInfo, false, &customInfo) != GCodeResult::notFinished);
232 if (!printingFileParsed)
233 {
234 return;
235 }
236 PrintingFileInfoUpdated();
237 }
238#else
239 return;
240#endif
241 }
242
243 // Otherwise collect some stats after a certain period of time
244 const uint64_t now = millis64();
245 if (isPrinting && (uint32_t)now - lastUpdateTime > UpdateIntervalMillis)
246 {
247 if (gCodes.GetPauseState() != PauseState::notPaused)
248 {
249 if (!paused)
250 {
251 pauseStartTime = now;
252 paused = true;
253 }
254 }
255 else
256 {
257 if (paused)
258 {
259 const uint64_t pauseTime = now - pauseStartTime;
260 totalPauseTime += pauseTime;
261 whenSlicerTimeLeftSet += pauseTime;
262 paused = false;
263 }
264
265 if (gCodes.IsHeatingUp())
266 {
267 if (!heatingUp)
268 {
269 heatingUp = true;
270 heatingStartedTime = now;

Callers

nothing calls this directly

Calls 5

UsingSbcInterfaceMethod · 0.80
GetPauseStateMethod · 0.80
IsHeatingUpMethod · 0.80
GetTotalRawExtrusionMethod · 0.80
IsEmptyMethod · 0.45

Tested by

no test coverage detected