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
pull/282/head
Guðni Már Gilbert 2023-05-21 16:58:48 +00:00 committed by DRracer
parent 8c873c8a53
commit 20a2ee7d56
1 changed files with 7 additions and 2 deletions

View File

@ -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);
}