Move extruder when loading filament to fsensor

When the fsensor see filament, stop the extruder
This commit is contained in:
Guðni Már Gilbert 2022-04-30 13:42:30 +00:00 committed by D.R.racer
parent 96540d6e2d
commit b59c9da9ee
1 changed files with 25 additions and 6 deletions

View File

@ -660,6 +660,9 @@ void MMU2::OnMMUProgressMsg(ProgressCode pc){
st_synchronize(); st_synchronize();
loadFilamentStarted = true; loadFilamentStarted = true;
break; break;
case ProgressCode::FeedingToNozzle:
// Nothing yet
break;
default: default:
// do nothing yet // do nothing yet
break; break;
@ -668,14 +671,30 @@ void MMU2::OnMMUProgressMsg(ProgressCode pc){
// Act accordingly - every status change (even the same state) // Act accordingly - every status change (even the same state)
switch(pc){ switch(pc){
case ProgressCode::FeedingToBondtech: case ProgressCode::FeedingToBondtech:
if( WhereIsFilament() == FilamentState::AT_FSENSOR && loadFilamentStarted){// fsensor triggered, move the extruder to help loading if ( loadFilamentStarted )
// rotate the extruder motor - no planner sync, just add more moves - as long as they are roughly at the same speed as the MMU is pushing, {
// it really doesn't matter switch ( WhereIsFilament() )
current_position[E_AXIS] += (loadingToNozzle ? MMU2_LOAD_TO_NOZZLE_LENGTH : MMU2_TOOL_CHANGE_LOAD_LENGTH) / extruder_multiplier[0]; {
plan_buffer_line_curposXYZE(MMU2_LOAD_TO_NOZZLE_FEED_RATE); case FilamentState::AT_FSENSOR:
loadFilamentStarted = false; // fsensor triggered, stop moving the extruder
loadFilamentStarted = false;
// TODO: continue to ProgressCode::FeedingToNozzle?
break;
case FilamentState::NOT_PRESENT:
// fsensor not triggered, continue moving extruder
// TODO: Verify what's the best speed here?
current_position[E_AXIS] += MMU2_LOAD_TO_NOZZLE_FEED_RATE;
plan_buffer_line_curposXYZE(MMU2_LOAD_TO_NOZZLE_FEED_RATE);
st_synchronize(); // Wait for the steps to be done, otherwise the moves will just add up
default:
// Abort here?
break;
}
} }
break; break;
case ProgressCode::FeedingToNozzle:
// Nothing yet
break;
default: default:
// do nothing yet // do nothing yet
break; break;