From fb4aead2b143d2c19e6a1bb6e4db90b68bccd297 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 2 Mar 2017 19:15:21 -0600 Subject: [PATCH] Clean up and finish #5887 --- Marlin/Configuration_adv.h | 13 +++------ .../Cartesio/Configuration_adv.h | 7 +++++ .../Felix/Configuration_adv.h | 7 +++++ .../Hephestos/Configuration_adv.h | 7 +++++ .../Hephestos_2/Configuration_adv.h | 7 +++++ .../K8200/Configuration_adv.h | 7 +++++ .../K8400/Configuration_adv.h | 7 +++++ .../RigidBot/Configuration_adv.h | 7 +++++ .../SCARA/Configuration_adv.h | 7 +++++ .../TAZ4/Configuration_adv.h | 7 +++++ .../WITBOX/Configuration_adv.h | 7 +++++ .../delta/generic/Configuration_adv.h | 7 +++++ .../delta/kossel_mini/Configuration_adv.h | 7 +++++ .../delta/kossel_pro/Configuration_adv.h | 7 +++++ .../delta/kossel_xl/Configuration_adv.h | 7 +++++ .../makibox/Configuration_adv.h | 7 +++++ .../tvrrug/Round2/Configuration_adv.h | 7 +++++ Marlin/ultralcd.cpp | 29 +++++++++---------- 18 files changed, 129 insertions(+), 25 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 92e64f26be..9a378f589a 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1128,17 +1128,12 @@ */ //#define EXTENDED_CAPABILITIES_REPORT - /** - * Double Clicking of LCD Panel's Encoder Wheel while at the Status Screen will jump - * to the Z-BabyStepping menu. + * Double-click the Encoder button on the Status Screen for Z Babystepping. */ -//#define DOUBLE_CLICK_JUMPS_TO_Z_BABYSTEPPING -#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. - +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. /** * Volumetric extrusion default state diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 4f2572e4a2..e629b7f48c 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 96775c9d86..010d2c018d 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 67981af958..1877ace1bc 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index e7caa3f339..d26300e0e7 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -1108,6 +1108,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 2cdc1365a1..aa4db9c689 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -1138,6 +1138,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index a0889024b2..bb2e1e49e5 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index 843c2b0428..f8eef6f569 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 68304e7121..892d2edebc 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index 8e42b82719..86d2737535 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -1133,6 +1133,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 67981af958..1877ace1bc 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index d362d727e9..5d75ba3cf5 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -1127,6 +1127,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index d362d727e9..5d75ba3cf5 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -1127,6 +1127,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 61c38d38aa..9f3a9f3d2f 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -1132,6 +1132,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 9584ae3411..78a52f8323 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -1127,6 +1127,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 184dc0dac0..87de6007b3 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 2092b3b60f..a259f420a8 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -1125,6 +1125,13 @@ */ //#define EXTENDED_CAPABILITIES_REPORT +/** + * Double-click the Encoder button on the Status Screen for Z Babystepping. + */ +//#define DOUBLECLICK_FOR_Z_BABYSTEPPING +#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: You may need to add extra time to mitigate controller latency. + /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index c0facef97d..b5331e389b 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -51,7 +51,6 @@ int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2 #if ENABLED(BABYSTEPPING) long babysteps_done = 0; - millis_t status_screen_click_time = 0; static void lcd_babystep_z(); #endif @@ -417,22 +416,20 @@ 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) { + + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) && ENABLED(BABYSTEPPING) + static millis_t doubleclick_expire_ms = 0; + // Going to lcd_main_menu from status screen? Remember first click time. + // Going back to status screen within a very short time? Go to Z babystepping. + if (screen == lcd_main_menu) { + if (currentScreen == lcd_status_screen) + doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; + } + else if (screen == lcd_status_screen && currentScreen == lcd_main_menu && PENDING(millis(), doubleclick_expire_ms)) + screen = lcd_babystep_z; + #endif + currentScreen = screen; encoderPosition = encoder; if (screen == lcd_status_screen) {