My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

M73.cpp 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfig.h"
  23. #if ENABLED(SET_PROGRESS_MANUALLY)
  24. #include "../gcode.h"
  25. #include "../../lcd/marlinui.h"
  26. #include "../../sd/cardreader.h"
  27. #include "../../libs/numtostr.h"
  28. #if ENABLED(DWIN_LCD_PROUI)
  29. #include "../../lcd/e3v2/proui/dwin.h"
  30. #endif
  31. #if ENABLED(M73_REPORT)
  32. #define M73_REPORT_PRUSA
  33. #endif
  34. /**
  35. * M73: Set percentage complete (for display on LCD)
  36. *
  37. * Example:
  38. * M73 P25.63 ; Set progress to 25.63%
  39. * M73 R456 ; Set remaining time to 456 minutes
  40. * M73 C12 ; Set next interaction countdown to 12 minutes
  41. * M73 ; Report current values
  42. *
  43. * Use a shorter-than-Průša report format:
  44. * M73 Percent done: ---%; Time left: -----m; Change: -----m;
  45. *
  46. * When PRINT_PROGRESS_SHOW_DECIMALS is enabled - reports percent with 100 / 23.4 / 3.45 format
  47. *
  48. */
  49. void GcodeSuite::M73() {
  50. #if ENABLED(DWIN_LCD_PROUI)
  51. DWIN_M73();
  52. #else
  53. #if ENABLED(SET_PROGRESS_PERCENT)
  54. if (parser.seenval('P'))
  55. ui.set_progress((PROGRESS_SCALE) > 1
  56. ? parser.value_float() * (PROGRESS_SCALE)
  57. : parser.value_byte()
  58. );
  59. #endif
  60. #if ENABLED(SET_REMAINING_TIME)
  61. if (parser.seenval('R')) ui.set_remaining_time(60 * parser.value_ulong());
  62. #endif
  63. #if ENABLED(SET_INTERACTION_TIME)
  64. if (parser.seenval('C')) ui.set_interaction_time(60 * parser.value_ulong());
  65. #endif
  66. #endif
  67. #if ENABLED(M73_REPORT)
  68. {
  69. SERIAL_ECHO_MSG(
  70. TERN(M73_REPORT_PRUSA, "M73 Percent done: ", "Progress: ")
  71. , TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(ui.get_progress_permyriad()), ui.get_progress_percent())
  72. #if ENABLED(SET_REMAINING_TIME)
  73. , TERN(M73_REPORT_PRUSA, "; Print time remaining in mins: ", "%; Time left: "), ui.remaining_time / 60
  74. #endif
  75. #if ENABLED(SET_INTERACTION_TIME)
  76. , TERN(M73_REPORT_PRUSA, "; Change in mins: ", "m; Change: "), ui.interaction_time / 60
  77. #endif
  78. , TERN(M73_REPORT_PRUSA, ";", "m")
  79. );
  80. }
  81. #endif
  82. }
  83. #endif // SET_PROGRESS_MANUALLY