Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2016-03-11 21:03:41 +0300
committerDavid Crocker <dcrocker@eschertech.com>2016-03-11 21:03:41 +0300
commit8d99d640b847847da077f7f5b7c9c75d223dae9a (patch)
tree0d91cf60a5cfdfda3de991680c62146f73eac3cd /src/PrintMonitor.h
parent206f85c69039d87813a58e5ac192576e407d0910 (diff)
Version 1.09x-beta3
Merged in chrishamm's changes to Network, PrintMonitor, and his support for firmware updates from SD card Fixed print monitor issue that threw out the layer count and time estimates when there was an initial extruder priming move in the start gcode
Diffstat (limited to 'src/PrintMonitor.h')
-rw-r--r--src/PrintMonitor.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/PrintMonitor.h b/src/PrintMonitor.h
index 7eade589..ab96dcdb 100644
--- a/src/PrintMonitor.h
+++ b/src/PrintMonitor.h
@@ -25,12 +25,15 @@ const FilePosition GCODE_FOOTER_SIZE = 128000uL; // How many bytes to read from
const size_t GCODE_READ_SIZE = 1024; // How many bytes to read in one go in GetFileInfo() (should be a multiple of 4 for read efficiency)
const size_t GCODE_OVERLAP_SIZE = 100; // Size of the overlapping buffer for searching (should be a multple of 4 as well)
-const float LAYER_HEIGHT_TOLERANCE = 0.025; // Tolerance for comparing two Z heights (in mm)
+const float LAYER_HEIGHT_TOLERANCE = 0.015; // Tolerance for comparing two Z heights (in mm)
const size_t MAX_LAYER_SAMPLES = 5; // Number of layer samples for end-time estimation (except for first layer)
const float ESTIMATION_MIN_FILAMENT_USAGE = 0.01; // Minimum per cent of filament to be printed before the filament-based estimation returns values
+const float ESTIMATION_MIN_FILE_USAGE = 0.001; // Minium per cent of the file to be processed before any file-based estimations are made
const float FIRST_LAYER_SPEED_FACTOR = 0.25; // First layer speed factor compared to other layers (only for layer-based estimation)
+const uint32_t PRINTMONITOR_UPDATE_INTERVAL = 200; // Update interval in milliseconds
+
enum PrintEstimationMethod
{
filamentBased,
@@ -90,20 +93,22 @@ class PrintMonitor
Platform *platform;
GCodes *gCodes;
float longWait;
+ uint32_t lastUpdateTime;
// Information/Events concerning the file being printed
void WarmUpComplete();
void FirstLayerComplete();
void LayerComplete();
- bool isPrinting, isHeating;
+ bool isPrinting;
float printStartTime;
float pauseStartTime, totalPauseTime;
+ bool heatingUp;
unsigned int currentLayer;
float warmUpDuration, firstLayerDuration;
float firstLayerFilament, firstLayerProgress;
- float lastLayerChangeTime, lastLayerFilament;
+ float lastLayerChangeTime, lastLayerFilament, lastLayerZ;
unsigned int numLayerSamples;
float layerDurations[MAX_LAYER_SAMPLES];
@@ -111,6 +116,8 @@ class PrintMonitor
float fileProgressPerLayer[MAX_LAYER_SAMPLES];
float layerEstimatedTimeLeft;
+ float RawFilamentExtruded() const;
+
// We parse G-Code files in multiple stages. These variables hold the required information
FileParseState parseState;
char filenameBeingParsed[FILENAME_LENGTH];
@@ -131,20 +138,14 @@ class PrintMonitor
unsigned int FindFilamentUsed(const char* buf, size_t len, float *filamentUsed, unsigned int maxFilaments) const;
float accumulatedParseTime, accumulatedReadTime;
-
- // Helper methods
- bool HeightMatches(float actual, float expected) const;
};
inline bool PrintMonitor::IsPrinting() const { return isPrinting; }
inline unsigned int PrintMonitor::GetCurrentLayer() const { return currentLayer; }
inline float PrintMonitor::GetCurrentLayerTime() const { return (lastLayerChangeTime > 0.0) ? (GetPrintDuration() - lastLayerChangeTime) : 0.0; }
-inline float PrintMonitor::GetWarmUpDuration() const { return (warmUpDuration > 0.0) ? warmUpDuration : (isHeating ? GetPrintDuration() : 0.0); }
-inline float PrintMonitor::GetFirstLayerDuration() const { return (firstLayerDuration > 0.0) ? firstLayerDuration : ((warmUpDuration > 0) ? GetPrintDuration() - warmUpDuration : 0.0); }
+inline float PrintMonitor::GetFirstLayerDuration() const { return (firstLayerDuration > 0.0) ? firstLayerDuration : ((currentLayer > 0) ? GetPrintDuration() - warmUpDuration : 0.0); }
inline float PrintMonitor::GetFirstLayerHeight() const { return printingFileParsed ? printingFileInfo.firstLayerHeight : 0.0; }
-inline bool PrintMonitor::HeightMatches(float actual, float expected) const { return (expected - LAYER_HEIGHT_TOLERANCE < actual) && (expected + LAYER_HEIGHT_TOLERANCE > actual); }
-
#endif /* PRINTMONITOR_H */
// vim: ts=4:sw=4