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>2022-07-13 21:27:20 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-07-13 21:27:20 +0300
commit3fc316183e1066f20b799ad8ffb14644388c85e7 (patch)
treef19fca7d813e3e669084a3b7c70614e7a006a00e
parent15e3851a9a308e4835312d0e7d241b28399197e1 (diff)
parent2860cf15465ee5a0dacb8309e8580744e649f776 (diff)
Merge branch '3.4-dev' into 3.4-spi-tft3.4-spi-tft
-rw-r--r--src/CAN/CanInterface.cpp84
-rw-r--r--src/CAN/CommandProcessor.cpp10
-rw-r--r--src/InputMonitors/InputMonitor.cpp2
-rw-r--r--src/Platform/Platform.cpp2
-rw-r--r--src/Platform/Tasks.cpp2
5 files changed, 62 insertions, 38 deletions
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp
index 4c3a6739..f3d1de15 100644
--- a/src/CAN/CanInterface.cpp
+++ b/src/CAN/CanInterface.cpp
@@ -25,13 +25,13 @@
#include <GCodes/GCodeBuffer/GCodeBuffer.h>
#include <ClosedLoop/ClosedLoop.h>
-
#if HAS_SBC_INTERFACE
# include "SBC/SbcInterface.h"
#endif
#if SUPPORT_REMOTE_COMMANDS
# include <Version.h>
+# include <InputMonitors/InputMonitor.h>
#endif
#include <memory>
@@ -420,7 +420,7 @@ uint16_t CanInterface::GetTimeStampPeriod() noexcept
#endif
-// Send a message on the CAN FD channel and reord any errors
+// Send a message on the CAN FD channel and record any errors
static void SendCanMessage(CanDevice::TxBufferNumber whichBuffer, uint32_t timeout, CanMessageBuffer *buffer) noexcept
{
const uint32_t cancelledId = can0dev->SendMessage(whichBuffer, timeout, buffer);
@@ -437,46 +437,70 @@ extern "C" [[noreturn]] void CanSenderLoop(void *) noexcept
{
for (;;)
{
- TaskBase::Take(Mutex::TimeoutUnlimited);
- for (;;)
+#if SUPPORT_REMOTE_COMMANDS
+ if (inExpansionMode)
{
- CanMessageBuffer * const urgentMessage = CanMotion::GetUrgentMessage();
- if (urgentMessage != nullptr)
+ // In expansion mode this task just send notifications when the states of input handles change
+ CanMessageBuffer buf(nullptr);
+ auto msg = buf.SetupStatusMessage<CanMessageInputChanged>(CanInterface::GetCanAddress(), CanInterface::GetCurrentMasterAddress());
+ msg->states = 0;
+ msg->zero = 0;
+ msg->numHandles = 0;
+
+ const uint32_t timeToWait = InputMonitor::AddStateChanges(msg);
+ if (msg->numHandles != 0)
{
- SendCanMessage(TxBufferIndexUrgent, MaxUrgentSendWait, urgentMessage);
+ buf.dataLength = msg->GetActualDataLength();
+ SendCanMessage(TxBufferIndexUrgent, MaxUrgentSendWait, &buf);
+ reprap.GetPlatform().OnProcessingCanMessage();
}
- else if (pendingMotionBuffers != nullptr)
+ TaskBase::Take(timeToWait); // wait until we are woken up because a message is available, or we time out
+ }
+ else
+#endif
+ {
+ // In main board mode this task sends urgent messages concerning motion
+ for (;;)
{
- CanMessageBuffer *buf;
+ CanMessageBuffer * const urgentMessage = CanMotion::GetUrgentMessage();
+ if (urgentMessage != nullptr)
+ {
+ SendCanMessage(TxBufferIndexUrgent, MaxUrgentSendWait, urgentMessage);
+ }
+ else if (pendingMotionBuffers != nullptr)
{
- TaskCriticalSectionLocker lock;
- buf = pendingMotionBuffers;
- pendingMotionBuffers = buf->next;
+ CanMessageBuffer *buf;
+ {
+ TaskCriticalSectionLocker lock;
+ buf = pendingMotionBuffers;
+ pendingMotionBuffers = buf->next;
#if 0 //unused
- --numPendingMotionBuffers;
+ --numPendingMotionBuffers;
#endif
- }
+ }
- // Send the message
- SendCanMessage(TxBufferIndexMotion, MaxMotionSendWait, buf);
- reprap.GetPlatform().OnProcessingCanMessage();
+ // Send the message
+ SendCanMessage(TxBufferIndexMotion, MaxMotionSendWait, buf);
+ reprap.GetPlatform().OnProcessingCanMessage();
#ifdef CAN_DEBUG
- // Display a debug message too
- debugPrintf("CCCR %08" PRIx32 ", PSR %08" PRIx32 ", ECR %08" PRIx32 ", TXBRP %08" PRIx32 ", TXBTO %08" PRIx32 ", st %08" PRIx32 "\n",
- MCAN1->MCAN_CCCR, MCAN1->MCAN_PSR, MCAN1->MCAN_ECR, MCAN1->MCAN_TXBRP, MCAN1->MCAN_TXBTO, GetAndClearStatusBits());
- buf->msg.DebugPrint();
- delay(50);
- debugPrintf("CCCR %08" PRIx32 ", PSR %08" PRIx32 ", ECR %08" PRIx32 ", TXBRP %08" PRIx32 ", TXBTO %08" PRIx32 ", st %08" PRIx32 "\n",
- MCAN1->MCAN_CCCR, MCAN1->MCAN_PSR, MCAN1->MCAN_ECR, MCAN1->MCAN_TXBRP, MCAN1->MCAN_TXBTO, GetAndClearStatusBits());
+ // Display a debug message too
+ debugPrintf("CCCR %08" PRIx32 ", PSR %08" PRIx32 ", ECR %08" PRIx32 ", TXBRP %08" PRIx32 ", TXBTO %08" PRIx32 ", st %08" PRIx32 "\n",
+ MCAN1->MCAN_CCCR, MCAN1->MCAN_PSR, MCAN1->MCAN_ECR, MCAN1->MCAN_TXBRP, MCAN1->MCAN_TXBTO, GetAndClearStatusBits());
+ buf->msg.DebugPrint();
+ delay(50);
+ debugPrintf("CCCR %08" PRIx32 ", PSR %08" PRIx32 ", ECR %08" PRIx32 ", TXBRP %08" PRIx32 ", TXBTO %08" PRIx32 ", st %08" PRIx32 "\n",
+ MCAN1->MCAN_CCCR, MCAN1->MCAN_PSR, MCAN1->MCAN_ECR, MCAN1->MCAN_TXBRP, MCAN1->MCAN_TXBTO, GetAndClearStatusBits());
#endif
- // Free the message buffer.
- CanMessageBuffer::Free(buf);
- }
- else
- {
- break;
+ // Free the message buffer.
+ CanMessageBuffer::Free(buf);
+ }
+ else
+ {
+ break;
+ }
}
+ TaskBase::Take(Mutex::TimeoutUnlimited);
}
}
}
diff --git a/src/CAN/CommandProcessor.cpp b/src/CAN/CommandProcessor.cpp
index d27fa6aa..a91e8cd2 100644
--- a/src/CAN/CommandProcessor.cpp
+++ b/src/CAN/CommandProcessor.cpp
@@ -389,15 +389,15 @@ void CommandProcessor::ProcessReceivedMessage(CanMessageBuffer *buf) noexcept
{
if (buf->id.Src() != CanInterface::GetCanAddress()) // I don't think we should receive our own broadcasts, but in case we do...
{
+ if (buf->id.Dst() != CanId::BroadcastAddress)
+ {
+ reprap.GetPlatform().OnProcessingCanMessage();
+ }
+
const CanMessageType id = buf->id.MsgType();
#if SUPPORT_REMOTE_COMMANDS
if (CanInterface::InExpansionMode())
{
- if (id != CanMessageType::timeSync)
- {
- reprap.GetPlatform().OnProcessingCanMessage();
- }
-
String<StringLength500> reply;
const StringRef& replyRef = reply.GetRef();
GCodeResult rslt;
diff --git a/src/InputMonitors/InputMonitor.cpp b/src/InputMonitors/InputMonitor.cpp
index 5f797606..d449e679 100644
--- a/src/InputMonitors/InputMonitor.cpp
+++ b/src/InputMonitors/InputMonitor.cpp
@@ -39,7 +39,7 @@ bool InputMonitor::Activate(bool useInterrupt) noexcept
#if SAME5x
!useInterrupt || port.SetAnalogCallback(CommonAnalogPortInterrupt, CallbackParameter(this), 1);
#else
- true; // SAME70 doesn't support SetAnalogCallback yet
+ false; // SAME70 doesn't support SetAnalogCallback yet
#endif
}
active = true;
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp
index 98040d27..675d5d5f 100644
--- a/src/Platform/Platform.cpp
+++ b/src/Platform/Platform.cpp
@@ -2511,7 +2511,7 @@ void Platform::EnableOneLocalDriver(size_t driver, float requiredCurrent) noexce
{
SmartDrivers::EnableDrive(driver, true);
}
-# if !defined(DUET3MINI) // no enable pins on 5LC
+# if !defined(DUET3MINI) // no enable pins on 5LC
else
{
digitalWrite(ENABLE_PINS[driver], enableValues[driver] > 0);
diff --git a/src/Platform/Tasks.cpp b/src/Platform/Tasks.cpp
index 8ef89076..0f8eb0c9 100644
--- a/src/Platform/Tasks.cpp
+++ b/src/Platform/Tasks.cpp
@@ -128,7 +128,7 @@ void *Tasks::GetNVMBuffer(const uint32_t *stk) noexcept
[[noreturn]] void AppMain() noexcept
{
pinMode(DiagPin, (DiagOnPolarity) ? OUTPUT_LOW : OUTPUT_HIGH); // set up status LED for debugging and turn it off
-#ifdef DUET3MINI
+#if defined(DUET3MINI) || defined(DUET3_MB6XD)
pinMode(ActLedPin, (ActOnPolarity) ? OUTPUT_LOW : OUTPUT_HIGH); // set up activity LED and turn it off
#endif