PFW-1528 Intercept register 0x14
This commit syncs the 8-bit firmware with the 32-bit Change in memory: Flash: +56 bytes SRAM: 0 bytes
This commit is contained in:
parent
079e4c9112
commit
ef4efc22c3
|
|
@ -141,9 +141,16 @@ bool MMU2::WriteRegister(uint8_t address, uint16_t data) {
|
||||||
if (!WaitForMMUReady())
|
if (!WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// special case - intercept requests of extra loading distance and perform the change even on the printer's side
|
// special cases - intercept requests of registers which influence the printer's behaviour too + perform the change even on the printer's side
|
||||||
if (address == 0x0b) {
|
switch (address) {
|
||||||
|
case 0x0b:
|
||||||
logic.PlanExtraLoadDistance(data);
|
logic.PlanExtraLoadDistance(data);
|
||||||
|
break;
|
||||||
|
case 0x14:
|
||||||
|
logic.PlanPulleySlowFeedRate(data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break; // do not intercept any other register writes
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
@ -1040,7 +1047,7 @@ void MMU2::OnMMUProgressMsgSame(ProgressCode pc) {
|
||||||
// After the MMU knows the FSENSOR is triggered it will:
|
// After the MMU knows the FSENSOR is triggered it will:
|
||||||
// 1. Push the filament by additional 30mm (see fsensorToNozzle)
|
// 1. Push the filament by additional 30mm (see fsensorToNozzle)
|
||||||
// 2. Disengage the idler and push another 2mm.
|
// 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;
|
break;
|
||||||
case FilamentState::NOT_PRESENT:
|
case FilamentState::NOT_PRESENT:
|
||||||
// fsensor not triggered, continue moving extruder
|
// 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
|
// than 450mm because the firmware will ignore too long extrusions
|
||||||
// for safety reasons. See PREVENT_LENGTHY_EXTRUDE.
|
// for safety reasons. See PREVENT_LENGTHY_EXTRUDE.
|
||||||
// Use 350mm to be safely away from the prevention threshold
|
// 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;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,17 @@ public:
|
||||||
return initRegs8[0];
|
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
|
/// Step the state machine
|
||||||
StepStatus Step();
|
StepStatus Step();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue