From 72aed3c544f393653f9c2581eb952b55e9f77f99 Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 1 Oct 2019 10:51:02 +0200 Subject: [PATCH 1/3] Allow knob-long-press only in listed menus --- Firmware/ultralcd.cpp | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 77af6d5f4..4812e343a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -8606,7 +8606,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) @@ -8616,15 +8615,41 @@ void menu_lcd_longpress_func(void) return; } + // 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 + // @@TODO - handle full-screen modal dialogs safely - i.e. they should not hang the printer while doing long press 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); + { // long press as live-adj-z + if(menu_menu == lcd_status_screen + || 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 + // consume the loreturns to sheet menu + 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 + // consume the loreturns to sheet menu + menu_back(); + } } } From 9ae75612b57661b3db55131179df6a3a8d7cc569 Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 1 Oct 2019 15:31:01 +0200 Subject: [PATCH 2/3] Fixes after first feature tests --- Firmware/ultralcd.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4812e343a..a966c81f6 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -8618,11 +8618,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 // @@TODO - handle full-screen modal dialogs safely - i.e. they should not hang the printer while doing long press - if (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU && (moves_planned() || IS_SD_PRINTING || is_usb_printing )) - { // long press as live-adj-z - if(menu_menu == lcd_status_screen - || menu_menu == lcd_tune_menu - || menu_menu == lcd_support_menu + 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); From f3c3526aa5cdf49df526e2a2660d2ee43535112c Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 1 Oct 2019 17:13:36 +0200 Subject: [PATCH 3/3] fix the knob long-press causing hang in modal dialogs --- Firmware/lcd.cpp | 3 +-- Firmware/ultralcd.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 71948789b..3e39312c1 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -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; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a966c81f6..ac0067d06 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -8617,7 +8617,6 @@ 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 - // @@TODO - handle full-screen modal dialogs safely - i.e. they should not hang the printer while doing long press 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... @@ -8630,8 +8629,8 @@ void menu_lcd_longpress_func(void) menu_submenu(lcd_babystep_z); } else { // otherwise consume the long press as normal click - // consume the loreturns to sheet menu - menu_back(); + if( menu_menu != lcd_status_screen ) + menu_back(); } } else { // long press as move-z if(menu_menu == lcd_status_screen @@ -8649,8 +8648,8 @@ void menu_lcd_longpress_func(void) menu_submenu(lcd_move_z); } else { // otherwise consume the long press as normal click - // consume the loreturns to sheet menu - menu_back(); + if( menu_menu != lcd_status_screen ) + menu_back(); } } }