Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#4188 from leptun/fix_missing_live_a…
Browse files Browse the repository at this point in the history
…djust_z_settings

Always allow Live Adjust Z in Settings
  • Loading branch information
3d-gussner authored May 8, 2023
2 parents bf6c091 + 462535e commit 719d170
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
16 changes: 11 additions & 5 deletions Firmware/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,20 @@ bool printer_active();
bool check_fsensor();

//! Condition where Babystepping is allowed:
//! 1) Z-axis position is less than 2.0mm (only allowed during the first couple of layers)
//! 2) Not allowed during Homing (printer busy)
//! 3) Not allowed during Mesh Bed Leveling (printer busy)
//! 1) Not allowed during Homing (printer busy)
//! 2) Not allowed during Mesh Bed Leveling (printer busy)
//! 3) Not allowed when a print job is paused
//! 4) Allowed if:
//! - First Layer Calibration is running
//! - OR there are queued blocks, printJob is running and it's not paused, and Z-axis position is less than 2.0mm (only allowed during the first couple of layers)
//! - First Layer Calibration is running (the event when heaters are turned off is used to dismiss the menu)
//! - A print job is running
//! - If the printer is idle with not planned moves
bool babystep_allowed();

//! Same as babystep_allowed() but additionally adds a requirement
//! where the Z-axis position must be less than 2.0mm (only allowed
//! during the first couple of layers)
bool babystep_allowed_strict();

extern void calculate_extruder_multipliers();

// Similar to the default Arduino delay function,
Expand Down
10 changes: 9 additions & 1 deletion Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,18 @@ bool check_fsensor() {
bool __attribute__((noinline)) babystep_allowed() {
return ( !homing_flag
&& !mesh_bed_leveling_flag
&& ( lcd_commands_type == LcdCommands::Layer1Cal || ( blocks_queued() && !isPrintPaused && printJobOngoing() && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU)))
&& !isPrintPaused
&& ((lcd_commands_type == LcdCommands::Layer1Cal && CHECK_ALL_HEATERS)
|| printJobOngoing()
|| lcd_commands_type == LcdCommands::Idle
)
);
}

bool __attribute__((noinline)) babystep_allowed_strict() {
return ( babystep_allowed() && current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU);
}

bool fans_check_enabled = true;

#ifdef TMC2130
Expand Down
12 changes: 7 additions & 5 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4470,8 +4470,7 @@ static void lcd_settings_menu()
MENU_ITEM_TOGGLE_P(_T(MSG_RPI_PORT), (selectedSerialPort == 0) ? _T(MSG_OFF) : _T(MSG_ON), lcd_second_serial_set);
#endif //HAS_SECOND_SERIAL

if ( babystep_allowed() )
MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);
if (!isPrintPaused) MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);

#if (LANG_MODE != 0)
MENU_ITEM_SUBMENU_P(_T(MSG_SELECT_LANGUAGE), lcd_language_menu);
Expand Down Expand Up @@ -5149,7 +5148,8 @@ static void lcd_main_menu()
MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_);
#endif //TMC2130_DEBUG

if ( babystep_allowed() )
// Menu is never shown when idle
if (babystep_allowed_strict() && (printJobOngoing() || lcd_commands_type == LcdCommands::Layer1Cal))
MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8

if (farm_mode)
Expand Down Expand Up @@ -7167,11 +7167,13 @@ void menu_lcd_longpress_func(void)

// explicitely listed menus which are allowed to rise the move-z or live-adj-z functions
// The lists are not the same for both functions, so first decide which function is to be performed
if (babystep_allowed()){ // long press as live-adj-z
if ( menu_menu == lcd_status_screen // and in listed menus...
if (blocks_queued() || printJobOngoing()){ // long press as live-adj-z
if ( babystep_allowed_strict()
&& (menu_menu == lcd_status_screen // and in listed menus...
|| menu_menu == lcd_main_menu
|| menu_menu == lcd_tune_menu
|| menu_menu == lcd_support_menu
)
){
lcd_clear();
menu_submenu(lcd_babystep_z);
Expand Down

0 comments on commit 719d170

Please sign in to comment.