Merge pull request #4514 from DRracer/current-tool
MMU2: Report current tool onto the serial
This commit is contained in:
commit
ba004d2fa8
|
|
@ -72,7 +72,7 @@ void MMU2::Start() {
|
|||
PowerOn();
|
||||
mmu2Serial.flush(); // make sure the UART buffer is clear before starting communication
|
||||
|
||||
extruder = MMU2_NO_TOOL;
|
||||
SetCurrentTool(MMU2_NO_TOOL);
|
||||
state = xState::Connecting;
|
||||
|
||||
// start the communication
|
||||
|
|
@ -357,7 +357,7 @@ void MMU2::ToolChangeCommon(uint8_t slot) {
|
|||
static_cast<void>(manage_response(true, true)); // yes, I'd like to silence [[nodiscard]] warning at this spot by casting to void
|
||||
}
|
||||
|
||||
extruder = slot; //filament change is finished
|
||||
SetCurrentTool(slot); //filament change is finished
|
||||
SpoolJoin::spooljoin.setSlot(slot);
|
||||
|
||||
++toolchange_counter;
|
||||
|
|
@ -428,6 +428,12 @@ uint8_t MMU2::get_tool_change_tool() const {
|
|||
return tool_change_extruder == MMU2_NO_TOOL ? (uint8_t)FILAMENT_UNKNOWN : tool_change_extruder;
|
||||
}
|
||||
|
||||
void MMU2::SetCurrentTool(uint8_t ex){
|
||||
extruder = ex;
|
||||
MMU2_ECHO_MSGRPGM(PSTR("MMU2tool="));
|
||||
SERIAL_ECHOLN((int)ex);
|
||||
}
|
||||
|
||||
bool MMU2::set_filament_type(uint8_t /*slot*/, uint8_t /*type*/) {
|
||||
if (!WaitForMMUReady())
|
||||
return false;
|
||||
|
|
@ -462,7 +468,7 @@ void MMU2::UnloadInner() {
|
|||
MakeSound(Confirm);
|
||||
|
||||
// no active tool
|
||||
extruder = MMU2_NO_TOOL;
|
||||
SetCurrentTool(MMU2_NO_TOOL);
|
||||
tool_change_extruder = MMU2_NO_TOOL;
|
||||
}
|
||||
|
||||
|
|
@ -504,7 +510,7 @@ bool MMU2::cut_filament(uint8_t slot, bool enableFullScreenMsg /*= true*/) {
|
|||
|
||||
ReportingRAII rep(CommandInProgress::CutFilament);
|
||||
CutFilamentInner(slot);
|
||||
extruder = MMU2_NO_TOOL;
|
||||
SetCurrentTool(MMU2_NO_TOOL);
|
||||
tool_change_extruder = MMU2_NO_TOOL;
|
||||
MakeSound(SoundType::Confirm);
|
||||
}
|
||||
|
|
@ -587,7 +593,7 @@ bool MMU2::eject_filament(uint8_t slot, bool enableFullScreenMsg /* = true */) {
|
|||
break;
|
||||
IncrementMMUFails();
|
||||
}
|
||||
extruder = MMU2_NO_TOOL;
|
||||
SetCurrentTool(MMU2_NO_TOOL);
|
||||
tool_change_extruder = MMU2_NO_TOOL;
|
||||
MakeSound(Confirm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,6 +340,8 @@ private:
|
|||
void UnloadInner();
|
||||
void CutFilamentInner(uint8_t slot);
|
||||
|
||||
void SetCurrentTool(uint8_t ex);
|
||||
|
||||
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 tool_change_extruder; ///< only used for UI purposes
|
||||
|
|
|
|||
Loading…
Reference in New Issue