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-12-27 23:33:08 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-12-27 23:33:08 +0300
commit92b7142cf6a78be3b4c2b1b62532b33269cd13d3 (patch)
tree43f1d1d72de59213475baee32111b08932464cca
parent2220dc76809cb0fcf068fbc7b7a0b6a9ceaf8819 (diff)
Bug fixes
Moved Duet 3 common system limits to file Duet3Limits in CANlib project Fixed G10/G11 speed when multiple extruders are active We now prepend sensor number and name to remote M308 responses Removed unused resource locking functions
-rw-r--r--src/Configuration.h4
-rw-r--r--src/Duet3_V05/Pins_Duet3_V05.h15
-rw-r--r--src/Duet3_V06/Pins_Duet3_V06.h13
-rw-r--r--src/GCodes/GCodes.cpp26
-rw-r--r--src/GCodes/GCodes.h11
-rw-r--r--src/GCodes/GCodes4.cpp4
-rw-r--r--src/Heating/Heat.cpp14
-rw-r--r--src/Heating/Sensors/RemoteSensor.cpp14
-rw-r--r--src/Heating/Sensors/TemperatureSensor.cpp2
-rw-r--r--src/Platform.cpp3
-rw-r--r--src/Version.h2
11 files changed, 45 insertions, 63 deletions
diff --git a/src/Configuration.h b/src/Configuration.h
index 31678ef6..73106bed 100644
--- a/src/Configuration.h
+++ b/src/Configuration.h
@@ -188,7 +188,11 @@ constexpr float DefaultZDive = 5.0; // Millimetres
constexpr float DefaultProbingSpeed = 2.0; // Default Z probing speed mm/sec
constexpr float DefaultZProbeTravelSpeed = 100.0; // Default speed for travel to probe points
constexpr float ZProbeMaxAcceleration = 250.0; // Maximum Z acceleration to use at the start of a probing move
+
+#if !SAME70 // Using SAME70 as a proxy for Duet 3
constexpr size_t MaxZProbeProgramBytes = 8; // Maximum number of bytes in a Z probe program
+#endif
+
constexpr uint32_t ProbingSpeedReductionFactor = 3; // The factor by which we reduce the Z probing speed when we get a 'near' indication
constexpr float DefaultZProbeTolerance = 0.03; // How close the Z probe trigger height from consecutive taps must be
constexpr uint8_t DefaultZProbeTaps = 1; // The maximum number of times we probe each point
diff --git a/src/Duet3_V05/Pins_Duet3_V05.h b/src/Duet3_V05/Pins_Duet3_V05.h
index 1da4a918..42626299 100644
--- a/src/Duet3_V05/Pins_Duet3_V05.h
+++ b/src/Duet3_V05/Pins_Duet3_V05.h
@@ -57,6 +57,8 @@ constexpr uint32_t IAP_IMAGE_END = 0x004FFFFF;
// The physical capabilities of the machine
+#include <Duet3Limits.h> // this file is in the CANlib project because both main and expansion boards need it
+
constexpr size_t NumDirectDrivers = 6; // The maximum number of drives supported by the electronics inc. direct expansion
constexpr size_t MaxSmartDrivers = 6; // The maximum number of direct smart drivers
constexpr size_t MaxCanDrivers = 18;
@@ -64,24 +66,15 @@ constexpr size_t MaxCanBoards = 18;
constexpr float MaxTmc5160Current = 3200.0; // The maximum current we allow the TMC5160/5161 drivers to be set to
-constexpr size_t MaxSensors = 64;
-
-constexpr size_t MaxHeaters = 12;
-constexpr size_t MaxExtraHeaterProtections = 8; // The number of extra heater protection instances
-
constexpr size_t MaxBedHeaters = 9;
constexpr size_t MaxChamberHeaters = 4;
-constexpr int8_t DefaultBedHeater = 0;
constexpr int8_t DefaultE0Heater = 1; // Index of the default first extruder heater, used only for the legacy status response
constexpr size_t NumThermistorInputs = 4;
constexpr size_t NumTmcDriversSenseChannels = 1;
-constexpr size_t MaxZProbes = 4;
-constexpr size_t MaxGpioPorts = 12;
-
constexpr size_t MinAxes = 3; // The minimum and default number of axes
-constexpr size_t MaxAxes = 9; // The maximum number of movement axes in the machine, usually just X, Y and Z, <= DRIVES
+constexpr size_t MaxAxes = 10; // The maximum number of movement axes in the machine, usually just X, Y and Z, <= DRIVES
constexpr size_t MaxDriversPerAxis = 5; // The maximum number of stepper drivers assigned to one axis
constexpr size_t MaxExtruders = 16; // The maximum number of extruders
@@ -92,8 +85,6 @@ constexpr size_t MaxAxesPlusExtruders = 20; // May be <= MaxAxes + MaxExtruder
constexpr size_t MaxHeatersPerTool = 4;
constexpr size_t MaxExtrudersPerTool = 6;
-constexpr size_t MaxFans = 16;
-
constexpr unsigned int MaxTriggers = 32; // Must be <= 32 because we store a bitmap of pending triggers in a uint32_t
constexpr size_t NUM_SERIAL_CHANNELS = 2; // The number of serial IO channels not counting the WiFi serial connection (USB and one auxiliary UART)
diff --git a/src/Duet3_V06/Pins_Duet3_V06.h b/src/Duet3_V06/Pins_Duet3_V06.h
index 6dae5ac5..95feee45 100644
--- a/src/Duet3_V06/Pins_Duet3_V06.h
+++ b/src/Duet3_V06/Pins_Duet3_V06.h
@@ -61,6 +61,8 @@ constexpr uint32_t IAP_IMAGE_END = 0x004FFFFF;
// The physical capabilities of the machine
+#include <Duet3Limits.h> // this file is in the CANlib project because both main and expansion boards need it
+
constexpr size_t NumDirectDrivers = 6; // The maximum number of drives supported by the electronics inc. direct expansion
constexpr size_t MaxSmartDrivers = 6; // The maximum number of direct smart drivers
constexpr size_t MaxCanDrivers = 18;
@@ -68,22 +70,13 @@ constexpr size_t MaxCanBoards = 18;
constexpr float MaxTmc5160Current = 6300.0; // The maximum current we allow the TMC5160/5161 drivers to be set to
-constexpr size_t MaxSensors = 64;
-
-constexpr size_t MaxHeaters = 12;
-constexpr size_t MaxExtraHeaterProtections = 8; // The number of extra heater protection instances
-
constexpr size_t MaxBedHeaters = 9;
constexpr size_t MaxChamberHeaters = 4;
-constexpr int8_t DefaultBedHeater = 0;
constexpr int8_t DefaultE0Heater = 1; // Index of the default first extruder heater, used only for the legacy status response
constexpr size_t NumThermistorInputs = 4;
constexpr size_t NumTmcDriversSenseChannels = 1;
-constexpr size_t MaxZProbes = 4;
-constexpr size_t MaxGpioPorts = 16;
-
constexpr size_t MinAxes = 3; // The minimum and default number of axes
constexpr size_t MaxAxes = 10; // The maximum number of movement axes in the machine
constexpr size_t MaxDriversPerAxis = 5; // The maximum number of stepper drivers assigned to one axis
@@ -96,8 +89,6 @@ constexpr size_t MaxAxesPlusExtruders = 20; // May be <= MaxAxes + MaxExtruder
constexpr size_t MaxHeatersPerTool = 4;
constexpr size_t MaxExtrudersPerTool = 6;
-constexpr size_t MaxFans = 16;
-
constexpr unsigned int MaxTriggers = 32; // Must be <= 32 because we store a bitmap of pending triggers in a uint32_t
constexpr size_t NUM_SERIAL_CHANNELS = 2; // The number of serial IO channels not counting the WiFi serial connection (USB and one auxiliary UART)
diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp
index e175175d..280b4831 100644
--- a/src/GCodes/GCodes.cpp
+++ b/src/GCodes/GCodes.cpp
@@ -3432,13 +3432,13 @@ GCodeResult GCodes::RetractFilament(GCodeBuffer& gb, bool retract)
{
// Set up the retract move
const Tool * const tool = reprap.GetCurrentTool();
- if (tool != nullptr)
+ if (tool != nullptr && tool->DriveCount() != 0)
{
for (size_t i = 0; i < tool->DriveCount(); ++i)
{
moveBuffer.coords[ExtruderToLogicalDrive(tool->Drive(i))] = -retractLength;
}
- moveBuffer.feedRate = retractSpeed;
+ moveBuffer.feedRate = retractSpeed * tool->DriveCount();
moveBuffer.canPauseAfter = false; // don't pause after a retraction because that could cause too much retraction
NewMoveAvailable(1);
}
@@ -3461,13 +3461,13 @@ GCodeResult GCodes::RetractFilament(GCodeBuffer& gb, bool retract)
{
// No retract hop, so just un-retract
const Tool * const tool = reprap.GetCurrentTool();
- if (tool != nullptr)
+ if (tool != nullptr && tool->DriveCount() != 0)
{
for (size_t i = 0; i < tool->DriveCount(); ++i)
{
moveBuffer.coords[ExtruderToLogicalDrive(tool->Drive(i))] = retractLength + retractExtra;
}
- moveBuffer.feedRate = unRetractSpeed;
+ moveBuffer.feedRate = unRetractSpeed * tool->DriveCount();
moveBuffer.canPauseAfter = true;
NewMoveAvailable(1);
}
@@ -4260,24 +4260,6 @@ void GCodes::GrabResource(const GCodeBuffer& gb, Resource r)
}
}
-bool GCodes::LockHeater(const GCodeBuffer& gb, int heater)
-{
- if (heater >= 0 && heater < (int)MaxHeaters)
- {
- return LockResource(gb, HeaterResourceBase + heater);
- }
- return true;
-}
-
-bool GCodes::LockFan(const GCodeBuffer& gb, int fan)
-{
- if (fan >= 0 && fan < (int)MaxFans)
- {
- return LockResource(gb, FanResourceBase + fan);
- }
- return true;
-}
-
// Lock the unshareable parts of the file system
bool GCodes::LockFileSystem(const GCodeBuffer &gb)
{
diff --git a/src/GCodes/GCodes.h b/src/GCodes/GCodes.h
index 34dbdcb2..997ffd9e 100644
--- a/src/GCodes/GCodes.h
+++ b/src/GCodes/GCodes.h
@@ -202,24 +202,21 @@ protected:
DECLARE_OBJECT_MODEL
private:
- GCodes(const GCodes&); // private copy constructor to prevent copying
+ GCodes(const GCodes&) = delete;
enum class HeaterFaultState : uint8_t { noFault, pausePending, timing, stopping, stopped };
// Resources that can be locked.
// To avoid deadlock, if you need multiple resources then you must lock them in increasing numerical order.
- typedef unsigned int Resource;
+ typedef uint32_t Resource;
static const Resource MoveResource = 0; // Movement system, including canned cycle variables
static const Resource FileSystemResource = 1; // Non-sharable parts of the file system
static const Resource HeaterResourceBase = 2;
- static const Resource FanResourceBase = HeaterResourceBase + MaxHeaters;
- static const size_t NumResources = FanResourceBase + MaxFans;
+ static const size_t NumResources = HeaterResourceBase + 1;
- static_assert(NumResources <= 32, "Too many resources to keep a bitmap of them in class GCodeMachineState");
+ static_assert(NumResources <= sizeof(Resource) * CHAR_BIT, "Too many resources to keep a bitmap of them in class GCodeMachineState");
bool LockResource(const GCodeBuffer& gb, Resource r); // Lock the resource, returning true if success
- bool LockHeater(const GCodeBuffer& gb, int heater);
- bool LockFan(const GCodeBuffer& gb, int fan);
bool LockFileSystem(const GCodeBuffer& gb); // Lock the unshareable parts of the file system
bool LockMovement(const GCodeBuffer& gb); // Lock movement
void GrabResource(const GCodeBuffer& gb, Resource r); // Grab a resource even if it is already owned
diff --git a/src/GCodes/GCodes4.cpp b/src/GCodes/GCodes4.cpp
index b257587d..cc9b7cd7 100644
--- a/src/GCodes/GCodes4.cpp
+++ b/src/GCodes/GCodes4.cpp
@@ -1214,7 +1214,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply)
if (segmentsLeft == 0)
{
const Tool * const tool = reprap.GetCurrentTool();
- if (tool != nullptr)
+ if (tool != nullptr && tool->DriveCount() != 0)
{
SetMoveBufferDefaults();
reprap.GetMove().GetCurrentUserPosition(moveBuffer.coords, 0, tool);
@@ -1222,7 +1222,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply)
{
moveBuffer.coords[ExtruderToLogicalDrive(tool->Drive(i))] = retractLength + retractExtra;
}
- moveBuffer.feedRate = unRetractSpeed;
+ moveBuffer.feedRate = unRetractSpeed * tool->DriveCount();
moveBuffer.tool = tool;
moveBuffer.isFirmwareRetraction = true;
moveBuffer.filePos = (&gb == fileGCode) ? gb.GetFilePosition() : noFilePosition;
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp
index 8d7fb36f..5844d94c 100644
--- a/src/Heating/Heat.cpp
+++ b/src/Heating/Heat.cpp
@@ -524,9 +524,12 @@ GCodeResult Heat::ConfigureHeater(size_t heater, GCodeBuffer& gb, const StringRe
return GCodeResult::error;
}
+#if SUPPORT_CAN_EXPANSION
+ const CanAddress board = IoPort::RemoveBoardAddress(pinName.GetRef());
+#endif
if (StringEqualsIgnoreCase(pinName.c_str(), NoPinName))
{
- // Settin the pin name to "nil" deletes the heater
+ // Setting the pin name to "nil" deletes the heater
WriteLocker lock(heatersLock);
Heater *oldHeater = nullptr;
std::swap(oldHeater, heaters[heater]);
@@ -550,13 +553,12 @@ GCodeResult Heat::ConfigureHeater(size_t heater, GCodeBuffer& gb, const StringRe
const PwmFrequency freq = (gb.Seen('Q')) ? gb.GetPwmFrequency() : DefaultFanPwmFreq;
#if SUPPORT_CAN_EXPANSION
- const CanAddress board = IoPort::RemoveBoardAddress(pinName.GetRef());
- Heater *newHeater = (board != CanId::MasterAddress) ? (Heater *)new RemoteHeater(heater, board) : new LocalHeater(heater);
+ Heater * const newHeater = (board != CanId::MasterAddress) ? (Heater *)new RemoteHeater(heater, board) : new LocalHeater(heater);
#else
- Heater *newHeater = new LocalHeater(heater);
+ Heater * const newHeater = new LocalHeater(heater);
#endif
const GCodeResult rslt = newHeater->ConfigurePortAndSensor(pinName.c_str(), freq, sensorNumber, reply);
- if (rslt == GCodeResult::ok)
+ if (rslt == GCodeResult::ok || rslt == GCodeResult::warning)
{
heaters[heater] = newHeater;
}
@@ -996,7 +998,7 @@ GCodeResult Heat::ConfigureSensor(GCodeBuffer& gb, const StringRef& reply) noexc
}
const GCodeResult rslt = newSensor->Configure(gb, reply);
- if (rslt == GCodeResult::ok)
+ if (rslt == GCodeResult::ok || rslt == GCodeResult::warning)
{
InsertSensor(newSensor);
}
diff --git a/src/Heating/Sensors/RemoteSensor.cpp b/src/Heating/Sensors/RemoteSensor.cpp
index 0806f783..4ae68a3d 100644
--- a/src/Heating/Sensors/RemoteSensor.cpp
+++ b/src/Heating/Sensors/RemoteSensor.cpp
@@ -28,7 +28,19 @@ GCodeResult RemoteSensor::Configure(GCodeBuffer& gb, const StringRef& reply)
{
return GCodeResult::error;
}
- return cons.SendAndGetResponse(CanMessageType::m308, boardAddress, reply);
+ const GCodeResult ret = cons.SendAndGetResponse(CanMessageType::m308, boardAddress, reply);
+ if ((ret == GCodeResult::ok || ret == GCodeResult::warning) && StringStartsWith(reply.c_str(), "type "))
+ {
+ // It's just a query for the sensor parameters, so prefix the sensor number and name
+ String<StringLength50> temp;
+ temp.printf("Sensor %u ", GetSensorNumber());
+ if (GetSensorName() != nullptr)
+ {
+ temp.catf("(%s) ", GetSensorName());
+ }
+ reply.Insert(0, temp.c_str());
+ }
+ return ret;
}
void RemoteSensor::UpdateRemoteTemperature(CanAddress src, const CanSensorReport& report) noexcept
diff --git a/src/Heating/Sensors/TemperatureSensor.cpp b/src/Heating/Sensors/TemperatureSensor.cpp
index 566e8747..a8d7a2cc 100644
--- a/src/Heating/Sensors/TemperatureSensor.cpp
+++ b/src/Heating/Sensors/TemperatureSensor.cpp
@@ -78,7 +78,7 @@ GCodeResult TemperatureSensor::Configure(GCodeBuffer& gb, const StringRef& reply
void TemperatureSensor::CopyBasicDetails(const StringRef& reply) const noexcept
{
- reply.printf("Sensor %d", sensorNumber);
+ reply.printf("Sensor %u", sensorNumber);
if (sensorName != nullptr)
{
reply.catf(" (%s)", sensorName);
diff --git a/src/Platform.cpp b/src/Platform.cpp
index 8b1dba6a..77703e68 100644
--- a/src/Platform.cpp
+++ b/src/Platform.cpp
@@ -543,10 +543,13 @@ void Platform::Init() noexcept
// Initialise the configured heaters to just the default bed heater (there are no default chamber heaters)
configuredHeaters = 0;
+
+#ifndef DUET3
if (DefaultBedHeater >= 0)
{
SetBit(configuredHeaters, DefaultBedHeater);
}
+#endif
// Enable pullups on all the SPI CS pins. This is required if we are using more than one device on the SPI bus.
// Otherwise, when we try to initialise the first device, the other devices may respond as well because their CS lines are not high.
diff --git a/src/Version.h b/src/Version.h
index 687d550c..931efdd3 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -20,7 +20,7 @@
#endif
#ifndef DATE
-# define DATE "2019-12-22b4"
+# define DATE "2019-12-27b2"
#endif
#define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman, printm3d"