From 2908f2b6678e8948d89c5f12a67fa7be648ab403 Mon Sep 17 00:00:00 2001 From: David Crocker Date: Wed, 13 Nov 2024 18:35:44 +0000 Subject: [PATCH] Support extrusion heater feedforward even if IOBITS not enabled --- src/Movement/DDARing.cpp | 13 ++++++++----- src/Movement/DDARing.h | 2 -- src/Movement/Move.cpp | 8 +++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Movement/DDARing.cpp b/src/Movement/DDARing.cpp index 8f8eb5b93..f1daa9d14 100644 --- a/src/Movement/DDARing.cpp +++ b/src/Movement/DDARing.cpp @@ -720,13 +720,13 @@ uint32_t DDARing::ManageLaserPower() noexcept #endif -#if SUPPORT_IOBITS - // Manage the IOBITS (G1 P parameter) and extruder heater feedforward. Called by the Laser task. uint32_t DDARing::ManageIOBitsAndFeedForward() noexcept { +#if SUPPORT_IOBITS PortControl& pc = reprap.GetPortControl(); bool doneIoBits = !pc.IsConfigured(); +#endif bool doneFeedForward = false; bool setFeedForward = false; uint32_t nextWakeupDelay = StepClockRate; @@ -741,6 +741,7 @@ uint32_t DDARing::ManageIOBitsAndFeedForward() noexcept { const int32_t timeToMoveStart = (int32_t)(cdda->GetMoveStartTime() - now); // get the time to the start of the move, negative if the move has started const int32_t timeToMoveEnd = timeToMoveStart + (int32_t)cdda->GetClocksNeeded(); // get the time to the move ended, negative if the move has ended +#if SUPPORT_IOBITS if (!doneIoBits && timeToMoveStart < (int32_t)pc.GetAdvanceClocks() && timeToMoveEnd > (int32_t)pc.GetAdvanceClocks()) { // This move is current from the perspective of IOBits @@ -756,8 +757,8 @@ uint32_t DDARing::ManageIOBitsAndFeedForward() noexcept break; } } - if (!doneFeedForward) +#endif { feedForwardTool = cdda->GetTool(); if (feedForwardTool != nullptr && timeToMoveStart < (int32_t)feedForwardTool->GetFeedForwardAdvanceClocks() && timeToMoveEnd > (int32_t)feedForwardTool->GetFeedForwardAdvanceClocks()) @@ -772,7 +773,9 @@ uint32_t DDARing::ManageIOBitsAndFeedForward() noexcept } nextWakeupDelay = min(nextWakeupDelay, (uint32_t)timeToMoveEnd > feedForwardTool->GetFeedForwardAdvanceClocks()); doneFeedForward = true; +#if SUPPORT_IOBITS if (doneIoBits) +#endif { break; } @@ -781,10 +784,12 @@ uint32_t DDARing::ManageIOBitsAndFeedForward() noexcept cdda = cdda->GetNext(); } +#if SUPPORT_IOBITS if (!doneIoBits) { pc.UpdatePorts(0); // no move active so turn off all IOBITS ports } +#endif SetBasePriority(0); @@ -807,8 +812,6 @@ uint32_t DDARing::ManageIOBitsAndFeedForward() noexcept return (nextWakeupDelay + StepClockRate/1000 - 1)/(StepClockRate/1000); // convert step clocks to milliseconds, rounding up } -#endif - #if SUPPORT_REMOTE_COMMANDS // Add a move from the ATE to the movement queue diff --git a/src/Movement/DDARing.h b/src/Movement/DDARing.h index dc4bdb4b4..8f446070e 100644 --- a/src/Movement/DDARing.h +++ b/src/Movement/DDARing.h @@ -66,9 +66,7 @@ class DDARing INHERIT_OBJECT_MODEL #if SUPPORT_LASER uint32_t ManageLaserPower() noexcept; // Manage the laser power #endif -#if SUPPORT_IOBITS uint32_t ManageIOBitsAndFeedForward() noexcept; // Manage the IOBITS (G1 P parameter) and extruder heater feedforward -#endif void RecordLookaheadError() noexcept { ++numLookaheadErrors; } // Record a lookahead error void Diagnostics(MessageType mtype, unsigned int ringNumber) noexcept; diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp index d65f66f9d..0623b9267 100644 --- a/src/Movement/Move.cpp +++ b/src/Movement/Move.cpp @@ -1549,7 +1549,7 @@ void Move::LaserTaskRun() noexcept else #endif -# if SUPPORT_LASER +#if SUPPORT_LASER if (gcodes.GetMachineType() == MachineType::laser) { // Manage the laser power @@ -1560,16 +1560,14 @@ void Move::LaserTaskRun() noexcept } } else -# endif +#endif { -# if SUPPORT_IOBITS - // Manage the IOBits + // Manage the feedforward and IOBits uint32_t ticks; while ((ticks = rings[0].ManageIOBitsAndFeedForward()) != 0) { (void)TaskBase::TakeIndexed(NotifyIndices::Laser, ticks); } -# endif } } }