MMU: add UnloadInner and CutFilamentInner
Sync with the 32-bit side. The ReportingRAII does not handle recursion. Fixes an issue with the multiple calls to BeginReport() and EndReport() Change in memory: Flash: +14 bytes SRAM: 0 bytes
This commit is contained in:
parent
9d5453a41e
commit
1f9fc4ef3f
|
|
@ -324,7 +324,7 @@ bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
|
||||||
// if the extruder has been parked, it will get unparked once the ToolChange command finishes OK
|
// if the extruder has been parked, it will get unparked once the ToolChange command finishes OK
|
||||||
// - so no ResumeUnpark() at this spot
|
// - so no ResumeUnpark() at this spot
|
||||||
|
|
||||||
unload();
|
UnloadInner();
|
||||||
// if we run out of retries, we must do something ... may be raise an error screen and allow the user to do something
|
// if we run out of retries, we must do something ... may be raise an error screen and allow the user to do something
|
||||||
// but honestly - if the MMU restarts during every toolchange,
|
// but honestly - if the MMU restarts during every toolchange,
|
||||||
// something else is seriously broken and stopping a print is probably our best option.
|
// something else is seriously broken and stopping a print is probably our best option.
|
||||||
|
|
@ -334,9 +334,9 @@ bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
|
||||||
if (VerifyFilamentEnteredPTFE()) {
|
if (VerifyFilamentEnteredPTFE()) {
|
||||||
return true; // success
|
return true; // success
|
||||||
} else { // Prepare a retry attempt
|
} else { // Prepare a retry attempt
|
||||||
unload();
|
UnloadInner();
|
||||||
if (retries == 2 && cutter_enabled()) {
|
if (retries == 2 && cutter_enabled()) {
|
||||||
cut_filament(slot, false); // try cutting filament tip at the last attempt
|
CutFilamentInner(slot); // try cutting filament tip at the last attempt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -444,35 +444,48 @@ bool MMU2::set_filament_type(uint8_t /*slot*/, uint8_t /*type*/) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MMU2::UnloadInner() {
|
||||||
|
FSensorBlockRunout blockRunout;
|
||||||
|
filament_ramming();
|
||||||
|
|
||||||
|
// we assume the printer managed to relieve filament tip from the gears,
|
||||||
|
// so repeating that part in case of an MMU restart is not necessary
|
||||||
|
for (;;) {
|
||||||
|
Disable_E0();
|
||||||
|
logic.UnloadFilament();
|
||||||
|
if (manage_response(false, true))
|
||||||
|
break;
|
||||||
|
IncrementMMUFails();
|
||||||
|
}
|
||||||
|
MakeSound(Confirm);
|
||||||
|
|
||||||
|
// no active tool
|
||||||
|
extruder = MMU2_NO_TOOL;
|
||||||
|
tool_change_extruder = MMU2_NO_TOOL;
|
||||||
|
}
|
||||||
|
|
||||||
bool MMU2::unload() {
|
bool MMU2::unload() {
|
||||||
if (!WaitForMMUReady())
|
if (!WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
WaitForHotendTargetTempBeep();
|
WaitForHotendTargetTempBeep();
|
||||||
|
|
||||||
{
|
ReportingRAII rep(CommandInProgress::UnloadFilament);
|
||||||
FSensorBlockRunout blockRunout;
|
UnloadInner();
|
||||||
ReportingRAII rep(CommandInProgress::UnloadFilament);
|
|
||||||
filament_ramming();
|
|
||||||
|
|
||||||
// we assume the printer managed to relieve filament tip from the gears,
|
|
||||||
// so repeating that part in case of an MMU restart is not necessary
|
|
||||||
for (;;) {
|
|
||||||
Disable_E0();
|
|
||||||
logic.UnloadFilament();
|
|
||||||
if (manage_response(false, true))
|
|
||||||
break;
|
|
||||||
IncrementMMUFails();
|
|
||||||
}
|
|
||||||
MakeSound(Confirm);
|
|
||||||
|
|
||||||
// no active tool
|
|
||||||
extruder = MMU2_NO_TOOL;
|
|
||||||
tool_change_extruder = MMU2_NO_TOOL;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MMU2::CutFilamentInner(uint8_t slot) {
|
||||||
|
for (;;) {
|
||||||
|
Disable_E0();
|
||||||
|
logic.CutFilament(slot);
|
||||||
|
if (manage_response(false, true))
|
||||||
|
break;
|
||||||
|
IncrementMMUFails();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MMU2::cut_filament(uint8_t slot, bool enableFullScreenMsg /*= true*/) {
|
bool MMU2::cut_filament(uint8_t slot, bool enableFullScreenMsg /*= true*/) {
|
||||||
if (!WaitForMMUReady())
|
if (!WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -486,13 +499,7 @@ bool MMU2::cut_filament(uint8_t slot, bool enableFullScreenMsg /*= true*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportingRAII rep(CommandInProgress::CutFilament);
|
ReportingRAII rep(CommandInProgress::CutFilament);
|
||||||
for (;;) {
|
CutFilamentInner(slot);
|
||||||
Disable_E0();
|
|
||||||
logic.CutFilament(slot);
|
|
||||||
if (manage_response(false, true))
|
|
||||||
break;
|
|
||||||
IncrementMMUFails();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
extruder = MMU2_NO_TOOL;
|
extruder = MMU2_NO_TOOL;
|
||||||
tool_change_extruder = MMU2_NO_TOOL;
|
tool_change_extruder = MMU2_NO_TOOL;
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,8 @@ private:
|
||||||
bool ToolChangeCommonOnce(uint8_t slot);
|
bool ToolChangeCommonOnce(uint8_t slot);
|
||||||
|
|
||||||
void HelpUnloadToFinda();
|
void HelpUnloadToFinda();
|
||||||
|
void UnloadInner();
|
||||||
|
void CutFilamentInner(uint8_t slot);
|
||||||
|
|
||||||
ProtocolLogic logic; ///< implementation of the protocol logic layer
|
ProtocolLogic logic; ///< implementation of the protocol logic layer
|
||||||
uint8_t extruder; ///< currently active slot in the MMU ... somewhat... not sure where to get it from yet
|
uint8_t extruder; ///< currently active slot in the MMU ... somewhat... not sure where to get it from yet
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue