@@ -23,8 +23,6 @@ static_assert(EXTRUDERS==1);
23
23
24
24
namespace MMU2 {
25
25
26
- void execute_extruder_sequence (const E_Step *sequence, int steps);
27
-
28
26
template <typename F>
29
27
void waitForHotendTargetTemp (uint16_t delay, F f){
30
28
while (((degTargetHotend (active_extruder) - degHotend (active_extruder)) > 5 )) {
@@ -251,9 +249,9 @@ bool MMU2::VerifyFilamentEnteredPTFE()
251
249
uint8_t fsensorState = 0 ;
252
250
// MMU has finished its load, push the filament further by some defined constant length
253
251
// If the filament sensor reads 0 at any moment, then report FAILURE
254
- current_position[E_AXIS] += MMU2_EXTRUDER_PTFE_LENGTH + MMU2_EXTRUDER_HEATBREAK_LENGTH - logic.ExtraLoadDistance ();
252
+ current_position[E_AXIS] += MMU2_EXTRUDER_PTFE_LENGTH + MMU2_EXTRUDER_HEATBREAK_LENGTH - ( logic.ExtraLoadDistance () - MMU2_FILAMENT_SENSOR_POSITION );
255
253
plan_buffer_line_curposXYZE (MMU2_LOAD_TO_NOZZLE_FEED_RATE);
256
- current_position[E_AXIS] -= (MMU2_EXTRUDER_PTFE_LENGTH + MMU2_EXTRUDER_HEATBREAK_LENGTH - logic.ExtraLoadDistance ());
254
+ current_position[E_AXIS] -= (MMU2_EXTRUDER_PTFE_LENGTH + MMU2_EXTRUDER_HEATBREAK_LENGTH - ( logic.ExtraLoadDistance () - MMU2_FILAMENT_SENSOR_POSITION ));
257
255
plan_buffer_line_curposXYZE (MMU2_LOAD_TO_NOZZLE_FEED_RATE);
258
256
259
257
while (blocks_queued ())
@@ -357,7 +355,7 @@ bool MMU2::tool_change(char code, uint8_t slot) {
357
355
358
356
case ' c' : {
359
357
waitForHotendTargetTemp (100 , []{});
360
- execute_extruder_sequence (( const E_Step *)load_to_nozzle_sequence, sizeof (load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[ 0 ]) );
358
+ execute_load_to_nozzle_sequence ( );
361
359
} break ;
362
360
}
363
361
@@ -508,7 +506,7 @@ bool MMU2::load_filament_to_nozzle(uint8_t slot) {
508
506
ToolChangeCommon (slot);
509
507
510
508
// Finish loading to the nozzle with finely tuned steps.
511
- execute_extruder_sequence (( const E_Step *)load_to_nozzle_sequence, sizeof (load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[ 0 ]) );
509
+ execute_load_to_nozzle_sequence ( );
512
510
Sound_MakeSound (e_SOUND_TYPE_StandardConfirm);
513
511
}
514
512
lcd_update_enable (true );
@@ -839,6 +837,13 @@ void MMU2::execute_extruder_sequence(const E_Step *sequence, uint8_t steps) {
839
837
}
840
838
}
841
839
840
+ void MMU2::execute_load_to_nozzle_sequence () {
841
+ st_synchronize ();
842
+ // Compensate for configurable Extra Loading Distance
843
+ current_position[E_AXIS] -= (logic.ExtraLoadDistance () - MMU2_FILAMENT_SENSOR_POSITION);
844
+ execute_extruder_sequence ((const E_Step *)load_to_nozzle_sequence, sizeof (load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0 ]));
845
+ }
846
+
842
847
void MMU2::ReportError (ErrorCode ec, ErrorSource res) {
843
848
// Due to a potential lossy error reporting layers linked to this hook
844
849
// we'd better report everything to make sure especially the error states
0 commit comments