diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 46292249491992e3461d243445591bb41c80d77c..edf981e0d91c044678a031a53e73d919a577fed6 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index 46292249491992e3461d243445591bb41c80d77c..edf981e0d91c044678a031a53e73d919a577fed6 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index c13082b085f3abd04899803818f77657de5e8571..52e2b10397bcc5444913afb5a614f3a4efc0829c 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index f0cc32b929c453b19bb7956b33d5ef38366ad1c9..f7ab76ebfb9c5d02c090443b1258c12e2576aabd 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index a3bdae8198f17591c8542ba245ba7dcacc7985c1..7fa232a7fb87f25550eb97d52d8749051d93269d 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index b0afce3ecd74ffffd5051da0951a6ba2ccc9b83f..d843173b1fe5a435c48180024a89f456b5d7c1b0 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index b0afce3ecd74ffffd5051da0951a6ba2ccc9b83f..d843173b1fe5a435c48180024a89f456b5d7c1b0 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 9348e57dd15562ae47be2ce42f74553bdf36fbf6..623d74615d70ba38decb34b3f4d462c66878f275 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT 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 f1f82a3296679841fa64f1a52159f6cbe0d6a5d2..a2b539197d66e413cd22181df2c0e8fbeedd8268 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index 93ddd2aba3d2c8358a8ddab7271a18eb1f9a13ff..eaceb0dcc757debde21d0c205a8f9398303d5bcc 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h index 7e635eadf05712a7c65d309c9288b2d2324735c7..ad2f1e5c921b88fca4920d214a14c3753cde7bca 100644 --- a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT 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 aa0b535291b97bb05def6316384056a82ac41012..524b7d0e61a445b23e56682d17da026d2bede046 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index 91e4f765a61816b8192604fca89f809696914324..69d29f9f3f6a0a53c8e89e1dd6e92d78c981e232 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index 999a159014aae18d580993c2555ab3b0287118b5..8105b9fcbc77e9ad5f2aedb3c01424bec95372da 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index 787eb0b7e61aa20a9accb19dd28683231044571b..fdcce8c6fd603bd3644bcf4f80b28deacc622326 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 5c750f4d5121fd8f1fb4b922c40a25eb46dd719f..7f7e751b75d1d093822e9c70089086b1fd5b3b19 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -538,6 +538,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index 0dcd3e436dd7cb20a6343054d3437198cb4de040..8baa9d9916be16b691d710100627ccb66768de71 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index e24bd36c5c63f97d5291b5ede2e09c5f382c9a43..7286846e05c2ba580967d78737ed97b8a2bac441 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT 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 aaf54049eb113375b9a5afdff2096ca07efcc5c7..81ba827c1246210355537c275b754c84bd7ac224 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 @@ -551,6 +551,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT 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 0506b2d67a9e8d1e0fe8cb4e96b1c532caa85e2b..783624974532f730580dc48941c6ad7f99a15dfe 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 @@ -551,6 +551,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index 0506b2d67a9e8d1e0fe8cb4e96b1c532caa85e2b..783624974532f730580dc48941c6ad7f99a15dfe 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -551,6 +551,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT 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 0506b2d67a9e8d1e0fe8cb4e96b1c532caa85e2b..783624974532f730580dc48941c6ad7f99a15dfe 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -551,6 +551,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT 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 97770eb3f74bdd2e9b230d8982e3594627ee686f..661bcd7deb33b5b8a588f16f68ef71854f288ccf 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -556,6 +556,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT 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 dad3190adfe43f65625ed882eef7f07ef107f3ac..f11d829d49bc2df4535e55b513cf6b6d1e9904d9 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -551,6 +551,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT 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 0f377bec48bc43b76811432dce5ecd43daa315bb..ddb4c3bc6ab9aa2f5805e4a5f90d80c608c42cef 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index a6edb67e5020e50c3005ab68259e1d81e3761fe7..911fa693ec38133a095bb086fe74ebee7f6d6fcd 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index 798f84a4f5a7fc203726f112c0c9a3c6521622dd..1253be5f55eccd82b919f12ee166b82e00d90cc7 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index b04b59276e6ad72fd765bdf6b686003465fedd6e..2e354d3128ade2dc36ad7a4ca2ec578e5d65b943 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -549,6 +549,9 @@ //#define LCD_PROGRESS_BAR_TEST #endif + // Add an 'M73' G-code to set the current percentage + //#define LCD_SET_PROGRESS_MANUALLY + // This allows hosts to request long names for files and folders with M33 //#define LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 880cf1b05969656ed3a2e03c9e04d2b6c807bd95..5c0502772a14cebf1ab852b1780191a4fd9e83f7 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -354,6 +354,10 @@ void GcodeSuite::process_next_command() { case 49: M49(); break; // M49: Turn on or off G26 debug flag for verbose output #endif + #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + case 73: M73(); break; // M73: Set progress percentage (for display on LCD) + #endif + case 75: M75(); break; // M75: Start print timer case 76: M76(); break; // M76: Pause print timer case 77: M77(); break; // M77: Stop print timer diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 39cc5a79b5a16d1ea49bd0eb8c29c2dda208e2eb..2320f838d2371915487bc1a17938b09ee44fccc7 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -437,6 +437,10 @@ private: static void M49(); #endif + #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + static void M73(); + #endif + static void M75(); static void M76(); static void M77(); diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index e509ae6a956aac4dba20e30335e3579b3cc2916f..99b4a815933086d58c45594f1d6ffa622fbb726c 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -72,6 +72,13 @@ void GcodeSuite::M115() { SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0"); #endif + // BUILD_PERCENT (M73) + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) + SERIAL_PROTOCOLLNPGM("Cap:BUILD_PERCENT:1"); + #else + SERIAL_PROTOCOLLNPGM("Cap:BUILD_PERCENT:0"); + #endif + // SOFTWARE_POWER (M80, M81) #if HAS_POWER_SWITCH SERIAL_PROTOCOLLNPGM("Cap:SOFTWARE_POWER:1"); diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp new file mode 100644 index 0000000000000000000000000000000000000000..478424318e2586215d797d87e60ab9ae9e94ad7e --- /dev/null +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -0,0 +1,48 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + +#include "../gcode.h" +#include "../../module/parser.h" +#include "../../lcd/ultralcd.h" +#include "../../sd/cardreader.h" + +/** + * M73: Set percentage complete (for display on LCD) + * + * Example: + * M73 P25 ; Set progress to 25% + * + * Notes: + * This has no effect during an SD print job + */ +void GcodeSuite::M73() { + if (!IS_SD_PRINTING && parser.seen('P')) { + progress_bar_percent = parser.value_byte(); + NOMORE(progress_bar_percent, 100); + } +} + +#endif // ULTRA_LCD && LCD_SET_PROGRESS_MANUALLY diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index dc9921f1d1e26d24f7eb5317643a651f365743d7..f9968e279874413712616e562634d7bc954d4e1e 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -83,6 +83,10 @@ char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kan uint8_t status_scroll_pos = 0; #endif +#if ENABLED(LCD_SET_PROGRESS_MANUALLY) + uint8_t progress_bar_percent; +#endif + #if ENABLED(DOGLCD) #include "ultralcd_impl_DOGM.h" #include <U8glib.h> @@ -604,36 +608,52 @@ void lcd_status_screen() { #endif #if ENABLED(LCD_PROGRESS_BAR) + + // + // HD44780 implements the following message blinking and + // message expiration because Status Line and Progress Bar + // share the same line on the display. + // + + // Set current percentage from SD when actively printing + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) + if (IS_SD_PRINTING) + progress_bar_percent = card.percentDone(); + #endif + millis_t ms = millis(); + + // If the message will blink rather than expire... #if DISABLED(PROGRESS_MSG_ONCE) - if (ELAPSED(ms, progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME)) { + if (ELAPSED(ms, progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME)) progress_bar_ms = ms; - } #endif + #if PROGRESS_MSG_EXPIRE > 0 + // Handle message expire if (expire_status_ms > 0) { - #if ENABLED(SDSUPPORT) - if (card.isFileOpen()) { - // Expire the message when printing is active - if (IS_SD_PRINTING) { - if (ELAPSED(ms, expire_status_ms)) { - lcd_status_message[0] = '\0'; - expire_status_ms = 0; - } - } - else { - expire_status_ms += LCD_UPDATE_INTERVAL; - } - } - else { + + #if DISABLED(LCD_SET_PROGRESS_MANUALLY) + const uint8_t progress_bar_percent = card.percentDone(); + #endif + + // Expire the message if a job is active and the bar has ticks + if (progress_bar_percent > 2 && !print_job_timer.isPaused()) { + if (ELAPSED(ms, expire_status_ms)) { + lcd_status_message[0] = '\0'; expire_status_ms = 0; } - #else - expire_status_ms = 0; - #endif // SDSUPPORT + } + else { + // Defer message expiration before bar appears + // and during any pause (not just SD) + expire_status_ms += LCD_UPDATE_INTERVAL; + } } - #endif + + #endif // PROGRESS_MSG_EXPIRE + #endif // LCD_PROGRESS_BAR #if ENABLED(ULTIPANEL) @@ -2860,7 +2880,7 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z) max = soft_endstop_max[Z_AXIS]; #endif - break; + default: break; } #endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 16b3998171a00239dccae0368334294789738a15..ef9bc7c2b75db7fe9ea72955c75bbdfa8851f7b7 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -63,6 +63,10 @@ void dontExpireStatus(); #endif + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) + extern uint8_t progress_bar_percent; + #endif + #if ENABLED(ADC_KEYPAD) uint8_t get_ADC_keyValue(); #endif diff --git a/Marlin/src/lcd/ultralcd_impl_DOGM.h b/Marlin/src/lcd/ultralcd_impl_DOGM.h index f9f1abcfe10142dd23a7a8d3e06d1bf2fea3acea..7e38127c1588583083b815a464a121a98f7fae85 100644 --- a/Marlin/src/lcd/ultralcd_impl_DOGM.h +++ b/Marlin/src/lcd/ultralcd_impl_DOGM.h @@ -536,7 +536,7 @@ static void lcd_implementation_status_screen() { // SD Card Symbol // - if (PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) { + if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) { // Upper box u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); // 42-48 (or 41-47) // Right edge @@ -560,7 +560,11 @@ static void lcd_implementation_status_screen() { PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION) ); - if (IS_SD_PRINTING) { + #if DISABLED(LCD_SET_PROGRESS_MANUALLY) + const uint8_t progress_bar_percent = card.percentDone(); + #endif + + if (progress_bar_percent > 1) { // // Progress bar solid part @@ -569,7 +573,7 @@ static void lcd_implementation_status_screen() { if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION))) // 50-51 (or just 50) u8g.drawBox( PROGRESS_BAR_X + 1, 50, - (uint16_t)((PROGRESS_BAR_WIDTH - 2) * card.percentDone() * 0.01), 2 - (TALL_FONT_CORRECTION) + (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION) ); // @@ -580,7 +584,7 @@ static void lcd_implementation_status_screen() { if (PAGE_CONTAINS(41, 48)) { // Percent complete u8g.setPrintPos(55, 48); - u8g.print(itostr3(card.percentDone())); + u8g.print(itostr3(progress_bar_percent)); u8g.print('%'); } #endif diff --git a/Marlin/src/lcd/ultralcd_impl_HD44780.h b/Marlin/src/lcd/ultralcd_impl_HD44780.h index 7cf64789b8df3763d2753ba397474b9116216b02..adfa5b8fa3a711a9070c1027d1a33e4a667d6d40 100644 --- a/Marlin/src/lcd/ultralcd_impl_HD44780.h +++ b/Marlin/src/lcd/ultralcd_impl_HD44780.h @@ -203,9 +203,9 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt #include "utf_mapper.h" #if ENABLED(LCD_PROGRESS_BAR) - static millis_t progress_bar_ms = 0; + static millis_t progress_bar_ms = 0; // Start millis of the current progress bar cycle #if PROGRESS_MSG_EXPIRE > 0 - static millis_t expire_status_ms = 0; + static millis_t expire_status_ms = 0; // millis at which to expire the status message #endif #define LCD_STR_PROGRESS "\x03\x04\x05" #endif @@ -842,12 +842,13 @@ static void lcd_implementation_status_screen() { #if ENABLED(LCD_PROGRESS_BAR) + #if DISABLED(LCD_SET_PROGRESS_MANUALLY) + const uint8_t progress_bar_percent = card.percentDone(); + #endif // Draw the progress bar if the message has shown long enough // or if there is no message set. - if (card.isFileOpen() && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) { - const uint8_t percent = card.percentDone(); - if (percent) return lcd_draw_progress_bar(percent); - } + if (progress_bar_percent > 2 && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) + return lcd_draw_progress_bar(progress_bar_percent); #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)