From f704f405af4d9e32d26dfaaf40fd73c604487123 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2017 01:36:42 -0600 Subject: [PATCH 1/6] Add pause/resume actions on M600, M125 --- Marlin/Configuration_adv.h | 8 ++++++++ Marlin/src/feature/pause.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9347e6c5b1..e953fd4e22 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 6322b8958a..f41e346ef5 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -114,6 +114,10 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u ) { if (move_away_flag) return false; // already paused + #ifdef ACTION_ON_PAUSE + SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE); + #endif + if (!DEBUGGING(DRYRUN) && unload_length != 0) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (!thermalManager.allow_cold_extrude && @@ -342,6 +346,10 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif + #ifdef ACTION_ON_RESUME + SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME); + #endif + #if ENABLED(SDSUPPORT) if (sd_print_paused) { card.startFileprint(); From 3b51f5c67e37da6f42f6ae0ef75a666261952ebe Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2017 01:37:12 -0600 Subject: [PATCH 2/6] Add pause/resume action to example configs --- Marlin/src/config/default/Configuration_adv.h | 8 ++++++++ .../config/examples/AlephObjects/TAZ4/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Anet/A6/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Anet/A8/Configuration_adv.h | 8 ++++++++ .../src/config/examples/Azteeg/X5GT/Configuration_adv.h | 8 ++++++++ .../src/config/examples/BQ/Hephestos/Configuration_adv.h | 8 ++++++++ .../config/examples/BQ/Hephestos_2/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Cartesio/Configuration_adv.h | 8 ++++++++ .../config/examples/Creality/CR-10/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Felix/Configuration_adv.h | 8 ++++++++ .../examples/FolgerTech/i3-2020/Configuration_adv.h | 8 ++++++++ .../config/examples/Infitary/i3-M508/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/MakerParts/Configuration_adv.h | 8 ++++++++ .../src/config/examples/Malyan/M150/Configuration_adv.h | 8 ++++++++ .../src/config/examples/Malyan/M200/Configuration_adv.h | 8 ++++++++ .../examples/Micromake/C1/enhanced/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/RigidBot/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/SCARA/Configuration_adv.h | 8 ++++++++ .../src/config/examples/Sanguinololu/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/TinyBoy2/Configuration_adv.h | 8 ++++++++ .../examples/UltiMachine/Archim2/Configuration_adv.h | 8 ++++++++ .../config/examples/Velleman/K8200/Configuration_adv.h | 8 ++++++++ .../config/examples/Velleman/K8400/Configuration_adv.h | 8 ++++++++ .../examples/Wanhao/Duplicator 6/Configuration_adv.h | 8 ++++++++ .../delta/FLSUN/auto_calibrate/Configuration_adv.h | 8 ++++++++ .../examples/delta/FLSUN/kossel_mini/Configuration_adv.h | 8 ++++++++ .../src/config/examples/delta/generic/Configuration_adv.h | 8 ++++++++ .../config/examples/delta/kossel_mini/Configuration_adv.h | 8 ++++++++ .../config/examples/delta/kossel_pro/Configuration_adv.h | 8 ++++++++ .../config/examples/delta/kossel_xl/Configuration_adv.h | 8 ++++++++ .../config/examples/gCreate/gMax1.5+/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/makibox/Configuration_adv.h | 8 ++++++++ .../src/config/examples/tvrrug/Round2/Configuration_adv.h | 8 ++++++++ Marlin/src/config/examples/wt150/Configuration_adv.h | 8 ++++++++ 36 files changed, 288 insertions(+) diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index 9347e6c5b1..e953fd4e22 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index f820c0ebb9..726bfa43f7 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index 97caa8ff41..2f02c036be 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index ad0865bd0d..a05fc69401 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h index 1482814425..f9a4a9d814 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h @@ -1431,6 +1431,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index d5140e1045..98cbb40a61 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index 3753eaaa4c..e0be168ec0 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index d5140e1045..98cbb40a61 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 872a204d39..823ffc9373 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index 578c2ac284..2b5069d295 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -1433,6 +1433,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index 884b63bbfb..619d0a7c4d 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index 1661d10064..60db59b465 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index 883de98007..f8e1b68628 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h index 626e956442..8bd6de236f 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h @@ -1402,6 +1402,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 671e5828a7..13a3d374a0 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -1427,6 +1427,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h index fe0a33249b..9185831d0d 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index a53b220ff2..df3b7d5974 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -1431,6 +1431,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index bf31d7a833..75de9ef4ca 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -1438,6 +1438,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index 4f42261b73..0a426edce8 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index 0267fad41e..7b0a364ebc 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index d5abf3e3dc..0cee22e18a 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -1419,6 +1419,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index 859c91aa27..945cfe1dfc 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index d20761288a..fe7670f034 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index b9ed42bbde..0b51ae981a 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -1441,6 +1441,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index c7cc7fb644..d80dce05c7 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -1431,6 +1431,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h index 0b3407f77d..8876b2b853 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -1432,6 +1432,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index e5e4ffb423..7061cdbfd6 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -1432,6 +1432,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index 45fd2d5d31..ceb0802b3a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -1432,6 +1432,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index 45fd2d5d31..ceb0802b3a 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -1432,6 +1432,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index 45fd2d5d31..ceb0802b3a 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -1432,6 +1432,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h index dceeb82a19..226f71be7a 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -1437,6 +1437,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index e0c6dbc1b1..b69df389a3 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -1432,6 +1432,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index d513cee5b5..e6f2700792 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index 22ec5ec6b6..5ef78ef397 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index a6dc9e089d..0a86a6c5d1 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -1430,6 +1430,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index ebde77283d..1a2aaf952f 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -1431,6 +1431,14 @@ */ //#define ACTION_ON_KILL "poweroff" +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + //=========================================================================== //====================== I2C Position Encoder Settings ====================== //=========================================================================== From c6354fa153ff15d8166ae2ebd0c106fa9f3de5db Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2017 01:39:55 -0600 Subject: [PATCH 3/6] Tweak M125 code --- Marlin/src/gcode/feature/pause/M125.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp index a863d7947b..404373b7e7 100644 --- a/Marlin/src/gcode/feature/pause/M125.cpp +++ b/Marlin/src/gcode/feature/pause/M125.cpp @@ -49,8 +49,6 @@ * Z = override Z raise */ void GcodeSuite::M125() { - point_t park_point = NOZZLE_PARK_POINT; - // Initial retract before move to filament change position const float retract = parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0 #ifdef PAUSE_PARK_RETRACT_LENGTH @@ -58,16 +56,14 @@ void GcodeSuite::M125() { #endif ; - // Lift Z axis - if (parser.seenval('Z')) - park_point.z = parser.linearval('Z'); + point_t park_point = NOZZLE_PARK_POINT; // Move XY axes to filament change position or given position - if (parser.seenval('X')) - park_point.x = parser.linearval('X'); + if (parser.seenval('X')) park_point.x = parser.linearval('X'); + if (parser.seenval('Y')) park_point.y = parser.linearval('Y'); - if (parser.seenval('Y')) - park_point.y = parser.linearval('Y'); + // Lift Z axis + if (parser.seenval('Z')) park_point.z = parser.linearval('Z'); #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE) park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0); From 2925852244a063ea97e780f9ed6b3ebc928cfc38 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2017 02:18:56 -0600 Subject: [PATCH 4/6] Fix GT2560 A+ servo pin --- Marlin/src/pins/pins_GT2560_REV_A.h | 5 ++++- Marlin/src/pins/pins_GT2560_REV_A_PLUS.h | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/pins_GT2560_REV_A.h b/Marlin/src/pins/pins_GT2560_REV_A.h index 125acf8419..cb4892015e 100644 --- a/Marlin/src/pins/pins_GT2560_REV_A.h +++ b/Marlin/src/pins/pins_GT2560_REV_A.h @@ -30,8 +30,11 @@ #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." #endif -#define BOARD_NAME "GT2560 Rev.A" +#ifndef BOARD_NAME + #define BOARD_NAME "GT2560 Rev.A" +#endif #define DEFAULT_MACHINE_NAME "Prusa i3 Pro B" + // // Limit Switches // diff --git a/Marlin/src/pins/pins_GT2560_REV_A_PLUS.h b/Marlin/src/pins/pins_GT2560_REV_A_PLUS.h index 16660e0d16..99399e34ba 100644 --- a/Marlin/src/pins/pins_GT2560_REV_A_PLUS.h +++ b/Marlin/src/pins/pins_GT2560_REV_A_PLUS.h @@ -24,13 +24,12 @@ * Geeetech GT2560 Revision A+ board pin assignments */ -#include "pins_GT2560_REV_A.h" +#define BOARD_NAME "GT2560 Rev.A+" -#undef BOARD_NAME -#define BOARD_NAME "GT2560 Rev.A+" +#include "pins_GT2560_REV_A.h" #if ENABLED(BLTOUCH) - #define SERVO0_PIN 32 -#else #define SERVO0_PIN 11 +#else + #define SERVO0_PIN 32 #endif From 4b49ea1e92d2963f261bfc7ea1233b49200407af Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2017 03:32:31 -0600 Subject: [PATCH 5/6] General cleanup of config-store, reset_bed_level --- Marlin/src/feature/bedlevel/bedlevel.cpp | 28 ++++---- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 7 +- Marlin/src/gcode/bedlevel/M420.cpp | 2 +- Marlin/src/lcd/ultralcd.cpp | 2 +- Marlin/src/module/configuration_store.cpp | 71 ++++++++++----------- Marlin/src/module/configuration_store.h | 16 ++--- 6 files changed, 61 insertions(+), 65 deletions(-) diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index c6c96081e3..84c16f5484 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -173,27 +173,25 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) { * Reset calibration results to zero. */ void reset_bed_level() { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("reset_bed_level"); + #endif set_bed_leveling_enabled(false); #if ENABLED(MESH_BED_LEVELING) if (leveling_is_valid()) { mbl.reset(); mbl.has_mesh = false; } - #else - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("reset_bed_level"); - #endif - #if ABL_PLANAR - planner.bed_level_matrix.set_to_identity(); - #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - bilinear_start[X_AXIS] = bilinear_start[Y_AXIS] = - bilinear_grid_spacing[X_AXIS] = bilinear_grid_spacing[Y_AXIS] = 0; - for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) - for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) - z_values[x][y] = NAN; - #elif ENABLED(AUTO_BED_LEVELING_UBL) - ubl.reset(); - #endif + #elif ENABLED(AUTO_BED_LEVELING_UBL) + ubl.reset(); + #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) + bilinear_start[X_AXIS] = bilinear_start[Y_AXIS] = + bilinear_grid_spacing[X_AXIS] = bilinear_grid_spacing[Y_AXIS] = 0; + for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) + z_values[x][y] = NAN; + #elif ABL_PLANAR + planner.bed_level_matrix.set_to_identity(); #endif } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index e70ff6121c..9c8e452076 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -310,7 +310,8 @@ void unified_bed_leveling::G29() { if (!settings.calc_num_meshes()) { - SERIAL_PROTOCOLLNPGM("?Enable EEPROM and init with M502, M500.\n"); + SERIAL_PROTOCOLLNPGM("?Enable EEPROM and init with"); + SERIAL_PROTOCOLLNPGM("M502, M500, M501 in that order.\n"); return; } @@ -608,7 +609,7 @@ if (parser.seen('L')) { // Load Current Mesh Data g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot; - int16_t a = settings.calc_num_meshes(); + uint16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); @@ -650,7 +651,7 @@ return; } - int16_t a = settings.calc_num_meshes(); + uint16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index 740b632544..85b016f18d 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -54,7 +54,7 @@ void GcodeSuite::M420() { #if ENABLED(EEPROM_SETTINGS) const int8_t storage_slot = parser.has_value() ? parser.value_int() : ubl.storage_slot; - const int16_t a = settings.calc_num_meshes(); + const uint16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index e8ab943ede..105916be45 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -2285,7 +2285,7 @@ void kill_screen(const char* lcd_msg) { * Save Bed Mesh */ void _lcd_ubl_storage_mesh() { - int16_t a = settings.calc_num_meshes(); + uint16_t a = settings.calc_num_meshes(); START_MENU(); MENU_BACK(MSG_UBL_LEVEL_BED); if (!WITHIN(ubl_storage_slot, 0, a - 1)) { diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index d6252eb2c3..f697666756 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -141,7 +141,7 @@ * 539 M200 D parser.volumetric_enabled (bool) * 540 M200 T D planner.filament_size (float x5) (T0..3) * - * HAVE_TMC2130: 22 bytes + * HAS_TRINAMIC: 22 bytes * 560 M906 X Stepper X current (uint16_t) * 562 M906 Y Stepper Y current (uint16_t) * 564 M906 Z Stepper Z current (uint16_t) @@ -155,28 +155,28 @@ * 580 M906 E4 Stepper E4 current (uint16_t) * * SENSORLESS HOMING 4 bytes - * 580 M914 X Stepper X and X2 threshold (int16_t) - * 582 M914 Y Stepper Y and Y2 threshold (int16_t) + * 582 M914 X Stepper X and X2 threshold (int16_t) + * 584 M914 Y Stepper Y and Y2 threshold (int16_t) * * LIN_ADVANCE: 8 bytes - * 582 M900 K extruder_advance_k (float) - * 586 M900 WHD advance_ed_ratio (float) + * 586 M900 K extruder_advance_k (float) + * 590 M900 WHD advance_ed_ratio (float) * * HAS_MOTOR_CURRENT_PWM: - * 590 M907 X Stepper XY current (uint32_t) - * 594 M907 Z Stepper Z current (uint32_t) - * 598 M907 E Stepper E current (uint32_t) + * 594 M907 X Stepper XY current (uint32_t) + * 598 M907 Z Stepper Z current (uint32_t) + * 602 M907 E Stepper E current (uint32_t) * * CNC_COORDINATE_SYSTEMS 108 bytes - * 602 G54-G59.3 coordinate_system (float x 27) + * 606 G54-G59.3 coordinate_system (float x 27) * * SKEW_CORRECTION: 12 bytes - * 710 M852 I planner.xy_skew_factor (float) - * 714 M852 J planner.xz_skew_factor (float) - * 718 M852 K planner.yz_skew_factor (float) + * 714 M852 I planner.xy_skew_factor (float) + * 718 M852 J planner.xz_skew_factor (float) + * 722 M852 K planner.yz_skew_factor (float) * - * 722 Minimum end-point - * 2251 (722 + 208 + 36 + 9 + 288 + 988) Maximum end-point + * 726 Minimum end-point + * 2255 (726 + 208 + 36 + 9 + 288 + 988) Maximum end-point * * ======================================================================== * meshes_begin (between max and min end-point, directly above) @@ -290,7 +290,7 @@ void MarlinSettings::postprocess() { bool MarlinSettings::eeprom_error; #if ENABLED(AUTO_BED_LEVELING_UBL) - int MarlinSettings::meshes_begin; + int16_t MarlinSettings::meshes_begin; #endif /** @@ -1256,7 +1256,7 @@ void MarlinSettings::postprocess() { } #endif - int MarlinSettings::calc_num_meshes() { + uint16_t MarlinSettings::calc_num_meshes() { //obviously this will get more sophisticated once we've added an actual MAT if (meshes_begin <= 0) return 0; @@ -1264,10 +1264,10 @@ void MarlinSettings::postprocess() { return (meshes_end - meshes_begin) / sizeof(ubl.z_values); } - void MarlinSettings::store_mesh(int8_t slot) { + void MarlinSettings::store_mesh(const int8_t slot) { #if ENABLED(AUTO_BED_LEVELING_UBL) - const int a = calc_num_meshes(); + const int16_t a = calc_num_meshes(); if (!WITHIN(slot, 0, a - 1)) { #if ENABLED(EEPROM_CHITCHAT) ubl_invalid_slot(a); @@ -1280,11 +1280,10 @@ void MarlinSettings::postprocess() { } uint16_t crc = 0; - bool status; int pos = meshes_end - (slot + 1) * sizeof(ubl.z_values); HAL::PersistentStore::access_start(); - status = HAL::PersistentStore::write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc); + const bool status = HAL::PersistentStore::write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc); HAL::PersistentStore::access_finish(); if (status) @@ -1304,7 +1303,7 @@ void MarlinSettings::postprocess() { #endif } - void MarlinSettings::load_mesh(int8_t slot, void *into /* = 0 */) { + void MarlinSettings::load_mesh(const int8_t slot, void * const into/*=NULL*/) { #if ENABLED(AUTO_BED_LEVELING_UBL) @@ -1320,10 +1319,9 @@ void MarlinSettings::postprocess() { uint16_t crc = 0; int pos = meshes_end - (slot + 1) * sizeof(ubl.z_values); uint8_t * const dest = into ? (uint8_t*)into : (uint8_t*)&ubl.z_values; - uint16_t status; HAL::PersistentStore::access_start(); - status = HAL::PersistentStore::read_data(pos, dest, sizeof(ubl.z_values), &crc); + const uint16_t status = HAL::PersistentStore::read_data(pos, dest, sizeof(ubl.z_values), &crc); HAL::PersistentStore::access_finish(); if (status) @@ -1373,17 +1371,13 @@ void MarlinSettings::reset() { planner.retract_acceleration = DEFAULT_RETRACT_ACCELERATION; planner.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION; planner.min_feedrate_mm_s = DEFAULT_MINIMUMFEEDRATE; - planner.min_segment_time_us = DEFAULT_MINSEGMENTTIME; planner.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE; + planner.min_segment_time_us = DEFAULT_MINSEGMENTTIME; planner.max_jerk[X_AXIS] = DEFAULT_XJERK; planner.max_jerk[Y_AXIS] = DEFAULT_YJERK; planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK; planner.max_jerk[E_AXIS] = DEFAULT_EJERK; - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - new_z_fade_height = 0.0; - #endif - #if HAS_HOME_OFFSET ZERO(home_offset); #endif @@ -1405,7 +1399,14 @@ void MarlinSettings::reset() { LOOP_XYZ(i) HOTEND_LOOP() hotend_offset[i][e] = tmp4[i][e]; #endif - // Applies to all MBL and ABL + // + // Global Leveling + // + + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + new_z_fade_height = 0.0; + #endif + #if HAS_LEVELING reset_bed_level(); #endif @@ -1466,10 +1467,6 @@ void MarlinSettings::reset() { lcd_preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED; #endif - #if HAS_LCD_CONTRAST - lcd_contrast = DEFAULT_LCD_CONTRAST; - #endif - #if ENABLED(PIDTEMP) #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 HOTEND_LOOP() @@ -1493,6 +1490,10 @@ void MarlinSettings::reset() { thermalManager.bedKd = scalePID_d(DEFAULT_bedKd); #endif + #if HAS_LCD_CONTRAST + lcd_contrast = DEFAULT_LCD_CONTRAST; + #endif + #if ENABLED(FWRETRACT) fwretract.reset(); #endif @@ -1579,10 +1580,6 @@ void MarlinSettings::reset() { stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q])); #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) - ubl.reset(); - #endif - #if ENABLED(SKEW_CORRECTION_GCODE) planner.xy_skew_factor = XY_SKEW_FACTOR; #if ENABLED(SKEW_CORRECTION_FOR_Z) diff --git a/Marlin/src/module/configuration_store.h b/Marlin/src/module/configuration_store.h index e23b66a665..bee11f0c81 100644 --- a/Marlin/src/module/configuration_store.h +++ b/Marlin/src/module/configuration_store.h @@ -37,11 +37,11 @@ class MarlinSettings { #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system // That can store is enabled - FORCE_INLINE static int get_start_of_meshes() { return meshes_begin; } - FORCE_INLINE static int get_end_of_meshes() { return meshes_end; } - static int calc_num_meshes(); - static void store_mesh(int8_t slot); - static void load_mesh(int8_t slot, void *into = 0); + FORCE_INLINE static int16_t get_start_of_meshes() { return meshes_begin; } + FORCE_INLINE static int16_t get_end_of_meshes() { return meshes_end; } + static uint16_t calc_num_meshes(); + static void store_mesh(const int8_t slot); + static void load_mesh(const int8_t slot, void * const into=NULL); //static void delete_mesh(); // necessary if we have a MAT //static void defrag_meshes(); // " @@ -66,9 +66,9 @@ class MarlinSettings { #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system // That can store is enabled - static int meshes_begin; - const static int meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always - // live at the very end of the eeprom + static int16_t meshes_begin; + const static int16_t meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always + // live at the very end of the eeprom #endif From f2731c9f9355f0f3d6c029fd1f5929251fdd7179 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2017 06:32:33 -0600 Subject: [PATCH 6/6] Allow consecutive uses of G29 --- Marlin/src/gcode/bedlevel/abl/G29.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 0b32d8144f..9660322ed1 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -390,7 +390,8 @@ void GcodeSuite::G29() { stepper.synchronize(); // Disable auto bed leveling during G29 - planner.leveling_active = false; + // Be formal so G29 can be done successively without G28. + set_bed_leveling_enabled(false); if (!dryrun) { // Re-orient the current position without leveling @@ -404,7 +405,7 @@ void GcodeSuite::G29() { #if HAS_BED_PROBE // Deploy the probe. Probe will raise if needed. if (DEPLOY_PROBE()) { - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); return; } #endif @@ -421,10 +422,6 @@ void GcodeSuite::G29() { || left_probe_bed_position != bilinear_start[X_AXIS] || front_probe_bed_position != bilinear_start[Y_AXIS] ) { - if (dryrun) { - // Before reset bed level, re-enable to correct the position - planner.leveling_active = abl_should_enable; - } // Reset grid to 0.0 or "not probed". (Also disables ABL) reset_bed_level(); @@ -468,7 +465,7 @@ void GcodeSuite::G29() { #if HAS_SOFTWARE_ENDSTOPS soft_endstops_enabled = enable_soft_endstops; #endif - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); g29_in_progress = false; #if ENABLED(LCD_BED_LEVELING) lcd_wait_for_move = false; @@ -673,7 +670,7 @@ void GcodeSuite::G29() { measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); if (isnan(measured_z)) { - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); break; } @@ -709,7 +706,7 @@ void GcodeSuite::G29() { yProbe = points[i].y; measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level); if (isnan(measured_z)) { - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); break; } points[i].z = measured_z; @@ -732,7 +729,7 @@ void GcodeSuite::G29() { // Raise to _Z_CLEARANCE_DEPLOY_PROBE. Stow the probe. if (STOW_PROBE()) { - planner.leveling_active = abl_should_enable; + set_bed_leveling_enabled(abl_should_enable); measured_z = NAN; } }