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.

M145.cpp 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 PREHEAT_COUNT
  24. #include "../gcode.h"
  25. #include "../../lcd/marlinui.h"
  26. /**
  27. * M145: Set the heatup state for a material in the LCD menu
  28. *
  29. * S<material>
  30. * H<hotend temp>
  31. * B<bed temp>
  32. * F<fan speed>
  33. */
  34. void GcodeSuite::M145() {
  35. const uint8_t material = (uint8_t)parser.intval('S');
  36. if (material >= PREHEAT_COUNT)
  37. SERIAL_ERROR_MSG(STR_ERR_MATERIAL_INDEX);
  38. else {
  39. preheat_t &mat = ui.material_preset[material];
  40. #if HAS_HOTEND
  41. if (parser.seenval('H'))
  42. mat.hotend_temp = constrain(parser.value_int(), EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT));
  43. #endif
  44. #if HAS_HEATED_BED
  45. if (parser.seenval('B'))
  46. mat.bed_temp = constrain(parser.value_int(), BED_MINTEMP, BED_MAX_TARGET);
  47. #endif
  48. #if HAS_FAN
  49. if (parser.seenval('F'))
  50. mat.fan_speed = constrain(parser.value_int(), 0, 255);
  51. #endif
  52. }
  53. }
  54. #endif // PREHEAT_COUNT