Merge pull request #4188 from leptun/fix_missing_live_adjust_z_settings

Always allow Live Adjust Z in Settings
This commit is contained in:
3d-gussner 2023-05-08 12:57:08 +02:00 committed by GitHub
commit 719d1704c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 11 deletions

View File

@ -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,

View File

@ -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

View File

@ -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);
@ -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)
@ -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);