diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-07-04 19:37:20 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-07-04 19:37:20 +0300 |
commit | 243be4d5d2895dd650a0eab55d9932b5b60291bb (patch) | |
tree | c541b07ec4e5075f262911846db2032960b447d3 | |
parent | e00b988031ccea7cc58a847d5368c185706ca2dd (diff) |
Don't raise driver error events on 6XD when in test mode
-rw-r--r-- | src/CAN/CanInterface.cpp | 9 | ||||
-rw-r--r-- | src/CAN/CanInterface.h | 3 | ||||
-rw-r--r-- | src/CAN/CommandProcessor.cpp | 2 | ||||
-rw-r--r-- | src/GCodes/GCodes2.cpp | 2 | ||||
-rw-r--r-- | src/Platform/Platform.cpp | 3 |
5 files changed, 14 insertions, 5 deletions
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp index a44d757d..b7827e4d 100644 --- a/src/CAN/CanInterface.cpp +++ b/src/CAN/CanInterface.cpp @@ -99,6 +99,7 @@ static uint8_t currentTimeSyncMarker = 0xFF; #if SUPPORT_REMOTE_COMMANDS static bool inExpansionMode = false; +static bool inTestMode = false; static bool mainBoardAcknowledgedAnnounce = false; #endif @@ -311,6 +312,11 @@ bool CanInterface::InExpansionMode() noexcept return inExpansionMode; } +bool CanInterface::InTestMode() noexcept +{ + return inTestMode; +} + static void ReInit() noexcept { can0dev->Disable(); @@ -318,12 +324,13 @@ static void ReInit() noexcept can0dev->Enable(); } -void CanInterface::SwitchToExpansionMode(CanAddress addr) noexcept +void CanInterface::SwitchToExpansionMode(CanAddress addr, bool useTestMode) noexcept { TaskCriticalSectionLocker lock; myAddress = addr; inExpansionMode = true; + inTestMode = useTestMode; reprap.GetGCodes().SwitchToExpansionMode(); ReInit(); // reset the CAN filters to account for our new CAN address } diff --git a/src/CAN/CanInterface.h b/src/CAN/CanInterface.h index a1c320ac..ef322205 100644 --- a/src/CAN/CanInterface.h +++ b/src/CAN/CanInterface.h @@ -34,7 +34,8 @@ namespace CanInterface #if SUPPORT_REMOTE_COMMANDS bool InExpansionMode() noexcept; - void SwitchToExpansionMode(CanAddress addr) noexcept; + bool InTestMode() noexcept; + void SwitchToExpansionMode(CanAddress addr, bool useTestMode) noexcept; void SendAnnounce(CanMessageBuffer *buf) noexcept; void RaiseEvent(EventType type, uint16_t param, uint8_t device, const char *format, va_list vargs) noexcept; diff --git a/src/CAN/CommandProcessor.cpp b/src/CAN/CommandProcessor.cpp index 90e04e93..d27fa6aa 100644 --- a/src/CAN/CommandProcessor.cpp +++ b/src/CAN/CommandProcessor.cpp @@ -694,7 +694,7 @@ void CommandProcessor::ProcessReceivedMessage(CanMessageBuffer *buf) noexcept CanInterface::SendResponseNoFree(buf); delay(25); // allow time for the response to be sent before we re-initialise CAN - CanInterface::SwitchToExpansionMode(newAddress); + CanInterface::SwitchToExpansionMode(newAddress, true); } break; #endif diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index 491e8b74..31444d61 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -4518,7 +4518,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx case 954: // configure as expansion board { CanAddress addr = gb.GetLimitedUIValue('A', 1, CanId::MaxCanAddress + 1); - CanInterface::SwitchToExpansionMode(addr); + CanInterface::SwitchToExpansionMode(addr, false); } break; #endif diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 54fd7916..c9bb41c7 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -1094,7 +1094,8 @@ void Platform::Spin() noexcept { StandardDriverStatus stat = #if defined(DUET3_MB6XD) - StandardDriverStatus((HasDriverError(nextDriveToPoll)) ? (uint32_t)1u << StandardDriverStatus::ExternDriverErrorBitPos : 0); + // Don't raise driver error events while we are being tested by ATE + StandardDriverStatus((!CanInterface::InTestMode() && HasDriverError(nextDriveToPoll)) ? (uint32_t)1u << StandardDriverStatus::ExternDriverErrorBitPos : 0); #else SmartDrivers::GetStatus(nextDriveToPoll, true, true); #endif |