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>2020-08-28 12:25:34 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-08-28 12:25:34 +0300
commitfacd6fa3f9979b7fb8d7eec1839b3ad3dfa167e7 (patch)
treeb379c1d26ff220c52ad9129187c560c9fffa999b /src/FilamentMonitors
parent05c995f2968aabaa3fa8582fb49ab0574e492342 (diff)
Various
Changed layout of User Page to accommodate ADC calibration as well as software reset data. Added new module NonVolatileMemory to manage this. Removed RADDS configuration so that we don't need to support SAM3XA flash memory. Increased number of stack words stored in software reset data. Moved exception handlers out of Tasks.cpp to separate module ExceptionHandlers. Changed number of decimal places reported in spindle RPMs from default (7) to 1. Moved some low-level functions from CanInterface to CanDriver and started preparing CanDriver to support bith CAN interfaces. Added L parameter (calibration factor) to laser filament monitor configuration Renamed GCodeChannel::USBchan back to USB for backwards compatibility
Diffstat (limited to 'src/FilamentMonitors')
-rw-r--r--src/FilamentMonitors/LaserFilamentMonitor.cpp23
-rw-r--r--src/FilamentMonitors/LaserFilamentMonitor.h1
2 files changed, 15 insertions, 9 deletions
diff --git a/src/FilamentMonitors/LaserFilamentMonitor.cpp b/src/FilamentMonitors/LaserFilamentMonitor.cpp
index f0a6d755..ea445a28 100644
--- a/src/FilamentMonitors/LaserFilamentMonitor.cpp
+++ b/src/FilamentMonitors/LaserFilamentMonitor.cpp
@@ -43,12 +43,13 @@ constexpr ObjectModelTableEntry LaserFilamentMonitor::objectModelTable[] =
{ "totalDistance", OBJECT_MODEL_FUNC(self->totalExtrusionCommanded, 1), ObjectModelEntryFlags::none },
// 2. LaserFilamentMonitor.configured members
+ { "calibrationFactor", OBJECT_MODEL_FUNC(self->calibrationFactor, 3), ObjectModelEntryFlags::none },
{ "percentMax", OBJECT_MODEL_FUNC(ConvertToPercent(self->maxMovementAllowed)), ObjectModelEntryFlags::none },
{ "percentMin", OBJECT_MODEL_FUNC(ConvertToPercent(self->minMovementAllowed)), ObjectModelEntryFlags::none },
- { "sampleDistance", OBJECT_MODEL_FUNC(self->minimumExtrusionCheckLength, 1), ObjectModelEntryFlags::none },
+ { "sampleDistance", OBJECT_MODEL_FUNC(self->minimumExtrusionCheckLength, 1), ObjectModelEntryFlags::none },
};
-constexpr uint8_t LaserFilamentMonitor::objectModelTableDescriptor[] = { 3, 5, 4, 3 };
+constexpr uint8_t LaserFilamentMonitor::objectModelTableDescriptor[] = { 3, 5, 4, 4 };
DEFINE_GET_OBJECT_MODEL_TABLE(LaserFilamentMonitor)
@@ -56,6 +57,7 @@ DEFINE_GET_OBJECT_MODEL_TABLE(LaserFilamentMonitor)
LaserFilamentMonitor::LaserFilamentMonitor(unsigned int extruder, unsigned int type) noexcept
: Duet3DFilamentMonitor(extruder, type),
+ calibrationFactor(1.0),
minMovementAllowed(DefaultMinMovementAllowed), maxMovementAllowed(DefaultMaxMovementAllowed),
minimumExtrusionCheckLength(DefaultMinimumExtrusionCheckLength), comparisonEnabled(false), checkNonPrintingMoves(false)
{
@@ -103,6 +105,7 @@ bool LaserFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef& reply, bo
return true;
}
+ gb.TryGetFValue('L', calibrationFactor, seen);
gb.TryGetFValue('E', minimumExtrusionCheckLength, seen);
if (gb.Seen('R'))
@@ -142,11 +145,12 @@ bool LaserFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef& reply, bo
{
reply.printf("Duet3D laser filament monitor v%u%s on pin ", version, (switchOpenMask != 0) ? " with switch" : "");
GetPort().AppendPinName(reply);
- reply.catf(", %s, allow %ld%% to %ld%%, check every %.1fmm, ",
+ reply.catf(", %s, allow %ld%% to %ld%%, check every %.1fmm, calibration factor %.3f, ",
(comparisonEnabled) ? "enabled" : "disabled",
ConvertToPercent(minMovementAllowed),
ConvertToPercent(maxMovementAllowed),
- (double)minimumExtrusionCheckLength);
+ (double)minimumExtrusionCheckLength,
+ (double)calibrationFactor);
if (!dataReceived)
{
@@ -360,18 +364,19 @@ FilamentSensorStatus LaserFilamentMonitor::CheckFilament(float amountCommanded,
}
FilamentSensorStatus ret = FilamentSensorStatus::ok;
+ float extrusionMeasured = amountMeasured * calibrationFactor;
switch (laserMonitorState)
{
case LaserMonitorState::idle:
laserMonitorState = LaserMonitorState::calibrating;
totalExtrusionCommanded = amountCommanded;
- totalMovementMeasured = amountMeasured;
+ totalMovementMeasured = extrusionMeasured;
break;
case LaserMonitorState::calibrating:
totalExtrusionCommanded += amountCommanded;
- totalMovementMeasured += amountMeasured;
+ totalMovementMeasured += extrusionMeasured;
if (totalExtrusionCommanded >= 10.0)
{
backwards = (totalMovementMeasured < 0.0);
@@ -400,10 +405,10 @@ FilamentSensorStatus LaserFilamentMonitor::CheckFilament(float amountCommanded,
totalExtrusionCommanded += amountCommanded;
if (backwards)
{
- amountMeasured = -amountMeasured;
+ extrusionMeasured = -extrusionMeasured;
}
- totalMovementMeasured += amountMeasured;
- const float ratio = amountMeasured/amountCommanded;
+ totalMovementMeasured += extrusionMeasured;
+ const float ratio = extrusionMeasured/amountCommanded;
if (ratio > maxMovementRatio)
{
maxMovementRatio = ratio;
diff --git a/src/FilamentMonitors/LaserFilamentMonitor.h b/src/FilamentMonitors/LaserFilamentMonitor.h
index def1b5d3..cede7f8a 100644
--- a/src/FilamentMonitors/LaserFilamentMonitor.h
+++ b/src/FilamentMonitors/LaserFilamentMonitor.h
@@ -74,6 +74,7 @@ private:
float MeasuredSensitivity() const noexcept;
// Configuration parameters
+ float calibrationFactor;
float minMovementAllowed, maxMovementAllowed;
float minimumExtrusionCheckLength;
bool comparisonEnabled;