Make LoadFilament terminate completely OK when button pressed

pull/165/head
D.R.racer 2022-05-05 08:24:29 +02:00 committed by DRracer
parent 8ce029a28c
commit bd95807b23
4 changed files with 15 additions and 5 deletions

View File

@ -7,6 +7,7 @@ target_sources(
feed_to_finda.cpp
home.cpp
load_filament.cpp
move_selector.cpp
no_command.cpp
retract_from_finda.cpp
set_mode.cpp

View File

@ -71,7 +71,8 @@ bool FeedToFinda::Step() {
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
dbg_logic_P(PSTR("Feed to Finda --> Idler disengaged"));
dbg_logic_fP(PSTR("Pulley end steps %u"), mpu::pulley.CurrentPositionPulley_mm());
state = OK;
state = mui::userInput.AnyEvent() ? Stopped : OK;
mui::userInput.Clear();
return true; // return immediately to allow for a seamless planning of another move (like feeding to bondtech)
} else if (mm::motion.PlannedMoves(mm::Pulley) < 2) {
// plan another move to make the illusion of unlimited moves

View File

@ -19,7 +19,8 @@ struct FeedToFinda {
UnloadBackToPTFE,
DisengagingIdler,
OK,
Failed
Failed,
Stopped
};
inline FeedToFinda()

View File

@ -58,12 +58,19 @@ bool LoadFilament::StepInner() {
switch (state) {
case ProgressCode::FeedingToFinda:
if (feed.Step()) {
if (feed.State() == FeedToFinda::Failed) {
// @@TODO - try to repeat 6x - push/pull sequence - probably something to put into feed_to_finda as an option
switch (feed.State()) {
case FeedToFinda::Failed: // @@TODO - try to repeat 6x - push/pull sequence - probably something to put into feed_to_finda as an option
GoToErrDisengagingIdler(ErrorCode::FINDA_DIDNT_SWITCH_ON); // signal loading error
} else {
break;
case FeedToFinda::OK:
state = ProgressCode::RetractingFromFinda;
retract.Reset();
break;
case FeedToFinda::Stopped:
// the user stopped the load for whatever reason
// - we are considering the LoadFlament operation as completed
state = ProgressCode::OK;
break;
}
}
break;