Merge pull request #2245 from DRracer/knob-long-press

Knob long press fixes
This commit is contained in:
Marek Běl 2019-10-01 22:33:26 +02:00 committed by GitHub
commit 210d7f6bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 12 deletions

View file

@ -761,8 +761,7 @@ void lcd_buttons_update(void)
//else if (menu_menu == lcd_move_z) lcd_quick_feedback();
//lcd_button_pressed is set back to false via lcd_quick_feedback function
}
else
lcd_long_press_active = 0;
lcd_long_press_active = 0;
}
lcd_buttons = newbutton;

View file

@ -8647,7 +8647,6 @@ uint8_t get_message_level()
return lcd_status_message_level;
}
void menu_lcd_longpress_func(void)
{
if (homing_flag || mesh_bed_leveling_flag || menu_menu == lcd_babystep_z || menu_menu == lcd_move_z)
@ -8657,15 +8656,42 @@ void menu_lcd_longpress_func(void)
return;
}
if (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU && (moves_planned() || IS_SD_PRINTING || is_usb_printing ))
{
lcd_clear();
menu_submenu(lcd_babystep_z);
}
else
{
move_menu_scale = 1.0;
menu_submenu(lcd_move_z);
// 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 ( (moves_planned() || IS_SD_PRINTING || is_usb_printing )){ // long press as live-adj-z
if(( current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU ) // only allow live-adj-z up to 2mm of print height
&& ( 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);
} else {
// otherwise consume the long press as normal click
if( menu_menu != lcd_status_screen )
menu_back();
}
} else { // long press as move-z
if(menu_menu == lcd_status_screen
|| menu_menu == lcd_main_menu
|| menu_menu == lcd_preheat_menu
|| menu_menu == lcd_sdcard_menu
|| menu_menu == lcd_settings_menu
|| menu_menu == lcd_control_temperature_menu
#if (LANG_MODE != 0)
|| menu_menu == lcd_language
#endif
|| menu_menu == lcd_support_menu
){
move_menu_scale = 1.0;
menu_submenu(lcd_move_z);
} else {
// otherwise consume the long press as normal click
if( menu_menu != lcd_status_screen )
menu_back();
}
}
}