diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index 2e3f94564..7e3a16370 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -141,9 +141,16 @@ bool MMU2::WriteRegister(uint8_t address, uint16_t data) { if (!WaitForMMUReady()) return false; - // special case - intercept requests of extra loading distance and perform the change even on the printer's side - if (address == 0x0b) { + // special cases - intercept requests of registers which influence the printer's behaviour too + perform the change even on the printer's side + switch (address) { + case 0x0b: logic.PlanExtraLoadDistance(data); + break; + case 0x14: + logic.PlanPulleySlowFeedRate(data); + break; + default: + break; // do not intercept any other register writes } do { @@ -1040,7 +1047,7 @@ void MMU2::OnMMUProgressMsgSame(ProgressCode pc) { // After the MMU knows the FSENSOR is triggered it will: // 1. Push the filament by additional 30mm (see fsensorToNozzle) // 2. Disengage the idler and push another 2mm. - MoveE(logic.ExtraLoadDistance() + 2, MMU2_LOAD_TO_NOZZLE_FEED_RATE); + MoveE(logic.ExtraLoadDistance() + 2, logic.PulleySlowFeedRate()); break; case FilamentState::NOT_PRESENT: // fsensor not triggered, continue moving extruder @@ -1050,7 +1057,7 @@ void MMU2::OnMMUProgressMsgSame(ProgressCode pc) { // than 450mm because the firmware will ignore too long extrusions // for safety reasons. See PREVENT_LENGTHY_EXTRUDE. // Use 350mm to be safely away from the prevention threshold - MoveE(350.0f, MMU2_LOAD_TO_NOZZLE_FEED_RATE); + MoveE(350.0f, logic.PulleySlowFeedRate()); } break; default: diff --git a/Firmware/mmu2_protocol_logic.h b/Firmware/mmu2_protocol_logic.h index 53ec0002a..1a13bbe66 100644 --- a/Firmware/mmu2_protocol_logic.h +++ b/Firmware/mmu2_protocol_logic.h @@ -122,6 +122,17 @@ public: return initRegs8[0]; } + /// Sets the Pulley slow feed rate to be reported to the MMU. + /// Beware - this call doesn't send anything to the MMU. + /// The MMU gets the newly set value either by a communication restart or via an explicit WriteRegister call + inline void PlanPulleySlowFeedRate(uint8_t psfr) { + initRegs8[1] = psfr; + } + /// @returns the currently preset Pulley slow feed rate + inline uint8_t PulleySlowFeedRate() const { + return initRegs8[1]; // even though MMU register 0x14 is 16bit, reasonable speeds are way below 255mm/s - saving space ;) + } + /// Step the state machine StepStatus Step();