Fix issue that all tool changes after first one fail to change to planned slot

Update Filament Load state
pull/126/head
3d-gussner 2021-09-30 18:20:02 +02:00 committed by DRracer
parent 33b467f1bc
commit 221f40c7a1
1 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ void ToolChange::Reset(uint8_t param) {
return; return;
} }
if (param == mg::globals.ActiveSlot() && mg::globals.FilamentLoaded() == mg::FilamentLoadState::InNozzle) { if (param == mg::globals.ActiveSlot() && (mg::globals.FilamentLoaded() >= mg::FilamentLoadState::InSelector)) {
// we are already at the correct slot and the filament is loaded - nothing to do // we are already at the correct slot and the filament is loaded - nothing to do
dbg_logic_P(PSTR("we are already at the correct slot and the filament is loaded - nothing to do\n")); dbg_logic_P(PSTR("we are already at the correct slot and the filament is loaded - nothing to do\n"));
return; return;
@ -51,6 +51,7 @@ bool ToolChange::StepInner() {
// 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; state = ProgressCode::FeedingToFinda;
error = ErrorCode::RUNNING; error = ErrorCode::RUNNING;
mg::globals.SetActiveSlot(plannedSlot);
feed.Reset(true); feed.Reset(true);
} }
break; break;
@ -77,7 +78,7 @@ bool ToolChange::StepInner() {
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::off); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::off);
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::red, ml::blink0); // signal loading error ml::leds.SetMode(mg::globals.ActiveSlot(), ml::red, ml::blink0); // signal loading error
} else { } else {
mg::globals.SetFilamentLoaded(mg::FilamentLoadState::InNozzle); mg::globals.SetFilamentLoaded(mg::FilamentLoadState::InFSensor);
state = ProgressCode::OK; state = ProgressCode::OK;
error = ErrorCode::OK; error = ErrorCode::OK;
} }