PFW-1343 initial commit
This commit is contained in:
parent
ed04c24ba0
commit
8fd1653b84
|
|
@ -86,6 +86,7 @@ MMU2::MMU2()
|
||||||
, logic(&mmu2Serial)
|
, logic(&mmu2Serial)
|
||||||
, extruder(MMU2_NO_TOOL)
|
, extruder(MMU2_NO_TOOL)
|
||||||
, previous_extruder(MMU2_NO_TOOL)
|
, previous_extruder(MMU2_NO_TOOL)
|
||||||
|
, tool_change_extruder(MMU2_NO_TOOL)
|
||||||
, resume_position()
|
, resume_position()
|
||||||
, resume_hotend_temp(0)
|
, resume_hotend_temp(0)
|
||||||
, logicStepLastStatus(StepStatus::Finished)
|
, logicStepLastStatus(StepStatus::Finished)
|
||||||
|
|
@ -214,6 +215,7 @@ bool MMU2::tool_change(uint8_t index) {
|
||||||
|
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
|
tool_change_extruder = index;
|
||||||
logic.ToolChange(index); // let the MMU pull the filament out and push a new one in
|
logic.ToolChange(index); // let the MMU pull the filament out and push a new one in
|
||||||
manage_response(true, true);
|
manage_response(true, true);
|
||||||
|
|
||||||
|
|
@ -259,6 +261,7 @@ bool MMU2::tool_change(char code, uint8_t slot) {
|
||||||
case 'x': {
|
case 'x': {
|
||||||
set_extrude_min_temp(0); // Allow cold extrusion since Tx only loads to the gears not nozzle
|
set_extrude_min_temp(0); // Allow cold extrusion since Tx only loads to the gears not nozzle
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
tool_change_extruder = slot;
|
||||||
logic.ToolChange(slot);
|
logic.ToolChange(slot);
|
||||||
manage_response(false, false);
|
manage_response(false, false);
|
||||||
extruder = slot;
|
extruder = slot;
|
||||||
|
|
@ -277,7 +280,11 @@ bool MMU2::tool_change(char code, uint8_t slot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t MMU2::get_current_tool() const {
|
uint8_t MMU2::get_current_tool() const {
|
||||||
return extruder == MMU2_NO_TOOL ? -1 : extruder;
|
return extruder == MMU2_NO_TOOL ? (uint8_t)FILAMENT_UNKNOWN : extruder;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t MMU2::get_tool_change_tool() const {
|
||||||
|
return tool_change_extruder == MMU2_NO_TOOL ? (uint8_t)FILAMENT_UNKNOWN : tool_change_extruder;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::set_filament_type(uint8_t index, uint8_t type) {
|
bool MMU2::set_filament_type(uint8_t index, uint8_t type) {
|
||||||
|
|
@ -310,6 +317,7 @@ bool MMU2::unload() {
|
||||||
|
|
||||||
// no active tool
|
// no active tool
|
||||||
extruder = MMU2_NO_TOOL;
|
extruder = MMU2_NO_TOOL;
|
||||||
|
tool_change_extruder = MMU2_NO_TOOL;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -364,6 +372,7 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) {
|
||||||
filament_ramming();
|
filament_ramming();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tool_change_extruder = index;
|
||||||
logic.ToolChange(index);
|
logic.ToolChange(index);
|
||||||
manage_response(true, true);
|
manage_response(true, true);
|
||||||
|
|
||||||
|
|
@ -426,6 +435,7 @@ bool MMU2::eject_filament(uint8_t index, bool recover) {
|
||||||
|
|
||||||
// no active tool
|
// no active tool
|
||||||
extruder = MMU2_NO_TOOL;
|
extruder = MMU2_NO_TOOL;
|
||||||
|
tool_change_extruder = MMU2_NO_TOOL;
|
||||||
Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
|
Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
|
||||||
// disable_E0();
|
// disable_E0();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,13 +104,16 @@ public:
|
||||||
/// Requires unloaded filament from the printer (obviously)
|
/// Requires unloaded filament from the printer (obviously)
|
||||||
/// @returns false if the operation cannot be performed (Stopped)
|
/// @returns false if the operation cannot be performed (Stopped)
|
||||||
bool cut_filament(uint8_t index);
|
bool cut_filament(uint8_t index);
|
||||||
|
|
||||||
/// @returns the active filament slot index (0-4) or 0xff in case of no active tool
|
/// @returns the active filament slot index (0-4) or 0xff in case of no active tool
|
||||||
uint8_t get_current_tool() const;
|
uint8_t get_current_tool() const;
|
||||||
|
|
||||||
/// @returns the previous active filament slot index (0-4) or 0xff in case of no active tool at boot-up
|
/// @returns the previous active filament slot index (0-4) or 0xff in case of no active tool at boot-up
|
||||||
inline uint8_t get_previous_tool() const { return previous_extruder; };
|
inline uint8_t get_previous_tool() const { return previous_extruder; };
|
||||||
|
|
||||||
|
/// @returns The filament slot index (0 to 4) that will be loaded next, 0xff in case of no active tool change
|
||||||
|
uint8_t get_tool_change_tool() const;
|
||||||
|
|
||||||
bool set_filament_type(uint8_t index, uint8_t type);
|
bool set_filament_type(uint8_t index, uint8_t type);
|
||||||
|
|
||||||
/// Issue a "button" click into the MMU - to be used from Error screens of the MMU
|
/// Issue a "button" click into the MMU - to be used from Error screens of the MMU
|
||||||
|
|
@ -205,6 +208,7 @@ private:
|
||||||
ProtocolLogic logic; ///< implementation of the protocol logic layer
|
ProtocolLogic logic; ///< implementation of the protocol logic layer
|
||||||
int extruder; ///< currently active slot in the MMU ... somewhat... not sure where to get it from yet
|
int extruder; ///< currently active slot in the MMU ... somewhat... not sure where to get it from yet
|
||||||
uint8_t previous_extruder; ///< last active slot in the MMU, useful for M600
|
uint8_t previous_extruder; ///< last active slot in the MMU, useful for M600
|
||||||
|
uint8_t tool_change_extruder; ///< only used for UI purposes
|
||||||
|
|
||||||
xyz_pos_t resume_position;
|
xyz_pos_t resume_position;
|
||||||
int16_t resume_hotend_temp;
|
int16_t resume_hotend_temp;
|
||||||
|
|
|
||||||
|
|
@ -452,17 +452,19 @@ void lcdui_print_percent_done(void)
|
||||||
// Print extruder status (5 chars total)
|
// Print extruder status (5 chars total)
|
||||||
void lcdui_print_extruder(void) {
|
void lcdui_print_extruder(void) {
|
||||||
uint8_t chars = 0;
|
uint8_t chars = 0;
|
||||||
// @@TODO if (MMU2::mmu2.get_current_tool() == tmp_extruder) {
|
if (MMU2::mmu2.get_current_tool() == MMU2::mmu2.get_tool_change_tool()) {
|
||||||
// if (MMU2::mmu2.get_current_tool() == MMU2::FILAMENT_UNKNOWN)
|
if (MMU2::mmu2.get_current_tool() == (uint8_t)MMU2::FILAMENT_UNKNOWN) {
|
||||||
// chars = lcd_printf_P(_N(" F?"));
|
chars = lcd_printf_P(_N(" F?"));
|
||||||
// else
|
} else {
|
||||||
// chars = lcd_printf_P(_N(" F%u"), MMU2::mmu2.get_current_tool() + 1);
|
chars = lcd_printf_P(_N(" F%u"), MMU2::mmu2.get_current_tool() + 1);
|
||||||
// } else {
|
}
|
||||||
// if (MMU2::mmu2.get_current_tool() == MMU2::FILAMENT_UNKNOWN)
|
} else {
|
||||||
// chars = lcd_printf_P(_N(" ?>%u"), tmp_extruder + 1);
|
if (MMU2::mmu2.get_current_tool() == (uint8_t)MMU2::FILAMENT_UNKNOWN) {
|
||||||
// else
|
chars = lcd_printf_P(_N(" ?>%u"), MMU2::mmu2.get_tool_change_tool() + 1);
|
||||||
// chars = lcd_printf_P(_N(" %u>%u"), MMU2::mmu2.get_current_tool() + 1, tmp_extruder + 1);
|
} else {
|
||||||
// }
|
chars = lcd_printf_P(_N(" %u>%u"), MMU2::mmu2.get_current_tool() + 1, MMU2::mmu2.get_tool_change_tool() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
lcd_space(5 - chars);
|
lcd_space(5 - chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue