diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index a495e96dbb..eb5ac1906e 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -121,7 +121,7 @@ char MMU2::rx_buffer[MMU_RX_SIZE], MMU2::tx_buffer[MMU_TX_SIZE]; #endif ; -#endif // MMU2_MENUS +#endif MMU2::MMU2() { rx_buffer[0] = '\0'; @@ -755,7 +755,7 @@ static void mmu2_not_responding() { set_runout_valid(true); #endif - } + } #endif // HAS_PRUSA_MMU2S diff --git a/Marlin/src/gcode/control/T.cpp b/Marlin/src/gcode/control/T.cpp index 163223294d..592b2b3dce 100644 --- a/Marlin/src/gcode/control/T.cpp +++ b/Marlin/src/gcode/control/T.cpp @@ -40,7 +40,7 @@ * F[units/min] Set the movement feedrate * S1 Don't move the tool in XY after change * - * For PRUSA_MMU2/PRUSA_MMU2S/SMUFF_EMU_MMU2PRUSA_MMU2S: + * For PRUSA_MMU2(S) and SMUFF_EMU_MMU2(S) * T[n] Gcode to extrude at least 38.10 mm at feedrate 19.02 mm/s must follow immediately to load to extruder wheels. * T? Gcode to extrude shouldn't have to follow. Load to extruder wheels is done automatically. * Tx Same as T?, but nozzle doesn't have to be preheated. Tc requires a preheated nozzle to finish filament load. diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index b276573b51..1b008e9dbe 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -46,7 +46,7 @@ #define MACHINE_CAN_PAUSE 1 #endif -#if HAS_PRUSA_MMU2 +#if ENABLED(MMU2_MENUS) #include "../../lcd/menu/menu_mmu2.h" #endif diff --git a/Marlin/src/lcd/menu/menu_mmu2.cpp b/Marlin/src/lcd/menu/menu_mmu2.cpp index 12d0bdd2e2..8a34e7d296 100644 --- a/Marlin/src/lcd/menu/menu_mmu2.cpp +++ b/Marlin/src/lcd/menu/menu_mmu2.cpp @@ -28,9 +28,6 @@ #include "menu_mmu2.h" #include "menu_item.h" -uint8_t currentTool; -bool mmuMenuWait; - // // Load Filament // @@ -123,9 +120,12 @@ void menu_mmu2() { // T* Choose Filament // -inline void action_mmu2_choose(const uint8_t tool) { - currentTool = tool; - mmuMenuWait = false; +uint8_t feeder_index; +bool wait_for_mmu_menu; + +inline void action_mmu2_chosen(const uint8_t index) { + feeder_index = index; + wait_for_mmu_menu = false; } void menu_mmu2_choose_filament() { @@ -133,7 +133,7 @@ void menu_mmu2_choose_filament() { #if LCD_HEIGHT > 2 STATIC_ITEM(MSG_MMU2_CHOOSE_FILAMENT_HEADER, SS_DEFAULT|SS_INVERT); #endif - LOOP_L_N(i, 5) ACTION_ITEM_N(i, MSG_MMU2_FILAMENT_N, []{ action_mmu2_choose(MenuItemBase::itemIndex); }); + LOOP_L_N(i, 5) ACTION_ITEM_N(i, MSG_MMU2_FILAMENT_N, []{ action_mmu2_chosen(MenuItemBase::itemIndex); }); END_MENU(); } @@ -142,32 +142,32 @@ void menu_mmu2_choose_filament() { // void menu_mmu2_pause() { - currentTool = mmu2.get_current_tool(); + feeder_index = mmu2.get_current_tool(); START_MENU(); #if LCD_HEIGHT > 2 STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER, SS_DEFAULT|SS_INVERT); #endif - ACTION_ITEM(MSG_MMU2_RESUME, []{ mmuMenuWait = false; }); + ACTION_ITEM(MSG_MMU2_RESUME, []{ wait_for_mmu_menu = false; }); ACTION_ITEM(MSG_MMU2_UNLOAD_FILAMENT, []{ mmu2.unload(); }); - ACTION_ITEM(MSG_MMU2_LOAD_FILAMENT, []{ mmu2.load_filament(currentTool); }); - ACTION_ITEM(MSG_MMU2_LOAD_TO_NOZZLE, []{ mmu2.load_filament_to_nozzle(currentTool); }); + ACTION_ITEM(MSG_MMU2_LOAD_FILAMENT, []{ mmu2.load_filament(feeder_index); }); + ACTION_ITEM(MSG_MMU2_LOAD_TO_NOZZLE, []{ mmu2.load_filament_to_nozzle(feeder_index); }); END_MENU(); } void mmu2_M600() { ui.defer_status_screen(); ui.goto_screen(menu_mmu2_pause); - mmuMenuWait = true; - while (mmuMenuWait) idle(); + wait_for_mmu_menu = true; + while (wait_for_mmu_menu) idle(); } uint8_t mmu2_choose_filament() { ui.defer_status_screen(); ui.goto_screen(menu_mmu2_choose_filament); - mmuMenuWait = true; - while (mmuMenuWait) idle(); + wait_for_mmu_menu = true; + while (wait_for_mmu_menu) idle(); ui.return_to_status(); - return currentTool; + return feeder_index; } #endif // HAS_LCD_MENU && MMU2_MENUS diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h index 2bb68f4f40..dfdd63b05b 100644 --- a/Marlin/src/module/stepper/indirection.h +++ b/Marlin/src/module/stepper/indirection.h @@ -418,16 +418,18 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define REV_E_DIR(E) do{ E0_DIR_WRITE(E ? !INVERT_E0_DIR : INVERT_E0_DIR); }while(0) #endif -#elif HAS_PRUSA_MMU1 // One multiplexed stepper driver, reversed on odd index - #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) - #define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? !INVERT_E0_DIR: INVERT_E0_DIR); }while(0) - #define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? INVERT_E0_DIR: !INVERT_E0_DIR); }while(0) - #elif HAS_PRUSA_MMU2 + #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) #define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR) #define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR) +#elif HAS_PRUSA_MMU1 // One multiplexed stepper driver, reversed on odd index + + #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) + #define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? !INVERT_E0_DIR: INVERT_E0_DIR); }while(0) + #define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? INVERT_E0_DIR: !INVERT_E0_DIR); }while(0) + #elif E_STEPPERS > 1 #if E_STEPPERS > 7