My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

M140_M190.cpp 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. /**
  23. * gcode/temp/M140_M190.cpp
  24. *
  25. * Bed target temperature control
  26. */
  27. #include "../../inc/MarlinConfig.h"
  28. #if HAS_HEATED_BED
  29. #include "../gcode.h"
  30. #include "../../module/temperature.h"
  31. #include "../../lcd/marlinui.h"
  32. /**
  33. * M140 - Set Bed Temperature target and return immediately
  34. * M190 - Set Bed Temperature target and wait
  35. *
  36. * I<index> : Preset index (if material presets are defined)
  37. * S<target> : The target temperature in current units
  38. *
  39. * Parameters
  40. * I<index> : Preset index (if material presets are defined)
  41. * S<target> : The target temperature in current units. Wait for heating only.
  42. *
  43. * M190 Parameters
  44. * R<target> : The target temperature in current units. Wait for heating and cooling.
  45. *
  46. * Examples
  47. * M140 S60 : Set target to 60° and return right away.
  48. * M190 R40 : Set target to 40°. Wait until the bed gets close to 40°.
  49. *
  50. * With PRINTJOB_TIMER_AUTOSTART turning on heaters will start the print job timer
  51. * (used by printingIsActive, etc.) and turning off heaters will stop the timer.
  52. */
  53. void GcodeSuite::M140_M190(const bool isM190) {
  54. if (DEBUGGING(DRYRUN)) return;
  55. bool got_temp = false;
  56. celsius_t temp = 0;
  57. // Accept 'I' if temperature presets are defined
  58. #if HAS_PREHEAT
  59. got_temp = parser.seenval('I');
  60. if (got_temp) {
  61. const uint8_t index = parser.value_byte();
  62. temp = ui.material_preset[_MIN(index, PREHEAT_COUNT - 1)].bed_temp;
  63. }
  64. #endif
  65. // Get the temperature from 'S' or 'R'
  66. bool no_wait_for_cooling = false;
  67. if (!got_temp) {
  68. no_wait_for_cooling = parser.seenval('S');
  69. got_temp = no_wait_for_cooling || (isM190 && parser.seenval('R'));
  70. if (got_temp) temp = parser.value_celsius();
  71. }
  72. if (!got_temp) return;
  73. thermalManager.setTargetBed(temp);
  74. thermalManager.isHeatingBed() ? LCD_MESSAGE(MSG_BED_HEATING) : LCD_MESSAGE(MSG_BED_COOLING);
  75. // With PRINTJOB_TIMER_AUTOSTART, M190 can start the timer, and M140 can stop it
  76. TERN_(PRINTJOB_TIMER_AUTOSTART, thermalManager.auto_job_check_timer(isM190, !isM190));
  77. if (isM190)
  78. thermalManager.wait_for_bed(no_wait_for_cooling);
  79. }
  80. #endif // HAS_HEATED_BED