Closed gudnimg closed 1 year ago
Slack thread with some screenshots https://prusa3d.slack.com/archives/GMV4A54R4/p1684684408818969
I have found a bug in the unit tests.
SimulateSelectorHoming()
assumes the firmware always waits for the selector to return to the parked position. This is not true. I corrected the behavior in SimulateSelectorHoming()
and now multiple tests fail, will continue investigating...
Summary
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.SimulateSelectorHoming()
calledwaitForParkedPosition
to explicitly wait for the selector to return to the parked position if set totrue
. This is very useful when setting up test cases in general and also allows us to control the behavior in each test. Note: I added commit cb3580a after writing the above. It makes things a bit more general and also now applies to the idler.ms::selector.State() == ms::selector.Ready
. Example is the Unload Filament state machine before the operation is reported finished.Details
Affected users Issue affects both 8-bit and 32-bit firmwares.
When does the issue appear to the user?
FINDA_FLICKERS
error. The MMU and Printer recover automatically with a retry so this issue is not a blocker.Why is this happening?
Consider the scenario when the MMU receives the cut filament command (during a failed toolchange). So we start by cutting the filament. Once we enter
ProgressCode::PerformingCut
the filament has been successfully cut, the homing is then invalidated and the motor settings are reset to normal. State then changes toProgressCode::ReturningSelector
and once the homing becomes valid again (the instant when the selector is at Slot 5) then the Cut filament operation is reported finished. Meanwhile the selector tries to return to the parked position in the background.The printer sees the cut filament operation is finished and sends a Toolchange command to attempt the next retry. This triggers a call to the Toolchange
Reset()
method. At this point the selector is still returning the parked position (which is the slot where the filament was cut) andfeed.Reset(true, false)
will returnfalse
since the selector is "busy" moving. This then triggers a call toGoToErrDisengagingIdler(ErrorCode::FINDA_FLICKERS)
which does not reflect reality (FINDA is working fine).To fix this behavior, the Cut Filament state machine should be similar to Unload Filament in that it shouldn't report the operation finished until the selector has returned to the parked position.
Steps to reproduce:
FINDA FLICKERS
because the selector is moving. There is no error screen since there is a successful automatic retry afterwards.The issue does not appear when using the printer's LCD because the T0 and K0 commands must be sent quickly (before Selector can park).
With MK3S+ and latest MMU FW I can reproduce this 100% of the time.
Change in memory: Flash: +16 bytes SRAM: 0 bytes