From 48d862377a488fa24fe2845cab47f505b3bae3e9 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Tue, 21 Feb 2017 18:04:31 -0700 Subject: [PATCH 1/5] Double Click of Encoder Wheel Jumps to Z-BabyStepping --- Marlin/Configuration_adv.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 42b6d0634..549816877 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1126,6 +1126,14 @@ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double Clicking of LCD Panel's Encoder Wheel while at the Status Screen will jump + * to the Z-BabyStepping menu. + */ +//#define DOUBLE_CLICK_JUMPS_TO_Z_BABYSTEPPING +#define DOUBLE_CLICK_TIME_WINDOW 1250 // How quickly the double click must be done. + + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, From 17d1cd7c09ea4d0f94b721587a9e111747d83d89 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Tue, 21 Feb 2017 18:08:19 -0700 Subject: [PATCH 2/5] Double Click of Encoder Wheel Jumps to Z-BabyStepping --- Marlin/ultralcd.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 5e4012ac2..70e776bc7 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -411,6 +411,21 @@ uint16_t max_display_update_time = 0; * General function to go directly to a screen */ void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0) { + #ifdef DOUBLE_CLICK_JUMPS_TO_Z_BABYSTEPPING + #if ENABLED(BABYSTEPPING) + if (currentScreen==lcd_status_screen && screen==lcd_main_menu) // We are in leaving the status screen to goto the main_menu + status_screen_click_time = millis(); // screen. Mark the time so we know how quick the user is + // pressing buttons. + if (currentScreen==lcd_main_menu) { + if ( screen==lcd_status_screen && status_screen_click_time+DOUBLE_CLICK_TIME_WINDOW>millis() ) { + lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; + status_screen_click_time = 0; + lcd_babystep_z(); + return; + } + } + #endif + #endif if (currentScreen != screen) { currentScreen = screen; encoderPosition = encoder; @@ -756,8 +771,6 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(BABYSTEPPING) - long babysteps_done = 0; - void _lcd_babystep(const AxisEnum axis, const char* msg) { if (lcd_clicked) { defer_return_to_status = false; return lcd_goto_previous_menu(); } ENCODER_DIRECTION_NORMAL(); From e443e0e2a9f295f063eab50da9f70e97f2a00112 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Tue, 21 Feb 2017 18:15:28 -0700 Subject: [PATCH 3/5] Fix scoping issues for double click to Z-Babystepping --- Marlin/ultralcd.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 70e776bc7..1e5aa01c0 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -49,6 +49,12 @@ int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2 millis_t previous_lcd_status_ms = 0; #endif +#if ENABLED(BABYSTEPPING) + long babysteps_done = 0; + millis_t status_screen_click_time = 0; + static void lcd_babystep_z(); +#endif + uint8_t lcd_status_message_level; char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 From 584d147a024a1b70089752e1016be2f38ca7eaeb Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Wed, 22 Feb 2017 07:23:54 -0700 Subject: [PATCH 4/5] fixup the indentation --- Marlin/ultralcd.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 1e5aa01c0..4a81dff37 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -417,21 +417,21 @@ uint16_t max_display_update_time = 0; * General function to go directly to a screen */ void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0) { - #ifdef DOUBLE_CLICK_JUMPS_TO_Z_BABYSTEPPING - #if ENABLED(BABYSTEPPING) - if (currentScreen==lcd_status_screen && screen==lcd_main_menu) // We are in leaving the status screen to goto the main_menu - status_screen_click_time = millis(); // screen. Mark the time so we know how quick the user is - // pressing buttons. - if (currentScreen==lcd_main_menu) { - if ( screen==lcd_status_screen && status_screen_click_time+DOUBLE_CLICK_TIME_WINDOW>millis() ) { - lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; - status_screen_click_time = 0; - lcd_babystep_z(); - return; - } - } - #endif - #endif + #ifdef DOUBLE_CLICK_JUMPS_TO_Z_BABYSTEPPING + #if ENABLED(BABYSTEPPING) + if (currentScreen==lcd_status_screen && screen==lcd_main_menu) // We are in leaving the status screen to goto the main_menu + status_screen_click_time = millis(); // screen. Mark the time so we know how quick the user is + // pressing buttons. + if (currentScreen==lcd_main_menu) { + if ( screen==lcd_status_screen && status_screen_click_time+DOUBLE_CLICK_TIME_WINDOW>millis() ) { + lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; + status_screen_click_time = 0; + lcd_babystep_z(); + return; + } + } + #endif + #endif if (currentScreen != screen) { currentScreen = screen; encoderPosition = encoder; From 7e607b06ebc8604f6e7f3f670da52f63d1129dd4 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Thu, 23 Feb 2017 13:13:57 -0700 Subject: [PATCH 5/5] Better comments on DOUBLE_CLICK_TIME_WINDOW --- Marlin/Configuration_adv.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 549816877..34484bbac 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1131,7 +1131,10 @@ * to the Z-BabyStepping menu. */ //#define DOUBLE_CLICK_JUMPS_TO_Z_BABYSTEPPING -#define DOUBLE_CLICK_TIME_WINDOW 1250 // How quickly the double click must be done. +#define DOUBLE_CLICK_TIME_WINDOW 1250 // How quickly the double click must be done in miliseconds. + // Please notice this time must be a little bit longer than what + // is actually desired because there is some latency in detecting a + // change in LCD Panel Button Status. /**