My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

M303.cpp 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 HAS_PID_HEATING
  24. #include "../gcode.h"
  25. #include "../../lcd/marlinui.h"
  26. #include "../../module/temperature.h"
  27. #if ENABLED(EXTENSIBLE_UI)
  28. #include "../../lcd/extui/ui_api.h"
  29. #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
  30. #include "../../lcd/e3v2/proui/dwin.h"
  31. #endif
  32. /**
  33. * M303: PID relay autotune
  34. *
  35. * S<temperature> Set the target temperature. (Default: 150C / 70C)
  36. * E<extruder> Extruder number to tune, or -1 for the bed. (Default: E0)
  37. * C<cycles> Number of times to repeat the procedure. (Minimum: 3, Default: 5)
  38. * U<bool> Flag to apply the result to the current PID values
  39. *
  40. * With PID_DEBUG, PID_BED_DEBUG, or PID_CHAMBER_DEBUG:
  41. * D Toggle PID debugging and EXIT without further action.
  42. */
  43. void GcodeSuite::M303() {
  44. #if ANY(PID_DEBUG, PID_BED_DEBUG, PID_CHAMBER_DEBUG)
  45. if (parser.seen_test('D')) {
  46. thermalManager.pid_debug_flag ^= true;
  47. SERIAL_ECHO_START();
  48. SERIAL_ECHOPGM("PID Debug ");
  49. serialprintln_onoff(thermalManager.pid_debug_flag);
  50. return;
  51. }
  52. #endif
  53. const heater_id_t hid = (heater_id_t)parser.intval('E');
  54. celsius_t default_temp;
  55. switch (hid) {
  56. #if ENABLED(PIDTEMP)
  57. case 0 ... HOTENDS - 1: default_temp = PREHEAT_1_TEMP_HOTEND; break;
  58. #endif
  59. #if ENABLED(PIDTEMPBED)
  60. case H_BED: default_temp = PREHEAT_1_TEMP_BED; break;
  61. #endif
  62. #if ENABLED(PIDTEMPCHAMBER)
  63. case H_CHAMBER: default_temp = PREHEAT_1_TEMP_CHAMBER; break;
  64. #endif
  65. default:
  66. SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID);
  67. TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM));
  68. TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_BAD_EXTRUDER_NUM));
  69. return;
  70. }
  71. const bool seenC = parser.seenval('C');
  72. const int c = seenC ? parser.value_int() : 5;
  73. const bool seenS = parser.seenval('S');
  74. const celsius_t temp = seenS ? parser.value_celsius() : default_temp;
  75. const bool u = parser.boolval('U');
  76. #if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
  77. if (seenC) HMI_data.PidCycles = c;
  78. if (seenS) { if (hid == H_BED) HMI_data.BedPidT = temp; else HMI_data.HotendPidT = temp; }
  79. #endif
  80. #if DISABLED(BUSY_WHILE_HEATING)
  81. KEEPALIVE_STATE(NOT_BUSY);
  82. #endif
  83. LCD_MESSAGE(MSG_PID_AUTOTUNE);
  84. thermalManager.PID_autotune(temp, hid, c, u);
  85. ui.reset_status();
  86. }
  87. #endif // HAS_PID_HEATING