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 feed_to_finda.cpp
home.cpp home.cpp
load_filament.cpp load_filament.cpp
move_selector.cpp
no_command.cpp no_command.cpp
retract_from_finda.cpp retract_from_finda.cpp
set_mode.cpp set_mode.cpp

View File

@ -71,7 +71,8 @@ bool FeedToFinda::Step() {
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector); mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
dbg_logic_P(PSTR("Feed to Finda --> Idler disengaged")); dbg_logic_P(PSTR("Feed to Finda --> Idler disengaged"));
dbg_logic_fP(PSTR("Pulley end steps %u"), mpu::pulley.CurrentPositionPulley_mm()); 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) 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) { } else if (mm::motion.PlannedMoves(mm::Pulley) < 2) {
// plan another move to make the illusion of unlimited moves // plan another move to make the illusion of unlimited moves

View File

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

View File

@ -58,12 +58,19 @@ bool LoadFilament::StepInner() {
switch (state) { switch (state) {
case ProgressCode::FeedingToFinda: case ProgressCode::FeedingToFinda:
if (feed.Step()) { if (feed.Step()) {
if (feed.State() == FeedToFinda::Failed) { switch (feed.State()) {
// @@TODO - try to repeat 6x - push/pull sequence - probably something to put into feed_to_finda as an option 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 GoToErrDisengagingIdler(ErrorCode::FINDA_DIDNT_SWITCH_ON); // signal loading error
} else { break;
case FeedToFinda::OK:
state = ProgressCode::RetractingFromFinda; state = ProgressCode::RetractingFromFinda;
retract.Reset(); 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; break;