From 20a2ee7d5638a4144712e952bfae089da1b8fc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 21 May 2023 16:58:48 +0000 Subject: [PATCH] Fix false FINDA_FLICKERS on Toolchange retry Delay reporting the cut command finished until the selector has returned back to the cutting slot. This was done by adding ProgressCode::Homing to the Cut Filament state machine. ProgressCode::ReturningSelector is then used to wait for the selector to return back to the cut slot after homing becomes valid again. Only then is the cut operation reported finished and a new command can be processed e.g. Toolchange. Change in memory: Flash: +16 bytes SRAM: 0 bytes --- src/logic/cut_filament.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/logic/cut_filament.cpp b/src/logic/cut_filament.cpp index 1cdd853..cda1e35 100644 --- a/src/logic/cut_filament.cpp +++ b/src/logic/cut_filament.cpp @@ -117,7 +117,7 @@ bool CutFilament::StepInner() { break; case ProgressCode::PerformingCut: if (ms::selector.Slot() == cutSlot) { // this may not be necessary if we want the selector and pulley move at once - state = ProgressCode::ReturningSelector; + state = ProgressCode::Homing; // revert current to Selector's normal value mm::motion.InitAxis(mm::Selector, mm::MotorCurrents(config::selector.iRun, config::selector.iHold)); // revert move speed @@ -126,8 +126,13 @@ bool CutFilament::StepInner() { mpu::pulley.PlanMove(-config::cuttingEdgeRetract, config::pulleySlowFeedrate); } break; + case ProgressCode::Homing: + if (ms::selector.HomingValid()) { + state = ProgressCode::ReturningSelector; + } + break; case ProgressCode::ReturningSelector: - if (ms::selector.HomingValid()) { // selector rehomed + if (ms::selector.State() == ms::selector.Ready) { FinishedOK(); ml::leds.SetPairButOffOthers(mg::globals.ActiveSlot(), ml::on, ml::off); }