Improve restart ToolChange -> FeedToFINDA
It looks like we don't have to reset the whole ToolChange state machine when resolving an error with the middle button (Retry) - but jump straight into the feeding phase. The reasons are multiple: - If an error happens during the unload phase, it is handled separately in the UnloadFilament state machine - If an error happens during the feeding phase, the unload has been already successfully completed. And when restarted from the very beginning, the ToolChange does the last retract sequence from the UnloadFilament phase -> that is not healthy, because the filament gets pushed away from the Pulley and causes another error.pull/188/head
parent
f70c3ed5ec
commit
a01ff57ea3
|
|
@ -63,6 +63,13 @@ void logic::ToolChange::ToolChangeFinishedCorrectly() {
|
||||||
FinishedOK();
|
FinishedOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void logic::ToolChange::GoToFeedingToFinda() {
|
||||||
|
state = ProgressCode::FeedingToFinda;
|
||||||
|
error = ErrorCode::RUNNING;
|
||||||
|
mg::globals.SetFilamentLoaded(plannedSlot, mg::FilamentLoadState::AtPulley);
|
||||||
|
feed.Reset(true, false);
|
||||||
|
}
|
||||||
|
|
||||||
bool ToolChange::StepInner() {
|
bool ToolChange::StepInner() {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case ProgressCode::UnloadingFilament:
|
case ProgressCode::UnloadingFilament:
|
||||||
|
|
@ -70,10 +77,7 @@ bool ToolChange::StepInner() {
|
||||||
// unloading sequence finished - basically, no errors can occurr here
|
// unloading sequence finished - basically, no errors can occurr here
|
||||||
// as UnloadFilament should handle all the possible error states on its own
|
// as UnloadFilament should handle all the possible error states on its own
|
||||||
// There is no way the UnloadFilament to finish in an error state
|
// There is no way the UnloadFilament to finish in an error state
|
||||||
state = ProgressCode::FeedingToFinda;
|
GoToFeedingToFinda();
|
||||||
error = ErrorCode::RUNNING;
|
|
||||||
mg::globals.SetFilamentLoaded(plannedSlot, mg::FilamentLoadState::AtPulley);
|
|
||||||
feed.Reset(true, false);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ProgressCode::FeedingToFinda:
|
case ProgressCode::FeedingToFinda:
|
||||||
|
|
@ -113,7 +117,14 @@ bool ToolChange::StepInner() {
|
||||||
GoToErrEngagingIdler();
|
GoToErrEngagingIdler();
|
||||||
break;
|
break;
|
||||||
case mui::Event::Middle: // try again the whole sequence
|
case mui::Event::Middle: // try again the whole sequence
|
||||||
Reset(mg::globals.ActiveSlot());
|
// It looks like we don't have to reset the whole state machine but jump straight into the feeding phase.
|
||||||
|
// The reasons are multiple:
|
||||||
|
// - If an error happens during the unload phase, it is handled separately in the UnloadFilament state machine
|
||||||
|
// - If an error happens during the feeding phase, the unload has been already successfully completed.
|
||||||
|
// And when restarted from the very beginning, the ToolChange does the last retract sequence from the UnloadFilament phase
|
||||||
|
// -> that is not healthy, because the filament gets pushed away from the Pulley and causes another error.
|
||||||
|
//Reset(mg::globals.ActiveSlot());
|
||||||
|
GoToFeedingToFinda();
|
||||||
break;
|
break;
|
||||||
case mui::Event::Right: // problem resolved - the user pushed the fillament by hand?
|
case mui::Event::Right: // problem resolved - the user pushed the fillament by hand?
|
||||||
// we should check the state of all the sensors and either report another error or confirm the correct state
|
// we should check the state of all the sensors and either report another error or confirm the correct state
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ public:
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
void GoToFeedingToBondtech();
|
void GoToFeedingToBondtech();
|
||||||
|
void GoToFeedingToFinda();
|
||||||
|
|
||||||
/// Common code for a correct completion of UnloadFilament
|
/// Common code for a correct completion of UnloadFilament
|
||||||
void ToolChangeFinishedCorrectly();
|
void ToolChangeFinishedCorrectly();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue