Unify naming convention (index->slot)
in all top level MMU-related functions
This commit is contained in:
parent
e414413b2e
commit
ffbd95b482
|
|
@ -311,11 +311,11 @@ void MMU2::update_tool_change_counter_eeprom() {
|
||||||
reset_toolchange_counter();
|
reset_toolchange_counter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::MMU2::ToolChangeCommon(uint8_t index){
|
void MMU2::MMU2::ToolChangeCommon(uint8_t slot){
|
||||||
tool_change_extruder = index;
|
tool_change_extruder = slot;
|
||||||
do {
|
do {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
logic.ToolChange(index); // let the MMU pull the filament out and push a new one in
|
logic.ToolChange(slot); // let the MMU pull the filament out and push a new one in
|
||||||
if( manage_response(true, true) )
|
if( manage_response(true, true) )
|
||||||
break;
|
break;
|
||||||
// otherwise: failed to perform the command - unload first and then let it run again
|
// otherwise: failed to perform the command - unload first and then let it run again
|
||||||
|
|
@ -325,8 +325,8 @@ void MMU2::MMU2::ToolChangeCommon(uint8_t index){
|
||||||
plan_set_e_position(current_position[E_AXIS]);
|
plan_set_e_position(current_position[E_AXIS]);
|
||||||
} while (0); // while not successfully fed into etruder's PTFE tube
|
} while (0); // while not successfully fed into etruder's PTFE tube
|
||||||
|
|
||||||
extruder = index; //filament change is finished
|
extruder = slot; //filament change is finished
|
||||||
SpoolJoin::spooljoin.setSlot(index);
|
SpoolJoin::spooljoin.setSlot(slot);
|
||||||
|
|
||||||
// @@TODO really report onto the serial? May be for the Octoprint? Not important now
|
// @@TODO really report onto the serial? May be for the Octoprint? Not important now
|
||||||
// SERIAL_ECHO_START();
|
// SERIAL_ECHO_START();
|
||||||
|
|
@ -334,11 +334,11 @@ void MMU2::MMU2::ToolChangeCommon(uint8_t index){
|
||||||
increment_tool_change_counter();
|
increment_tool_change_counter();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::tool_change(uint8_t index) {
|
bool MMU2::tool_change(uint8_t slot) {
|
||||||
if( ! WaitForMMUReady())
|
if( ! WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (index != extruder) {
|
if (slot != extruder) {
|
||||||
if (!IS_SD_PRINTING && !usb_timer.running()) {
|
if (!IS_SD_PRINTING && !usb_timer.running()) {
|
||||||
// If Tcodes are used manually through the serial
|
// If Tcodes are used manually through the serial
|
||||||
// we need to unload manually as well
|
// we need to unload manually as well
|
||||||
|
|
@ -348,7 +348,7 @@ bool MMU2::tool_change(uint8_t index) {
|
||||||
ReportingRAII rep(CommandInProgress::ToolChange);
|
ReportingRAII rep(CommandInProgress::ToolChange);
|
||||||
FSensorBlockRunout blockRunout;
|
FSensorBlockRunout blockRunout;
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
ToolChangeCommon(index);
|
ToolChangeCommon(slot);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -406,12 +406,12 @@ uint8_t MMU2::get_tool_change_tool() const {
|
||||||
return tool_change_extruder == MMU2_NO_TOOL ? (uint8_t)FILAMENT_UNKNOWN : tool_change_extruder;
|
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 slot, uint8_t type) {
|
||||||
if( ! WaitForMMUReady())
|
if( ! WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// @@TODO - this is not supported in the new MMU yet
|
// @@TODO - this is not supported in the new MMU yet
|
||||||
index = index; // @@TODO
|
slot = slot; // @@TODO
|
||||||
type = type; // @@TODO
|
type = type; // @@TODO
|
||||||
// cmd_arg = filamentType;
|
// cmd_arg = filamentType;
|
||||||
// command(MMU_CMD_F0 + index);
|
// command(MMU_CMD_F0 + index);
|
||||||
|
|
@ -450,12 +450,12 @@ bool MMU2::unload() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::cut_filament(uint8_t index){
|
bool MMU2::cut_filament(uint8_t slot){
|
||||||
if( ! WaitForMMUReady())
|
if( ! WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ReportingRAII rep(CommandInProgress::CutFilament);
|
ReportingRAII rep(CommandInProgress::CutFilament);
|
||||||
logic.CutFilament(index);
|
logic.CutFilament(slot);
|
||||||
if( ! manage_response(false, true) ){
|
if( ! manage_response(false, true) ){
|
||||||
// @@TODO failed to perform the command - retry
|
// @@TODO failed to perform the command - retry
|
||||||
;
|
;
|
||||||
|
|
@ -472,24 +472,24 @@ void FullScreenMsg(const char *pgmS, uint8_t slot){
|
||||||
lcd_print(slot + 1);
|
lcd_print(slot + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::loading_test(uint8_t index){
|
bool MMU2::loading_test(uint8_t slot){
|
||||||
FullScreenMsg(_T(MSG_TESTING_FILAMENT), index);
|
FullScreenMsg(_T(MSG_TESTING_FILAMENT), slot);
|
||||||
tool_change(index);
|
tool_change(slot);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
unload();
|
unload();
|
||||||
lcd_update_enable(true);
|
lcd_update_enable(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::load_filament(uint8_t index) {
|
bool MMU2::load_filament(uint8_t slot) {
|
||||||
if( ! WaitForMMUReady())
|
if( ! WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FullScreenMsg(_T(MSG_LOADING_FILAMENT), index);
|
FullScreenMsg(_T(MSG_LOADING_FILAMENT), slot);
|
||||||
|
|
||||||
ReportingRAII rep(CommandInProgress::LoadFilament);
|
ReportingRAII rep(CommandInProgress::LoadFilament);
|
||||||
do {
|
do {
|
||||||
logic.LoadFilament(index);
|
logic.LoadFilament(slot);
|
||||||
} while( ! manage_response(false, false) );
|
} while( ! manage_response(false, false) );
|
||||||
|
|
||||||
Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
|
Sound_MakeSound(e_SOUND_TYPE_StandardConfirm);
|
||||||
|
|
@ -509,7 +509,7 @@ struct LoadingToNozzleRAII {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MMU2::load_filament_to_nozzle(uint8_t index) {
|
bool MMU2::load_filament_to_nozzle(uint8_t slot) {
|
||||||
if( ! WaitForMMUReady())
|
if( ! WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -517,7 +517,7 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) {
|
||||||
|
|
||||||
WaitForHotendTargetTempBeep();
|
WaitForHotendTargetTempBeep();
|
||||||
|
|
||||||
FullScreenMsg(_T(MSG_LOADING_FILAMENT), index);
|
FullScreenMsg(_T(MSG_LOADING_FILAMENT), slot);
|
||||||
{
|
{
|
||||||
// used for MMU-menu operation "Load to Nozzle"
|
// used for MMU-menu operation "Load to Nozzle"
|
||||||
ReportingRAII rep(CommandInProgress::ToolChange);
|
ReportingRAII rep(CommandInProgress::ToolChange);
|
||||||
|
|
@ -527,7 +527,7 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) {
|
||||||
filament_ramming();
|
filament_ramming();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolChangeCommon(index);
|
ToolChangeCommon(slot);
|
||||||
|
|
||||||
// Finish loading to the nozzle with finely tuned steps.
|
// Finish loading to the nozzle with finely tuned steps.
|
||||||
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0]));
|
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0]));
|
||||||
|
|
@ -537,7 +537,7 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::eject_filament(uint8_t index, bool recover) {
|
bool MMU2::eject_filament(uint8_t slot, bool recover) {
|
||||||
if( ! WaitForMMUReady())
|
if( ! WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -545,7 +545,7 @@ bool MMU2::eject_filament(uint8_t index, bool recover) {
|
||||||
current_position[E_AXIS] -= MMU2_FILAMENTCHANGE_EJECT_FEED;
|
current_position[E_AXIS] -= MMU2_FILAMENTCHANGE_EJECT_FEED;
|
||||||
plan_buffer_line_curposXYZE(2500.F / 60.F);
|
plan_buffer_line_curposXYZE(2500.F / 60.F);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
logic.EjectFilament(index);
|
logic.EjectFilament(slot);
|
||||||
if( ! manage_response(false, false) ){
|
if( ! manage_response(false, false) ){
|
||||||
// @@TODO failed to perform the command - retry
|
// @@TODO failed to perform the command - retry
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,9 @@ public:
|
||||||
void mmu_loop();
|
void mmu_loop();
|
||||||
|
|
||||||
/// The main MMU command - select a different slot
|
/// The main MMU command - select a different slot
|
||||||
/// @param index of the slot to be selected
|
/// @param slot of the slot to be selected
|
||||||
/// @returns false if the operation cannot be performed (Stopped)
|
/// @returns false if the operation cannot be performed (Stopped)
|
||||||
bool tool_change(uint8_t index);
|
bool tool_change(uint8_t slot);
|
||||||
|
|
||||||
/// Handling of special Tx, Tc, T? commands
|
/// Handling of special Tx, Tc, T? commands
|
||||||
bool tool_change(char code, uint8_t slot);
|
bool tool_change(char code, uint8_t slot);
|
||||||
|
|
@ -118,20 +118,20 @@ public:
|
||||||
|
|
||||||
/// Load (insert) filament just into the MMU (not into printer's nozzle)
|
/// Load (insert) filament just into the MMU (not into printer's nozzle)
|
||||||
/// @returns false if the operation cannot be performed (Stopped)
|
/// @returns false if the operation cannot be performed (Stopped)
|
||||||
bool load_filament(uint8_t index);
|
bool load_filament(uint8_t slot);
|
||||||
|
|
||||||
/// Load (push) filament from the MMU into the printer's nozzle
|
/// Load (push) filament from the MMU into the printer's nozzle
|
||||||
/// @returns false if the operation cannot be performed (Stopped or cold extruder)
|
/// @returns false if the operation cannot be performed (Stopped or cold extruder)
|
||||||
bool load_filament_to_nozzle(uint8_t index);
|
bool load_filament_to_nozzle(uint8_t slot);
|
||||||
|
|
||||||
/// Move MMU's selector aside and push the selected filament forward.
|
/// Move MMU's selector aside and push the selected filament forward.
|
||||||
/// Usable for improving filament's tip or pulling the remaining piece of filament out completely.
|
/// Usable for improving filament's tip or pulling the remaining piece of filament out completely.
|
||||||
bool eject_filament(uint8_t index, bool recover);
|
bool eject_filament(uint8_t slot, bool recover);
|
||||||
|
|
||||||
/// Issue a Cut command into the MMU
|
/// Issue a Cut command into the MMU
|
||||||
/// 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 slot);
|
||||||
|
|
||||||
/// Issue a planned request for statistics data from MMU
|
/// Issue a planned request for statistics data from MMU
|
||||||
void get_statistics();
|
void get_statistics();
|
||||||
|
|
@ -140,9 +140,9 @@ public:
|
||||||
/// It behaves very similarly like a ToolChange, but it doesn't load the filament
|
/// It behaves very similarly like a ToolChange, but it doesn't load the filament
|
||||||
/// all the way down to the nozzle. The sole purpose of this operation
|
/// all the way down to the nozzle. The sole purpose of this operation
|
||||||
/// is to check, that the filament will be ready for printing.
|
/// is to check, that the filament will be ready for printing.
|
||||||
/// @param index index of slot to be tested
|
/// @param slot index of slot to be tested
|
||||||
/// @returns true
|
/// @returns true
|
||||||
bool loading_test(uint8_t index);
|
bool loading_test(uint8_t slot);
|
||||||
|
|
||||||
/// @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;
|
||||||
|
|
@ -150,7 +150,7 @@ public:
|
||||||
/// @returns The filament slot index (0 to 4) that will be loaded next, 0xff in case of no active tool change
|
/// @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;
|
uint8_t get_tool_change_tool() const;
|
||||||
|
|
||||||
bool set_filament_type(uint8_t index, uint8_t type);
|
bool set_filament_type(uint8_t slot, 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
|
||||||
/// to select one of the 3 possible options to resolve the issue
|
/// to select one of the 3 possible options to resolve the issue
|
||||||
|
|
@ -285,7 +285,7 @@ private:
|
||||||
bool WaitForMMUReady();
|
bool WaitForMMUReady();
|
||||||
|
|
||||||
/// Common processing of pushing filament into the extruder - shared by tool_change, load_to_nozzle and probably others
|
/// Common processing of pushing filament into the extruder - shared by tool_change, load_to_nozzle and probably others
|
||||||
void ToolChangeCommon(uint8_t index);
|
void ToolChangeCommon(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