diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-05-24 15:50:45 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-05-24 15:50:45 +0300 |
commit | 19919aeb37a96c2519c4d3e759549f596b5920f2 (patch) | |
tree | 4c1973f5db48ce6ee8978e68bd7c9a6f053bd6e3 | |
parent | 214d486c4c9fe3639f2f861605c89d1b0dc56a8f (diff) |
lastFileName is no longer repported while a print is in progress
Also fixed race conditoin between changing isPrinting state and updating
seqs.job
-rw-r--r-- | src/PrintMonitor/PrintMonitor.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/PrintMonitor/PrintMonitor.cpp b/src/PrintMonitor/PrintMonitor.cpp index c2932ebb..64661cb9 100644 --- a/src/PrintMonitor/PrintMonitor.cpp +++ b/src/PrintMonitor/PrintMonitor.cpp @@ -59,7 +59,7 @@ constexpr ObjectModelTableEntry PrintMonitor::objectModelTable[] = { "filePosition", OBJECT_MODEL_FUNC((uint64_t)self->gCodes.GetFilePosition()), ObjectModelEntryFlags::live }, { "firstLayerDuration", OBJECT_MODEL_FUNC_NOSELF(nullptr), ObjectModelEntryFlags::obsolete }, { "lastDuration", OBJECT_MODEL_FUNC_IF(!self->IsPrinting(), (int32_t)self->gCodes.GetLastDuration()), ObjectModelEntryFlags::none }, - { "lastFileName", OBJECT_MODEL_FUNC_IF(!self->filenameBeingPrinted.IsEmpty(), self->filenameBeingPrinted.c_str()), ObjectModelEntryFlags::none }, + { "lastFileName", OBJECT_MODEL_FUNC_IF(!self->filenameBeingPrinted.IsEmpty() && !self->IsPrinting(), self->filenameBeingPrinted.c_str()), ObjectModelEntryFlags::none }, // TODO Add enum about the last file print here (to replace lastFileAborted, lastFileCancelled, lastFileSimulated) { "layer", OBJECT_MODEL_FUNC_IF(self->IsPrinting() && self->currentLayer != 0, (int32_t)self->currentLayer), ObjectModelEntryFlags::live }, { "layerTime", OBJECT_MODEL_FUNC_IF(self->IsPrinting() && self->currentLayer != 0, self->GetCurrentLayerTime(), 1), ObjectModelEntryFlags::live }, @@ -116,7 +116,7 @@ void PrintMonitor::Reset() noexcept heatingUp = paused = false; currentLayer = 0; - printStartTime = pauseStartTime = lastSnapshotTime = lastLayerChangeTime = heatingStartedTime = millis64(); + printStartTime = pauseStartTime = lastSnapshotTime = lastLayerChangeTime = heatingStartedTime = whenSlicerTimeLeftSet = millis64(); totalPauseTime = warmUpDuration = lastSnapshotNonPrintingTime = lastLayerChangeNonPrintingTime = 0; lastLayerDuration = 0; lastSnapshotFileFraction = lastSnapshotFilamentUsed = 0.0; @@ -316,16 +316,15 @@ void PrintMonitor::StartingPrint(const char* filename) noexcept // Tell this class that the file set for printing is now actually processed void PrintMonitor::StartedPrint() noexcept { - Reset(); isPrinting = true; - printStartTime = lastSnapshotTime = whenSlicerTimeLeftSet = millis64(); SetLayerNumber(0); + Reset(); } void PrintMonitor::StoppedPrint() noexcept { - Reset(); isPrinting = printingFileParsed = false; + Reset(); } // Set the current layer number as given in a comment |