@@ -39,7 +39,9 @@ static constexpr float MMU2_LOAD_TO_NOZZLE_LENGTH = 87.0F + 5.0F;
39
39
// - ToolChange shall not try to push filament into the very tip of the nozzle
40
40
// to have some space for additional G-code to tune the extruded filament length
41
41
// in the profile
42
- // Beware - this value is sent to the MMU upon line up, it is written into its 8bit register 0x0b
42
+ // Beware - this value is used to initialize the MMU logic layer - it will be sent to the MMU upon line up (written into its 8bit register 0x0b)
43
+ // However - in the G-code we can get a request to set the extra load distance at runtime to something else (M708 A0xb Xsomething).
44
+ // The printer intercepts such a call and sets its extra load distance to match the new value as well.
43
45
static constexpr uint8_t MMU2_TOOL_CHANGE_LOAD_LENGTH = 5 ; // mm
44
46
45
47
static constexpr float MMU2_LOAD_TO_NOZZLE_FEED_RATE = 20 .0F ; // mm/s
@@ -198,6 +200,12 @@ bool MMU2::ReadRegister(uint8_t address){
198
200
bool MMU2::WriteRegister (uint8_t address, uint16_t data){
199
201
if ( ! WaitForMMUReady ())
200
202
return false ;
203
+
204
+ // special case - intercept requests of extra loading distance and perform the change even on the printer's side
205
+ if ( address == 0x0b ){
206
+ logic.PlanExtraLoadDistance (data);
207
+ }
208
+
201
209
logic.WriteRegister (address, data); // we may signal the accepted/rejected status of the response as return value of this function
202
210
manage_response (false , false );
203
211
return true ;
@@ -907,8 +915,8 @@ void MMU2::OnMMUProgressMsgSame(ProgressCode pc){
907
915
loadFilamentStarted = false ;
908
916
// After the MMU knows the FSENSOR is triggered it will:
909
917
// 1. Push the filament by additional 30mm (see fsensorToNozzle)
910
- // 2. Disengage the idler and push another 5mm .
911
- current_position[E_AXIS] += MMU2_TOOL_CHANGE_LOAD_LENGTH + 2 . 0f ;
918
+ // 2. Disengage the idler and push another 2mm .
919
+ current_position[E_AXIS] += logic. ExtraLoadDistance () + 2 ;
912
920
plan_buffer_line_curposXYZE (MMU2_LOAD_TO_NOZZLE_FEED_RATE);
913
921
break ;
914
922
case FilamentState::NOT_PRESENT:
0 commit comments