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-11-08 21:14:36 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-11-08 21:14:36 +0300
commit68fa1e12e6d45507ecb5f8f075a1e608f3508e3f (patch)
tree65870dd0b5ac7f142f5b4db3f59c0356aad0a40d
parent255319723a2c44dc23abe9ddb0f5eeb0e1e48892 (diff)
Added check when using remote endstops
When setting up G1 H1 or G1 H3 moves that rely on remote endstops, check that the expansion board knows about the Fixed build errors that occurred in some configurations
-rw-r--r--.cproject15
-rw-r--r--src/CAN/CanInterface.cpp47
-rw-r--r--src/CAN/CanInterface.h5
-rw-r--r--src/DuetNG/Pins_DuetNG.h1
-rw-r--r--src/Endstops/Endstop.h2
-rw-r--r--src/Endstops/EndstopsManager.cpp28
-rw-r--r--src/Endstops/EndstopsManager.h12
-rw-r--r--src/Endstops/StallDetectionEndstop.cpp13
-rw-r--r--src/Endstops/StallDetectionEndstop.h2
-rw-r--r--src/Endstops/SwitchEndstop.cpp28
-rw-r--r--src/Endstops/SwitchEndstop.h2
-rw-r--r--src/Endstops/ZProbeEndstop.cpp8
-rw-r--r--src/Endstops/ZProbeEndstop.h2
-rw-r--r--src/GCodes/GCodeBuffer/StringParser.h1
-rw-r--r--src/GCodes/GCodes.cpp12
-rw-r--r--src/GCodes/GCodes3.cpp28
-rw-r--r--src/GCodes/GCodes4.cpp30
-rw-r--r--src/Movement/DDA.cpp2
-rw-r--r--src/Pccb/Pins_Pccb.h2
-rw-r--r--src/Pins.h4
-rw-r--r--src/Platform.cpp9
-rw-r--r--src/RADDS/Pins_RADDS.h2
-rw-r--r--src/SAME70xpld/Pins_SAME70xpld.h2
-rw-r--r--src/Version.h2
24 files changed, 180 insertions, 79 deletions
diff --git a/.cproject b/.cproject
index 4db3e1f1..024d77eb 100644
--- a/.cproject
+++ b/.cproject
@@ -1027,6 +1027,7 @@
<listOptionValue builtIn="false" value="__SAME70Q21__"/>
<listOptionValue builtIn="false" value="RTOS"/>
<listOptionValue builtIn="false" value="SAME70XPLD"/>
+ <listOptionValue builtIn="false" value="LWIP_GMAC_TASK=0"/>
</option>
<option id="gnu.c.compiler.option.dialect.std.1111466865" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.c.compiler.option.dialect.flags.22997651" name="Other dialect flags" superClass="gnu.c.compiler.option.dialect.flags" useByScannerDiscovery="true" value="-std=gnu99" valueType="string"/>
@@ -1037,15 +1038,16 @@
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${LinkFlags1} &quot;${workspace_loc:/${CoreName}}/SAME70/cores/arduino/syscalls.o&quot; ${INPUTS} ${LinkFlags2}" id="cdt.managedbuild.tool.gnu.cross.cpp.linker.8484819" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<option id="gnu.cpp.link.option.nostdlibs.1515694027" name="No startup or default libs (-nostdlib)" superClass="gnu.cpp.link.option.nostdlibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.paths.78806302" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CoreNG/SAME70XPLD/}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RRFLibraries/SAME70}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/FreeRTOS/SAME70}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CoreNG/SAME70XPLD}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/CoreNG/SAME70XPLD/}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RRFLibraries/SAME70_RTOS}&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.libs.1498089806" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
+ <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="RRFLibraries"/>
+ <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="FreeRTOS"/>
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="CoreNG"/>
- <listOptionValue builtIn="false" value="${CoreName}"/>
- <listOptionValue builtIn="false" value="FreeRTOS"/>
- <listOptionValue builtIn="false" value="RRFLibraries"/>
</option>
<option id="gnu.cpp.link.option.flags.1694312842" name="Linker flags" superClass="gnu.cpp.link.option.flags" useByScannerDiscovery="false" value="-Os --specs=nano.specs -Wl,--gc-sections -Wl,--fatal-warnings -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -T&quot;${workspace_loc:/${CoreName}/variants/same70/linker_scripts/gcc/flash.ld}&quot; -Wl,-Map,&quot;${workspace_loc:/${ProjName}/${ConfigName}}/${BuildArtifactFileBaseName}.map&quot;" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.806549806" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
@@ -1094,6 +1096,7 @@
<listOptionValue builtIn="false" value="__SAME70Q21__"/>
<listOptionValue builtIn="false" value="RTOS"/>
<listOptionValue builtIn="false" value="SAME70XPLD"/>
+ <listOptionValue builtIn="false" value="LWIP_GMAC_TASK=0"/>
<listOptionValue builtIn="false" value="_XOPEN_SOURCE"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.152869856" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
@@ -1108,10 +1111,10 @@
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings">
- <externalSettings containerId="CoreNG;cdt.managedbuild.config.gnu.cross.lib.release.897729483.161018050.906601308" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">
+ <externalSettings containerId="CoreNG;cdt.managedbuild.config.gnu.cross.lib.release.897729483.161018050.906601308.216576016" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/CoreNG"/>
- <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/CoreNG/SAME70"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/CoreNG/SAME70XPLD"/>
<entry flags="RESOLVED" kind="libraryFile" name="CoreNG" srcPrefixMapping="" srcRootPath=""/>
</externalSetting>
</externalSettings>
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp
index 7d4a1f55..eb8389cc 100644
--- a/src/CAN/CanInterface.cpp
+++ b/src/CAN/CanInterface.cpp
@@ -937,7 +937,7 @@ void CanInterface::WakeCanSender()
}
// Remote handle functions
-GCodeResult CanInterface::CreateHandle(CanAddress boardAddress, RemoteInputHandle h, const char *pinName, uint16_t threshold, uint16_t minInterval, uint8_t& currentState, const StringRef& reply)
+GCodeResult CanInterface::CreateHandle(CanAddress boardAddress, RemoteInputHandle h, const char *pinName, uint16_t threshold, uint16_t minInterval, bool& currentState, const StringRef& reply)
{
CanMessageBuffer * const buf = CanMessageBuffer::Allocate();
if (buf == nullptr)
@@ -954,10 +954,16 @@ GCodeResult CanInterface::CreateHandle(CanAddress boardAddress, RemoteInputHandl
SafeStrncpy(msg->pinName, pinName, ARRAY_SIZE(msg->pinName));
buf->dataLength = msg->GetActualDataLength();
- return SendRequestAndGetStandardReply(buf, rid, reply, &currentState);
+ uint8_t extra;
+ const GCodeResult rslt = SendRequestAndGetStandardReply(buf, rid, reply, &extra);
+ if (rslt == GCodeResult::ok)
+ {
+ currentState = (extra != 0);
+ }
+ return rslt;
}
-GCodeResult CanInterface::DeleteHandle(CanAddress boardAddress, RemoteInputHandle h, const StringRef &reply)
+static GCodeResult ChangeInputMonitor(CanAddress boardAddress, RemoteInputHandle h, uint8_t action, bool* currentState, const StringRef &reply)
{
CanMessageBuffer * const buf = CanMessageBuffer::Allocate();
if (buf == nullptr)
@@ -966,27 +972,32 @@ GCodeResult CanInterface::DeleteHandle(CanAddress boardAddress, RemoteInputHandl
return GCodeResult::error;
}
- const CanRequestId rid = AllocateRequestId(boardAddress);
+ const CanRequestId rid = CanInterface::AllocateRequestId(boardAddress);
auto msg = buf->SetupRequestMessage<CanMessageChangeInputMonitor>(rid, CanId::MasterAddress, boardAddress);
msg->handle = h;
- msg->action = CanMessageChangeInputMonitor::actionDelete;
- return SendRequestAndGetStandardReply(buf, rid, reply);
+ msg->action = action;
+ uint8_t extra;
+ const GCodeResult rslt = CanInterface::SendRequestAndGetStandardReply(buf, rid, reply, &extra);
+ if (rslt == GCodeResult::ok && currentState != nullptr)
+ {
+ *currentState = (extra != 0);
+ }
+ return rslt;
}
-GCodeResult CanInterface::GetHandlePinName(CanAddress boardAddress, RemoteInputHandle h, const StringRef &reply)
+GCodeResult CanInterface::DeleteHandle(CanAddress boardAddress, RemoteInputHandle h, const StringRef &reply)
{
- CanMessageBuffer * const buf = CanMessageBuffer::Allocate();
- if (buf == nullptr)
- {
- reply.copy("No CAN buffer");
- return GCodeResult::error;
- }
+ return ChangeInputMonitor(boardAddress, h, CanMessageChangeInputMonitor::actionDelete, nullptr, reply);
+}
- const CanRequestId rid = AllocateRequestId(boardAddress);
- auto msg = buf->SetupRequestMessage<CanMessageChangeInputMonitor>(rid, CanId::MasterAddress, boardAddress);
- msg->handle = h;
- msg->action = CanMessageChangeInputMonitor::actionReturnPinName;
- return SendRequestAndGetStandardReply(buf, rid, reply);
+GCodeResult CanInterface::GetHandlePinName(CanAddress boardAddress, RemoteInputHandle h, bool& currentState, const StringRef &reply)
+{
+ return ChangeInputMonitor(boardAddress, h, CanMessageChangeInputMonitor::actionReturnPinName, &currentState, reply);
+}
+
+GCodeResult CanInterface::EnableHandle(CanAddress boardAddress, RemoteInputHandle h, bool &currentState, const StringRef &reply)
+{
+ return ChangeInputMonitor(boardAddress, h, CanMessageChangeInputMonitor::actionDoMonitor, &currentState, reply);
}
void CanInterface::Diagnostics(MessageType mtype)
diff --git a/src/CAN/CanInterface.h b/src/CAN/CanInterface.h
index cb9a34b4..aaa30191 100644
--- a/src/CAN/CanInterface.h
+++ b/src/CAN/CanInterface.h
@@ -89,9 +89,10 @@ namespace CanInterface
void WakeCanSender();
// Remote handle functions
- GCodeResult CreateHandle(CanAddress boardAddress, RemoteInputHandle h, const char *pinName, uint16_t threshold, uint16_t minInterval, uint8_t& currentState, const StringRef& reply);
+ GCodeResult CreateHandle(CanAddress boardAddress, RemoteInputHandle h, const char *pinName, uint16_t threshold, uint16_t minInterval, bool& currentState, const StringRef& reply);
GCodeResult DeleteHandle(CanAddress boardAddress, RemoteInputHandle h, const StringRef& reply);
- GCodeResult GetHandlePinName(CanAddress boardAddress, RemoteInputHandle h, const StringRef& reply);
+ GCodeResult GetHandlePinName(CanAddress boardAddress, RemoteInputHandle h, bool& currentState, const StringRef& reply);
+ GCodeResult EnableHandle(CanAddress boardAddress, RemoteInputHandle h, bool& currentState, const StringRef& reply);
void Diagnostics(MessageType mtype);
}
diff --git a/src/DuetNG/Pins_DuetNG.h b/src/DuetNG/Pins_DuetNG.h
index 8a301b37..59330072 100644
--- a/src/DuetNG/Pins_DuetNG.h
+++ b/src/DuetNG/Pins_DuetNG.h
@@ -41,6 +41,7 @@ constexpr size_t NumFirmwareUpdateModules = 4; // 3 modules, plus one for manua
#define ALLOCATE_DEFAULT_PORTS 1
#define USE_CACHE 1 // set nonzero to enable the cache
+#define USE_MPU 0 // set nonzero to enable the memory protection unit
#define NO_EXTRUDER_ENDSTOPS 1 // Temporary!!!
diff --git a/src/Endstops/Endstop.h b/src/Endstops/Endstop.h
index 085fe2ba..33d90a92 100644
--- a/src/Endstops/Endstop.h
+++ b/src/Endstops/Endstop.h
@@ -57,7 +57,7 @@ class Endstop : public EndstopOrZProbe
{
public:
virtual EndStopInputType GetEndstopType() const = 0;
- virtual void Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) = 0;
+ virtual bool Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) = 0;
virtual void AppendDetails(const StringRef& str) = 0;
#if SUPPORT_CAN_EXPANSION
diff --git a/src/Endstops/EndstopsManager.cpp b/src/Endstops/EndstopsManager.cpp
index 6b9f2fb0..b525eba1 100644
--- a/src/Endstops/EndstopsManager.cpp
+++ b/src/Endstops/EndstopsManager.cpp
@@ -74,24 +74,32 @@ void EndstopsManager::AddToActive(EndstopOrZProbe& e)
activeEndstops = &e;
}
-// Set up the active endstop list according to the axes commanded to move in a G0/G1 S1/S3 command
-void EndstopsManager::EnableAxisEndstops(AxesBitmap axes, bool forHoming)
+// Set up the active endstop list according to the axes commanded to move in a G0/G1 S1/S3 command. Return true if successful.
+bool EndstopsManager::EnableAxisEndstops(AxesBitmap axes, bool forHoming)
{
activeEndstops = nullptr;
isHomingMove = forHoming;
const Kinematics& kin = reprap.GetMove().GetKinematics();
for (size_t axis = 0; axis < reprap.GetGCodes().GetVisibleAxes(); ++axis)
{
- if (IsBitSet(axes, axis) && axisEndstops[axis] != nullptr)
+ if (IsBitSet(axes, axis))
{
- axisEndstops[axis]->Prime(kin, reprap.GetPlatform().GetAxisDriversConfig(axis));
- AddToActive(*axisEndstops[axis]);
+ if (axisEndstops[axis] != nullptr && axisEndstops[axis]->Prime(kin, reprap.GetPlatform().GetAxisDriversConfig(axis)))
+ {
+ AddToActive(*axisEndstops[axis]);
+ }
+ else
+ {
+ activeEndstops = nullptr;
+ return false;
+ }
}
}
+ return true;
}
-// Set up the active endstops for Z probing
-void EndstopsManager::EnableZProbe(size_t probeNumber, bool probingAway)
+// Set up the active endstops for Z probing, returning true if successful
+bool EndstopsManager::EnableZProbe(size_t probeNumber, bool probingAway)
{
activeEndstops = nullptr;
isHomingMove = false;
@@ -100,13 +108,15 @@ void EndstopsManager::EnableZProbe(size_t probeNumber, bool probingAway)
zProbes[probeNumber]->SetProbingAway(probingAway);
AddToActive(*zProbes[probeNumber]);
}
+ return true;
}
// Enable extruder endstops
-void EndstopsManager::EnableExtruderEndstop(size_t extruder)
+bool EndstopsManager::EnableExtruderEndstop(size_t extruder)
{
#ifdef NO_EXTRUDER_ENDSTOPS
- // do nothing for now
+ // not supported for now
+ return false;
#else
qq; //TODO
#endif
diff --git a/src/Endstops/EndstopsManager.h b/src/Endstops/EndstopsManager.h
index 704738a3..859ac8f2 100644
--- a/src/Endstops/EndstopsManager.h
+++ b/src/Endstops/EndstopsManager.h
@@ -26,17 +26,17 @@ public:
void Init();
- // Set up the active endstop list according to the axes commanded to move in a G0/G1 S1/S3 command
- void EnableAxisEndstops(AxesBitmap axes, bool forHoming);
+ // Set up the active endstop list according to the axes commanded to move in a G0/G1 S1/S3 command returning true if successful
+ bool EnableAxisEndstops(AxesBitmap axes, bool forHoming) __attribute__ ((warn_unused_result));
- // Set up the active endstops for Z probing
- void EnableZProbe(size_t probeNumber, bool probingAway = false);
+ // Set up the active endstops for Z probing returning true if successful
+ bool EnableZProbe(size_t probeNumber, bool probingAway = false) __attribute__ ((warn_unused_result));
// Set up the active endstops for Z probing with the current probe
- void EnableCurrentZProbe(bool probingAway = false) { EnableZProbe(currentZProbeNumber, probingAway); }
+ bool EnableCurrentZProbe(bool probingAway = false) __attribute__ ((warn_unused_result)) { return EnableZProbe(currentZProbeNumber, probingAway); }
// Enable extruder endstops
- void EnableExtruderEndstop(size_t extruder);
+ bool EnableExtruderEndstop(size_t extruder);
// Get the first endstop that has triggered and remove it from the active list if appropriate
EndstopHitDetails CheckEndstops(bool goingSlow);
diff --git a/src/Endstops/StallDetectionEndstop.cpp b/src/Endstops/StallDetectionEndstop.cpp
index 0c888775..6a566572 100644
--- a/src/Endstops/StallDetectionEndstop.cpp
+++ b/src/Endstops/StallDetectionEndstop.cpp
@@ -23,13 +23,18 @@ EndStopHit StallDetectionEndstop::Stopped() const
}
// This is called to prime axis endstops
-void StallDetectionEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers)
+bool StallDetectionEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers)
{
- // Find which drivers are relevant, Decide whether we stop just the driver, just the axis, or everything
- // Decide whether we stop just the driver, just the axis, or everything
+ // Find which drivers are relevant, and decide whether we stop just the driver, just the axis, or everything
stopAll = (kin.GetConnectedAxes(GetAxis()) & ~MakeBitmap<AxesBitmap>(GetAxis())) != 0;
numDriversLeft = axisDrivers.numDrivers;
driversMonitored = axisDrivers.GetDriversBitmap();
+
+#if SUPPORT_CAN_EXPANSION
+ //TODO if there any remote stall endstops, check they are set up to report
+#endif
+
+ return true;
}
// Check whether the endstop is triggered and return the action that should be performed. Called from the step ISR.
@@ -37,7 +42,7 @@ void StallDetectionEndstop::Prime(const Kinematics& kin, const AxisDriversConfig
EndstopHitDetails StallDetectionEndstop::CheckTriggered(bool goingSlow)
{
EndstopHitDetails rslt; // initialised by default constructor
- DriversBitmap relevantStalledDrivers = driversMonitored && GetStalledDrivers();
+ const DriversBitmap relevantStalledDrivers = driversMonitored & GetStalledDrivers();
if (relevantStalledDrivers != 0)
{
rslt.axis = GetAxis();
diff --git a/src/Endstops/StallDetectionEndstop.h b/src/Endstops/StallDetectionEndstop.h
index 4f663e2e..56095772 100644
--- a/src/Endstops/StallDetectionEndstop.h
+++ b/src/Endstops/StallDetectionEndstop.h
@@ -21,7 +21,7 @@ public:
EndStopInputType GetEndstopType() const override { return (individualMotors) ? EndStopInputType::motorStallIndividual : EndStopInputType::motorStallAny; }
EndStopHit Stopped() const override;
- void Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override;
+ bool Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override;
EndstopHitDetails CheckTriggered(bool goingSlow) override;
bool Acknowledge(EndstopHitDetails what) override;
void AppendDetails(const StringRef& str) override;
diff --git a/src/Endstops/SwitchEndstop.cpp b/src/Endstops/SwitchEndstop.cpp
index 2e898b24..747c8f41 100644
--- a/src/Endstops/SwitchEndstop.cpp
+++ b/src/Endstops/SwitchEndstop.cpp
@@ -92,14 +92,12 @@ GCodeResult SwitchEndstop::Configure(const char *pinNames, const StringRef& repl
if (boardAddress != CanId::MasterAddress)
{
RemoteInputHandle h(RemoteInputHandle::typeEndstop, GetAxis(), numPortsUsed);
- uint8_t currentState;
- const GCodeResult rslt = CanInterface::CreateHandle(boardAddress, h, pn.c_str(), 0, MinimumSwitchReportInterval, currentState, reply);
+ const GCodeResult rslt = CanInterface::CreateHandle(boardAddress, h, pn.c_str(), 0, MinimumSwitchReportInterval, states[numPortsUsed], reply);
if (rslt != GCodeResult::ok)
{
ReleasePorts();
return rslt;
}
- states[numPortsUsed] = (currentState != 0);
}
else
#endif
@@ -159,12 +157,32 @@ EndStopHit SwitchEndstop::Stopped() const
}
// This is called to prime axis endstops
-void SwitchEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers)
+bool SwitchEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers)
{
// Decide whether we stop just the driver, just the axis, or everything
stopAll = ((kin.GetConnectedAxes(GetAxis()) & ~MakeBitmap<AxesBitmap>(GetAxis())) != 0);
numPortsLeftToTrigger = (numPortsUsed != axisDrivers.numDrivers) ? 1 : numPortsUsed;
portsLeftToTrigger = LowestNBits<PortsBitmap>(numPortsUsed);
+
+#if SUPPORT_CAN_EXPANSION
+ // For each remote switch, check that the expansion board knows about it, and make sure we have an up-to-date state
+ for (size_t i = 0; i < numPortsUsed; ++i)
+ {
+ if (boardNumbers[i] != 0)
+ {
+ RemoteInputHandle h(RemoteInputHandle::typeEndstop, GetAxis(), i);
+ String<StringLength100> reply;
+ if (CanInterface::EnableHandle(boardNumbers[i], h, states[i], reply.GetRef()) != GCodeResult::ok)
+ {
+ reply.cat('\n');
+ reprap.GetPlatform().Message(ErrorMessage, reply.c_str());
+ return false;
+ }
+ }
+ }
+#endif
+
+ return true;
}
// Check whether the endstop is triggered and return the action that should be performed. Don't update the state until Acknowledge is called.
@@ -255,7 +273,7 @@ void SwitchEndstop::AppendDetails(const StringRef& str)
{
RemoteInputHandle h(RemoteInputHandle::typeEndstop, GetAxis(), i);
String<StringLength100> reply;
- if (CanInterface::GetHandlePinName(boardNumbers[i], h, reply.GetRef()) == GCodeResult::ok)
+ if (CanInterface::GetHandlePinName(boardNumbers[i], h, states[i], reply.GetRef()) == GCodeResult::ok)
{
str.cat(reply.c_str());
}
diff --git a/src/Endstops/SwitchEndstop.h b/src/Endstops/SwitchEndstop.h
index 480aed8d..cd4492be 100644
--- a/src/Endstops/SwitchEndstop.h
+++ b/src/Endstops/SwitchEndstop.h
@@ -24,7 +24,7 @@ public:
EndStopInputType GetEndstopType() const override;
EndStopHit Stopped() const override;
- void Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override;
+ bool Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override;
EndstopHitDetails CheckTriggered(bool goingSlow) override;
bool Acknowledge(EndstopHitDetails what) override;
void AppendDetails(const StringRef& str) override;
diff --git a/src/Endstops/ZProbeEndstop.cpp b/src/Endstops/ZProbeEndstop.cpp
index 6bb55b60..50c80f98 100644
--- a/src/Endstops/ZProbeEndstop.cpp
+++ b/src/Endstops/ZProbeEndstop.cpp
@@ -25,10 +25,16 @@ EndStopHit ZProbeEndstop::Stopped() const
}
// This is called to prime axis endstops
-void ZProbeEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers)
+bool ZProbeEndstop::Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers)
{
// Decide whether we stop just the driver, just the axis, or everything
stopAll = (kin.GetConnectedAxes(GetAxis()) & ~MakeBitmap<AxesBitmap>(GetAxis())) != 0;
+
+#if SUPPORT_CAN_EXPANSION
+ //TODO if the Z probe is remote, check that the expansoin board knows about it
+#endif
+
+ return true;
}
// Check whether the endstop is triggered and return the action that should be performed. Called from the step ISR.
diff --git a/src/Endstops/ZProbeEndstop.h b/src/Endstops/ZProbeEndstop.h
index cdad49e5..45dee2bf 100644
--- a/src/Endstops/ZProbeEndstop.h
+++ b/src/Endstops/ZProbeEndstop.h
@@ -20,7 +20,7 @@ public:
EndStopInputType GetEndstopType() const override { return EndStopInputType::zProbeAsEndstop; }
EndStopHit Stopped() const override;
- void Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override;
+ bool Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) override;
EndstopHitDetails CheckTriggered(bool goingSlow) override;
bool Acknowledge(EndstopHitDetails what) override;
void AppendDetails(const StringRef& str) override;
diff --git a/src/GCodes/GCodeBuffer/StringParser.h b/src/GCodes/GCodeBuffer/StringParser.h
index 735f5ff2..815b4d47 100644
--- a/src/GCodes/GCodeBuffer/StringParser.h
+++ b/src/GCodes/GCodeBuffer/StringParser.h
@@ -14,6 +14,7 @@
#include "ObjectModel/ObjectModel.h"
class GCodeBuffer;
+class IPAddress;
class StringParser
{
diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp
index 341e5111..c6aaebae 100644
--- a/src/GCodes/GCodes.cpp
+++ b/src/GCodes/GCodes.cpp
@@ -1569,7 +1569,7 @@ bool GCodes::CheckEnoughAxesHomed(AxesBitmap axesMoved)
return (reprap.GetMove().GetKinematics().MustBeHomedAxes(axesMoved, noMovesBeforeHoming) & ~axesHomed) != 0;
}
-// Execute a straight move returning true if an error was written to 'reply'
+// Execute a straight move returning an error message if the command was rejected, else nullptr
// We have already acquired the movement lock and waited for the previous move to be taken.
const char* GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated)
{
@@ -1735,13 +1735,19 @@ const char* GCodes::DoStraightMove(GCodeBuffer& gb, bool isCoordinated)
break;
case 1:
- platform.GetEndstops().EnableAxisEndstops(axesMentioned & LowestNBits<AxesBitmap>(numTotalAxes), true);
+ if (!platform.GetEndstops().EnableAxisEndstops(axesMentioned & LowestNBits<AxesBitmap>(numTotalAxes), true))
+ {
+ return "Failed to enable endstops";
+ }
moveBuffer.checkEndstops = true;
break;
case 3:
axesToSenseLength = axesMentioned & LowestNBits<AxesBitmap>(numTotalAxes);
- platform.GetEndstops().EnableAxisEndstops(axesMentioned & LowestNBits<AxesBitmap>(numTotalAxes), false);
+ if (!platform.GetEndstops().EnableAxisEndstops(axesMentioned & LowestNBits<AxesBitmap>(numTotalAxes), false))
+ {
+ return "Failed to enable endstops";
+ }
moveBuffer.checkEndstops = true;
break;
diff --git a/src/GCodes/GCodes3.cpp b/src/GCodes/GCodes3.cpp
index 8e93a9da..dfdf119a 100644
--- a/src/GCodes/GCodes3.cpp
+++ b/src/GCodes/GCodes3.cpp
@@ -838,14 +838,16 @@ GCodeResult GCodes::ProbeTool(GCodeBuffer& gb, const StringRef& reply)
}
moveBuffer.feedRate = gb.MachineState().feedRate;
- if (useProbe)
+ const bool probeOk = (useProbe)
+ ? platform.GetEndstops().EnableZProbe(probeNumberToUse)
+ : platform.GetEndstops().EnableAxisEndstops(MakeBitmap<AxesBitmap>(axis), false);
+ if (!probeOk)
{
- platform.GetEndstops().EnableZProbe(probeNumberToUse);
- }
- else
- {
- platform.GetEndstops().EnableAxisEndstops(MakeBitmap<AxesBitmap>(axis), false);
+ reply.copy("Failed to prime endstop or probe");
+ AbortPrint(gb);
+ return GCodeResult::error;
}
+
moveBuffer.checkEndstops = true;
// Kick off new movement
@@ -908,14 +910,16 @@ GCodeResult GCodes::FindCenterOfCavity(GCodeBuffer& gb, const StringRef& reply,
}
moveBuffer.feedRate = gb.MachineState().feedRate;
- if (useProbe)
+ const bool probeOk = (useProbe)
+ ? platform.GetEndstops().EnableZProbe(probeNumberToUse)
+ : platform.GetEndstops().EnableAxisEndstops(MakeBitmap<AxesBitmap>(axis), false);
+ if (!probeOk)
{
- platform.GetEndstops().EnableZProbe(probeNumberToUse);
- }
- else
- {
- platform.GetEndstops().EnableAxisEndstops(MakeBitmap<AxesBitmap>(axis), false);
+ reply.copy("Failed to prime endstop or probe");
+ AbortPrint(gb);
+ return GCodeResult::error;
}
+
moveBuffer.checkEndstops = true;
// Kick off new movement
diff --git a/src/GCodes/GCodes4.cpp b/src/GCodes/GCodes4.cpp
index 4fe37713..5e267242 100644
--- a/src/GCodes/GCodes4.cpp
+++ b/src/GCodes/GCodes4.cpp
@@ -537,7 +537,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply)
else if (platform.GetCurrentZProbe().Stopped() == EndStopHit::atStop)
{
reprap.GetHeat().SuspendHeaters(false);
- platform.Message(ErrorMessage, "Z probe already triggered before probing move started");
+ platform.Message(ErrorMessage, "Z probe already triggered before probing move started\n");
gb.SetState(GCodeState::normal);
if (zp.GetProbeType() != ZProbeType::none && !probeIsDeployed)
{
@@ -549,8 +549,14 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply)
{
zProbeTriggered = false;
SetMoveBufferDefaults();
+ if (!platform.GetEndstops().EnableCurrentZProbe())
+ {
+ error = true;
+ reply.copy("Failed to enable Z probe");
+ gb.SetState(GCodeState::normal);
+ break;
+ }
platform.GetCurrentZProbe().SetProbing(true);
- platform.GetEndstops().EnableCurrentZProbe();
moveBuffer.checkEndstops = true;
moveBuffer.reduceAcceleration = true;
moveBuffer.coords[Z_AXIS] = -zp.GetDiveHeight() + zp.GetActualTriggerHeight();
@@ -838,8 +844,15 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply)
{
zProbeTriggered = false;
SetMoveBufferDefaults();
+ if (!platform.GetEndstops().EnableCurrentZProbe())
+ {
+ error = true;
+ reply.copy("Failed to enable Z probe");
+ gb.SetState(GCodeState::normal);
+ break;
+ }
+
platform.GetCurrentZProbe().SetProbing(true);
- platform.GetEndstops().EnableCurrentZProbe();
moveBuffer.checkEndstops = true;
moveBuffer.reduceAcceleration = true;
moveBuffer.coords[Z_AXIS] = (IsAxisHomed(Z_AXIS))
@@ -1092,7 +1105,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply)
gb.AdvanceState(); // resume at the next state when the user has finished
String<MaxMessageLength> message;
- message.printf("Adjust postion until the reference point just %s the target, then press OK", probingAway ? "looses contact to" : "touches");
+ message.printf("Adjust position until the reference point just %s the target, then press OK", probingAway ? "loses contact with" : "touches");
DoManualProbe(gb, message.c_str(), "Manual Straight Probe", sps.GetMovingAxes());
}
else if ((!probingAway && zp.Stopped() == EndStopHit::atStop)
@@ -1115,8 +1128,15 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply)
{
zProbeTriggered = false;
SetMoveBufferDefaults();
+ if (!platform.GetEndstops().EnableZProbe(sps.GetZProbeToUse(), probingAway))
+ {
+ error = true;
+ reply.copy("Failed to enable Z probe");
+ gb.SetState(GCodeState::normal);
+ break;
+ }
+
zp.SetProbing(true);
- platform.GetEndstops().EnableZProbe(sps.GetZProbeToUse(), probingAway);
moveBuffer.checkEndstops = true;
moveBuffer.reduceAcceleration = true;
sps.SetCoordsToTarget(moveBuffer.coords);
diff --git a/src/Movement/DDA.cpp b/src/Movement/DDA.cpp
index d8837d31..5d4b81a1 100644
--- a/src/Movement/DDA.cpp
+++ b/src/Movement/DDA.cpp
@@ -1254,7 +1254,9 @@ void DDA::Prepare(uint8_t simMode, float extrusionPending[])
}
AxesBitmap additionalAxisMotorsToEnable = 0, axisMotorsEnabled = 0;
+#if SUPPORT_CAN_EXPANSION
afterPrepare.drivesMoving = 0;
+#endif
for (size_t drive = 0; drive < MaxAxesPlusExtruders; ++drive)
{
if (flags.isLeadscrewAdjustmentMove)
diff --git a/src/Pccb/Pins_Pccb.h b/src/Pccb/Pins_Pccb.h
index b0e04188..64b8f20f 100644
--- a/src/Pccb/Pins_Pccb.h
+++ b/src/Pccb/Pins_Pccb.h
@@ -95,6 +95,8 @@ constexpr size_t MaxDriversPerAxis = 4; // The maximum number of stepper driv
constexpr size_t MaxExtruders = 3; // The maximum number of extruders
constexpr size_t NumDefaultExtruders = 0; // The number of drivers that we configure as extruders by default
+constexpr size_t MaxAxesPlusExtruders = NumDirectDrivers;
+
constexpr size_t MaxHeatersPerTool = 2;
constexpr size_t MaxExtrudersPerTool = 1;
diff --git a/src/Pins.h b/src/Pins.h
index c80e4493..7037a9ac 100644
--- a/src/Pins.h
+++ b/src/Pins.h
@@ -78,6 +78,10 @@
# define USE_CACHE 0
#endif
+#ifndef USE_MPU
+# define USE_MPU 0
+#endif
+
#ifndef SUPPORT_TMC2660
# define SUPPORT_TMC2660 0
#endif
diff --git a/src/Platform.cpp b/src/Platform.cpp
index 94036c9c..1f185ea7 100644
--- a/src/Platform.cpp
+++ b/src/Platform.cpp
@@ -2336,9 +2336,12 @@ GCodeResult Platform::DiagnosticTest(GCodeBuffer& gb, const StringRef& reply, in
case (int)DiagnosticTestType::BusFault:
// Read from the "Undefined (Abort)" area
#if SAME70
- // FIXME: The SAME70 provides an MPU, maybe we should configure it as well?
- // I guess this can wait until we have the RTOS working though.
- Message(WarningMessage, "There is no abort area on the SAME70");
+# if USE_MPU
+ deliberateError = true;
+ (void)*(reinterpret_cast<const volatile char*>(0x30000000));
+# else
+ Message(WarningMessage, "There is no abort area on the SAME70 with MPU disabled");
+# endif
#elif SAM4E || SAM4S
deliberateError = true;
(void)*(reinterpret_cast<const volatile char*>(0x20800000));
diff --git a/src/RADDS/Pins_RADDS.h b/src/RADDS/Pins_RADDS.h
index 2ae98d7b..c3e97acd 100644
--- a/src/RADDS/Pins_RADDS.h
+++ b/src/RADDS/Pins_RADDS.h
@@ -50,6 +50,8 @@ constexpr size_t MaxDriversPerAxis = 4; // The maximum number of stepper driv
constexpr size_t MaxExtruders = 5; // The maximum number of extruders
constexpr size_t NumDefaultExtruders = 2; // The number of drivers that we configure as extruders by default
+constexpr size_t MaxAxesPlusExtruders = 9;
+
constexpr size_t MaxHeatersPerTool = 2;
constexpr size_t MaxExtrudersPerTool = 5;
diff --git a/src/SAME70xpld/Pins_SAME70xpld.h b/src/SAME70xpld/Pins_SAME70xpld.h
index 4d83ffb5..5fc5641a 100644
--- a/src/SAME70xpld/Pins_SAME70xpld.h
+++ b/src/SAME70xpld/Pins_SAME70xpld.h
@@ -55,6 +55,8 @@ constexpr size_t MaxDriversPerAxis = 5; // The maximum number of stepper driv
constexpr size_t MaxExtruders = 5; // The maximum number of extruders
constexpr size_t NumDefaultExtruders = 2; // The number of drivers that we configure as extruders by default
+constexpr size_t MaxAxesPlusExtruders = NumDirectDrivers;
+
constexpr size_t MaxHeatersPerTool = 4;
constexpr size_t MaxExtrudersPerTool = 6;
diff --git a/src/Version.h b/src/Version.h
index 55a26b41..368351e6 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -20,7 +20,7 @@
#endif
#ifndef DATE
-# define DATE "2019-11-06b5"
+# define DATE "2019-11-08b2"
#endif
#define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman, printm3d"