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>2019-02-16 16:16:47 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-02-16 16:16:47 +0300
commit4ee7439bc98318a8bafcd10eec0067a0a2459bb4 (patch)
treed287806742abe6977111850a2fdb093e84d945df /src/FilamentMonitors
parent60a88389fc12b5a1948b392972818ac64d31e728 (diff)
Changes for 2.03beta2
Fixed 12864 display scrolling when the folder included filenames starting with '.' Fixed remaining M105 status response when M997 S1 sent from USB Fixed firmware update messages getting erased on PanelDue during M997 S1 Increased temperature samplinf rate to 4 samples/sec Removed M135 command M203 Inn sets minimum movement speed M203 now reports speeds in mm/sec M208 reports error if min >= max Allow hex inputs anywhere in G/M code parameters where an unsigned value is required Requested fan speed is now scaled by the M106 X parameter Bug fix: M408 Sn was hanging for N>5 Fix leadscrew adjustment bug introduced in 2.03beta1 Shrunk the DDA and Tool structures to reduce RAM usage M111 Sn for n != 0 now requires a P parameter M574 allows endstop input numbers to be configured (C parameter). Currently only the first input number specified for each axis is monitored.
Diffstat (limited to 'src/FilamentMonitors')
-rw-r--r--src/FilamentMonitors/LaserFilamentMonitor.cpp12
-rw-r--r--src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp33
-rw-r--r--src/FilamentMonitors/RotatingMagnetFilamentMonitor.h4
3 files changed, 23 insertions, 26 deletions
diff --git a/src/FilamentMonitors/LaserFilamentMonitor.cpp b/src/FilamentMonitors/LaserFilamentMonitor.cpp
index a7f0572c..907162b7 100644
--- a/src/FilamentMonitors/LaserFilamentMonitor.cpp
+++ b/src/FilamentMonitors/LaserFilamentMonitor.cpp
@@ -160,7 +160,7 @@ void LaserFilamentMonitor::HandleIncomingData()
bool receivedPositionReport = false;
if (res == PollResult::complete)
{
- // Check the parity
+ // We have a completed a position report. Check the parity.
uint8_t data8 = (uint8_t)((val >> 8) ^ val);
data8 ^= (data8 >> 4);
data8 ^= (data8 >> 2);
@@ -224,10 +224,8 @@ void LaserFilamentMonitor::HandleIncomingData()
const uint16_t positionChange = (val - sensorValue) & (positionRange - 1); // 10- or 11-bit position change
const int32_t movement = (positionChange <= positionRange/2) ? (int32_t)positionChange : (int32_t)positionChange - positionRange;
movementMeasuredSinceLastSync += (float)movement * ((val & TypeLaserLargeDataRangeBitMask) ? 0.01 : 0.02);
-
- const uint32_t now = millis();
sensorValue = val;
- lastMeasurementTime = now;
+ lastMeasurementTime = millis();
if (haveStartBitData) // if we have a synchronised value for the amount of extrusion commanded
{
@@ -253,7 +251,7 @@ void LaserFilamentMonitor::HandleIncomingData()
}
// Call the following at intervals to check the status. This is only called when printing is in progress.
-// 'filamentConsumed' is the net amount of extrusion since the last call to this function.
+// 'filamentConsumed' is the net amount of extrusion commanded since the last call to this function.
// 'hadNonPrintingMove' is true if filamentConsumed includes extruder movement from non-printing moves.
// 'fromIsr' is true if this measurement was taken at the end of the ISR because a potential start bit was seen
FilamentSensorStatus LaserFilamentMonitor::Check(bool isPrinting, bool fromIsr, uint32_t isrMillis, float filamentConsumed)
@@ -383,8 +381,8 @@ FilamentSensorStatus LaserFilamentMonitor::CheckFilament(float amountCommanded,
// Clear the measurement state. Called when we are not printing a file. Return the present/not present status if available.
FilamentSensorStatus LaserFilamentMonitor::Clear()
{
- Reset(); // call this first so that haveStartBitData and synced are false when we call HandleIncomingData
- HandleIncomingData();
+ Reset(); // call this first so that haveStartBitData and synced are false when we call HandleIncomingData
+ HandleIncomingData(); // to keep the diagnostics up to date
return (sensorError) ? FilamentSensorStatus::sensorError
: ((sensorValue & switchOpenMask) != 0) ? FilamentSensorStatus::noFilament
diff --git a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
index 489047a4..ce248f38 100644
--- a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
+++ b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.cpp
@@ -31,7 +31,6 @@ void RotatingMagnetFilamentMonitor::Init()
dataReceived = false;
sensorValue = 0;
parityErrorCount = framingErrorCount = overrunErrorCount = polarityErrorCount = overdueCount = 0;
- dataReceived = false;
lastMeasurementTime = 0;
lastErrorCode = 0;
version = 1;
@@ -138,6 +137,12 @@ bool RotatingMagnetFilamentMonitor::Configure(GCodeBuffer& gb, const StringRef&
return false;
}
+// Return the current wheel angle
+float RotatingMagnetFilamentMonitor::GetCurrentPosition() const
+{
+ return (sensorValue & TypeMagnetAngleMask) * (360.0/1024.0);
+}
+
// Deal with any received data
void RotatingMagnetFilamentMonitor::HandleIncomingData()
{
@@ -145,12 +150,11 @@ void RotatingMagnetFilamentMonitor::HandleIncomingData()
PollResult res;
while ((res = PollReceiveBuffer(val)) != PollResult::incomplete)
{
- // We have either received a report or there has been a receive error
+ // We have either received a report or there has been a framing error
bool receivedPositionReport = false;
if (res == PollResult::complete)
{
- // We have a completed a position report
- // Check the parity
+ // We have a completed a position report. Check the parity.
uint8_t data8 = (uint8_t)((val >> 8) ^ val);
data8 ^= (data8 >> 4);
data8 ^= (data8 >> 2);
@@ -226,18 +230,19 @@ void RotatingMagnetFilamentMonitor::HandleIncomingData()
if (receivedPositionReport)
{
- lastMeasurementTime = millis();
+ // We have a completed a position report
const uint16_t angleChange = (val - sensorValue) & TypeMagnetAngleMask; // angle change in range 0..1023
const int32_t movement = (angleChange <= 512) ? (int32_t)angleChange : (int32_t)angleChange - 1024;
movementMeasuredSinceLastSync += (float)movement/1024;
sensorValue = val;
+ lastMeasurementTime = millis();
if (haveStartBitData) // if we have a synchronised value for the amount of extrusion commanded
{
if (synced)
{
if ( checkNonPrintingMoves
- || (wasPrintingAtStartBit && (int32_t)(lastSyncTime - reprap.GetMove().ExtruderPrintingSince()) > SyncDelayMillis)
+ || (wasPrintingAtStartBit && (int32_t)(lastSyncTime - reprap.GetMove().ExtruderPrintingSince()) >= SyncDelayMillis)
)
{
// We can use this measurement
@@ -255,16 +260,10 @@ void RotatingMagnetFilamentMonitor::HandleIncomingData()
}
}
-// Return the current wheel angle
-float RotatingMagnetFilamentMonitor::GetCurrentPosition() const
-{
- return (sensorValue & TypeMagnetAngleMask) * (360.0/1024.0);
-}
-
-// Call the following at intervals to check the status. This is only called when extrusion is in progress or imminent.
+// Call the following at intervals to check the status. This is only called when printing is in progress.
// 'filamentConsumed' is the net amount of extrusion commanded since the last call to this function.
// 'hadNonPrintingMove' is true if filamentConsumed includes extruder movement from non-printing moves.
-// 'fromIsr' is true if this measurement was taken dat the end of the ISR because a potential start bit was seen
+// 'fromIsr' is true if this measurement was taken at the end of the ISR because a potential start bit was seen
FilamentSensorStatus RotatingMagnetFilamentMonitor::Check(bool isPrinting, bool fromIsr, uint32_t isrMillis, float filamentConsumed)
{
// 1. Update the extrusion commanded and whether we have had an extruding but non-printing move
@@ -394,10 +393,10 @@ FilamentSensorStatus RotatingMagnetFilamentMonitor::CheckFilament(float amountCo
return ret;
}
-// Clear the measurement state - called when we are not printing a file. Return the present/not present status if available.
+// Clear the measurement state. Called when we are not printing a file. Return the present/not present status if available.
FilamentSensorStatus RotatingMagnetFilamentMonitor::Clear()
{
- Reset();
+ Reset(); // call this first so that haveStartBitData and synced are false when we call HandleIncomingData
HandleIncomingData(); // to keep the diagnostics up to date
return (sensorError) ? FilamentSensorStatus::sensorError
@@ -413,7 +412,7 @@ void RotatingMagnetFilamentMonitor::Diagnostics(MessageType mtype, unsigned int
: ((sensorValue & switchOpenMask) != 0) ? "no filament"
: "ok";
reprap.GetPlatform().MessageF(mtype, "Extruder %u: pos %.2f, %s, ", extruder, (double)GetCurrentPosition(), statusText);
- if (magneticMonitorState != MagneticMonitorState::calibrating && totalExtrusionCommanded > 20.0)
+ if (magneticMonitorState != MagneticMonitorState::calibrating && totalExtrusionCommanded > 10.0)
{
const float measuredMmPerRev = totalExtrusionCommanded/totalMovementMeasured;
reprap.GetPlatform().MessageF(mtype, "measured sens %.2fmm/rev min %ld%% max %ld%% over %.1fmm",
diff --git a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.h b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.h
index 84f98bbd..489576ee 100644
--- a/src/FilamentMonitors/RotatingMagnetFilamentMonitor.h
+++ b/src/FilamentMonitors/RotatingMagnetFilamentMonitor.h
@@ -34,8 +34,8 @@ private:
static constexpr uint16_t TypeMagnetV2ParityMask = 0x8000;
// Definitions for identifying the top level type of a message
- static constexpr uint16_t TypeMagnetV2MessageTypeMask = 0x6000;
- static constexpr uint16_t TypeMagnetV2MessageTypePosition = 0x0000;
+ static constexpr uint16_t TypeMagnetV2MessageTypeMask = 0x6C00;
+ static constexpr uint16_t TypeMagnetV2MessageTypePosition = 0x0800;
static constexpr uint16_t TypeMagnetV2MessageTypeError = 0x2000;
static constexpr uint16_t TypeMagnetV2MessageTypeInfo = 0x6000;