My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

temperature.cpp 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*
  2. temperature.c - temperature control
  3. Part of Marlin
  4. Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. /*
  17. This firmware is a mashup between Sprinter and grbl.
  18. (https://github.com/kliment/Sprinter)
  19. (https://github.com/simen/grbl/tree)
  20. It has preliminary support for Matthew Roberts advance algorithm
  21. http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
  22. This firmware is optimized for gen6 electronics.
  23. */
  24. #include <avr/pgmspace.h>
  25. #include "fastio.h"
  26. #include "Configuration.h"
  27. #include "pins.h"
  28. #include "Marlin.h"
  29. #include "ultralcd.h"
  30. #include "temperature.h"
  31. #include "watchdog.h"
  32. //===========================================================================
  33. //=============================public variables============================
  34. //===========================================================================
  35. int target_raw[3] = {0, 0, 0};
  36. int current_raw[3] = {0, 0, 0};
  37. #ifdef PIDTEMP
  38. // probably used external
  39. float HeaterPower;
  40. float pid_setpoint = 0.0;
  41. float Kp=DEFAULT_Kp;
  42. float Ki=DEFAULT_Ki;
  43. float Kd=DEFAULT_Kd;
  44. #ifdef PID_ADD_EXTRUSION_RATE
  45. float Kc=DEFAULT_Kc;
  46. #endif
  47. #endif //PIDTEMP
  48. //===========================================================================
  49. //=============================private variables============================
  50. //===========================================================================
  51. static bool temp_meas_ready = false;
  52. static unsigned long previous_millis_heater, previous_millis_bed_heater;
  53. #ifdef PIDTEMP
  54. //static cannot be external:
  55. static float temp_iState = 0;
  56. static float temp_dState = 0;
  57. static float pTerm;
  58. static float iTerm;
  59. static float dTerm;
  60. //int output;
  61. static float pid_error;
  62. static float temp_iState_min;
  63. static float temp_iState_max;
  64. static float pid_input;
  65. static float pid_output;
  66. static bool pid_reset;
  67. #endif //PIDTEMP
  68. #ifdef WATCHPERIOD
  69. static int watch_raw[3] = {-1000,-1000,-1000};
  70. static unsigned long watchmillis = 0;
  71. #endif //WATCHPERIOD
  72. // Init min and max temp with extreme values to prevent false errors during startup
  73. static int minttemp_0 = 0;
  74. static int maxttemp_0 = 16383;
  75. static int minttemp_1 = 0;
  76. static int maxttemp_1 = 16383;
  77. static int bed_minttemp = 0;
  78. static int bed_maxttemp = 16383;
  79. //===========================================================================
  80. //=============================functions ============================
  81. //===========================================================================
  82. void updatePID()
  83. {
  84. #ifdef PIDTEMP
  85. temp_iState_max = PID_INTEGRAL_DRIVE_MAX / Ki;
  86. #endif
  87. }
  88. void manage_heater()
  89. {
  90. #ifdef USE_WATCHDOG
  91. wd_reset();
  92. #endif
  93. float pid_input;
  94. float pid_output;
  95. if(temp_meas_ready != true) //better readability
  96. return;
  97. CRITICAL_SECTION_START;
  98. temp_meas_ready = false;
  99. CRITICAL_SECTION_END;
  100. #ifdef PIDTEMP
  101. pid_input = analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
  102. #ifndef PID_OPENLOOP
  103. pid_error = pid_setpoint - pid_input;
  104. if(pid_error > 10){
  105. pid_output = PID_MAX;
  106. pid_reset = true;
  107. }
  108. else if(pid_error < -10) {
  109. pid_output = 0;
  110. pid_reset = true;
  111. }
  112. else {
  113. if(pid_reset == true) {
  114. temp_iState = 0.0;
  115. pid_reset = false;
  116. }
  117. pTerm = Kp * pid_error;
  118. temp_iState += pid_error;
  119. temp_iState = constrain(temp_iState, temp_iState_min, temp_iState_max);
  120. iTerm = Ki * temp_iState;
  121. //K1 defined in Configuration.h in the PID settings
  122. #define K2 (1.0-K1)
  123. dTerm = (Kd * (pid_input - temp_dState))*K2 + (K1 * dTerm);
  124. temp_dState = pid_input;
  125. // #ifdef PID_ADD_EXTRUSION_RATE
  126. // pTerm+=Kc*current_block->speed_e; //additional heating if extrusion speed is high
  127. // #endif
  128. pid_output = constrain(pTerm + iTerm - dTerm, 0, PID_MAX);
  129. }
  130. #endif //PID_OPENLOOP
  131. #ifdef PID_DEBUG
  132. //SERIAL_ECHOLN(" PIDDEBUG Input "<<pid_input<<" Output "<<pid_output" pTerm "<<pTerm<<" iTerm "<<iTerm<<" dTerm "<<dTerm);
  133. #endif //PID_DEBUG
  134. HeaterPower=pid_output;
  135. // Check if temperature is within the correct range
  136. if((current_raw[TEMPSENSOR_HOTEND_0] > minttemp_0) && (current_raw[TEMPSENSOR_HOTEND_0] < maxttemp_0)) {
  137. analogWrite(HEATER_0_PIN, pid_output);
  138. }
  139. else {
  140. analogWrite(HEATER_0_PIN, 0);
  141. }
  142. #endif //PIDTEMP
  143. #ifndef PIDTEMP
  144. // Check if temperature is within the correct range
  145. if((current_raw[TEMPSENSOR_HOTEND_0] > minttemp_0) && (current_raw[TEMPSENSOR_HOTEND_0] < maxttemp_0)) {
  146. if(current_raw[TEMPSENSOR_HOTEND_0] >= target_raw[TEMPSENSOR_HOTEND_0]) {
  147. WRITE(HEATER_0_PIN,LOW);
  148. }
  149. else {
  150. WRITE(HEATER_0_PIN,HIGH);
  151. }
  152. }
  153. else {
  154. WRITE(HEATER_0_PIN,LOW);
  155. }
  156. #endif
  157. if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
  158. return;
  159. previous_millis_bed_heater = millis();
  160. #if TEMP_1_PIN > -1
  161. // Check if temperature is within the correct range
  162. if((current_raw[TEMPSENSOR_BED] > bed_minttemp) && (current_raw[TEMPSENSOR_BED] < bed_maxttemp)) {
  163. if(current_raw[TEMPSENSOR_BED] >= target_raw[TEMPSENSOR_BED])
  164. {
  165. WRITE(HEATER_1_PIN,LOW);
  166. }
  167. else
  168. {
  169. WRITE(HEATER_1_PIN,HIGH);
  170. }
  171. }
  172. else {
  173. WRITE(HEATER_1_PIN,LOW);
  174. }
  175. #endif
  176. }
  177. #define PGM_RD_W(x) (short)pgm_read_word(&x)
  178. // Takes hot end temperature value as input and returns corresponding raw value.
  179. // For a thermistor, it uses the RepRap thermistor temp table.
  180. // This is needed because PID in hydra firmware hovers around a given analog value, not a temp value.
  181. // This function is derived from inversing the logic from a portion of getTemperature() in FiveD RepRap firmware.
  182. int temp2analog(int celsius) {
  183. #ifdef HEATER_0_USES_THERMISTOR
  184. int raw = 0;
  185. byte i;
  186. for (i=1; i<NUMTEMPS_HEATER_0; i++)
  187. {
  188. if (PGM_RD_W(heater_0_temptable[i][1]) < celsius)
  189. {
  190. raw = PGM_RD_W(heater_0_temptable[i-1][0]) +
  191. (celsius - PGM_RD_W(heater_0_temptable[i-1][1])) *
  192. (PGM_RD_W(heater_0_temptable[i][0]) - PGM_RD_W(heater_0_temptable[i-1][0])) /
  193. (PGM_RD_W(heater_0_temptable[i][1]) - PGM_RD_W(heater_0_temptable[i-1][1]));
  194. break;
  195. }
  196. }
  197. // Overflow: Set to last value in the table
  198. if (i == NUMTEMPS_HEATER_0) raw = PGM_RD_W(heater_0_temptable[i-1][0]);
  199. return (1023 * OVERSAMPLENR) - raw;
  200. #elif defined HEATER_0_USES_AD595
  201. return celsius * (1024.0 / (5.0 * 100.0) ) * OVERSAMPLENR;
  202. #endif
  203. }
  204. // Takes bed temperature value as input and returns corresponding raw value.
  205. // For a thermistor, it uses the RepRap thermistor temp table.
  206. // This is needed because PID in hydra firmware hovers around a given analog value, not a temp value.
  207. // This function is derived from inversing the logic from a portion of getTemperature() in FiveD RepRap firmware.
  208. int temp2analogBed(int celsius) {
  209. #ifdef BED_USES_THERMISTOR
  210. int raw = 0;
  211. byte i;
  212. for (i=1; i<BNUMTEMPS; i++)
  213. {
  214. if (PGM_RD_W(bedtemptable[i][1]) < celsius)
  215. {
  216. raw = PGM_RD_W(bedtemptable[i-1][0]) +
  217. (celsius - PGM_RD_W(bedtemptable[i-1][1])) *
  218. (PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0])) /
  219. (PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1]));
  220. break;
  221. }
  222. }
  223. // Overflow: Set to last value in the table
  224. if (i == BNUMTEMPS) raw = PGM_RD_W(bedtemptable[i-1][0]);
  225. return (1023 * OVERSAMPLENR) - raw;
  226. #elif defined BED_USES_AD595
  227. return lround(celsius * (1024.0 * OVERSAMPLENR/ (5.0 * 100.0) ) );
  228. #endif
  229. }
  230. // Derived from RepRap FiveD extruder::getTemperature()
  231. // For hot end temperature measurement.
  232. float analog2temp(int raw) {
  233. #ifdef HEATER_0_USES_THERMISTOR
  234. float celsius = 0;
  235. byte i;
  236. raw = (1023 * OVERSAMPLENR) - raw;
  237. for (i=1; i<NUMTEMPS_HEATER_0; i++)
  238. {
  239. if (PGM_RD_W(heater_0_temptable[i][0]) > raw)
  240. {
  241. celsius = PGM_RD_W(heater_0_temptable[i-1][1]) +
  242. (raw - PGM_RD_W(heater_0_temptable[i-1][0])) *
  243. (float)(PGM_RD_W(heater_0_temptable[i][1]) - PGM_RD_W(heater_0_temptable[i-1][1])) /
  244. (float)(PGM_RD_W(heater_0_temptable[i][0]) - PGM_RD_W(heater_0_temptable[i-1][0]));
  245. break;
  246. }
  247. }
  248. // Overflow: Set to last value in the table
  249. if (i == NUMTEMPS_HEATER_0) celsius = PGM_RD_W(heater_0_temptable[i-1][1]);
  250. return celsius;
  251. #elif defined HEATER_0_USES_AD595
  252. return raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR;
  253. #endif
  254. }
  255. // Derived from RepRap FiveD extruder::getTemperature()
  256. // For bed temperature measurement.
  257. float analog2tempBed(int raw) {
  258. #ifdef BED_USES_THERMISTOR
  259. int celsius = 0;
  260. byte i;
  261. raw = (1023 * OVERSAMPLENR) - raw;
  262. for (i=1; i<BNUMTEMPS; i++)
  263. {
  264. if (PGM_RD_W(bedtemptable[i][0]) > raw)
  265. {
  266. celsius = PGM_RD_W(bedtemptable[i-1][1]) +
  267. (raw - PGM_RD_W(bedtemptable[i-1][0])) *
  268. (PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1])) /
  269. (PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0]));
  270. break;
  271. }
  272. }
  273. // Overflow: Set to last value in the table
  274. if (i == BNUMTEMPS) celsius = PGM_RD_W(bedtemptable[i-1][1]);
  275. return celsius;
  276. #elif defined BED_USES_AD595
  277. return raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR;
  278. #endif
  279. }
  280. void tp_init()
  281. {
  282. #if (HEATER_0_PIN > -1)
  283. SET_OUTPUT(HEATER_0_PIN);
  284. #endif
  285. #if (HEATER_1_PIN > -1)
  286. SET_OUTPUT(HEATER_1_PIN);
  287. #endif
  288. #if (HEATER_2_PIN > -1)
  289. SET_OUTPUT(HEATER_2_PIN);
  290. #endif
  291. #ifdef PIDTEMP
  292. temp_iState_min = 0.0;
  293. temp_iState_max = PID_INTEGRAL_DRIVE_MAX / Ki;
  294. #endif //PIDTEMP
  295. // Set analog inputs
  296. ADCSRA = 1<<ADEN | 1<<ADSC | 1<<ADIF | 0x07;
  297. DIDR0 = 0;
  298. #ifdef DIDR2
  299. DIDR2 = 0;
  300. #endif
  301. #if (TEMP_0_PIN > -1)
  302. #if TEMP_0_PIN < 8
  303. DIDR0 |= 1 << TEMP_0_PIN;
  304. #else
  305. DIDR2 |= 1<<(TEMP_0_PIN - 8);
  306. ADCSRB = 1<<MUX5;
  307. #endif
  308. #endif
  309. #if (TEMP_1_PIN > -1)
  310. #if TEMP_1_PIN < 8
  311. DIDR0 |= 1<<TEMP_1_PIN;
  312. #else
  313. DIDR2 |= 1<<(TEMP_1_PIN - 8);
  314. ADCSRB = 1<<MUX5;
  315. #endif
  316. #endif
  317. #if (TEMP_2_PIN > -1)
  318. #if TEMP_2_PIN < 8
  319. DIDR0 |= 1 << TEMP_2_PIN;
  320. #else
  321. DIDR2 = 1<<(TEMP_2_PIN - 8);
  322. ADCSRB = 1<<MUX5;
  323. #endif
  324. #endif
  325. // Use timer0 for temperature measurement
  326. // Interleave temperature interrupt with millies interrupt
  327. OCR0B = 128;
  328. TIMSK0 |= (1<<OCIE0B);
  329. // Wait for temperature measurement to settle
  330. delay(200);
  331. #ifdef HEATER_0_MINTEMP
  332. minttemp_0 = temp2analog(HEATER_0_MINTEMP);
  333. #endif //MINTEMP
  334. #ifdef HEATER_0_MAXTEMP
  335. maxttemp_0 = temp2analog(HEATER_0_MAXTEMP);
  336. #endif //MAXTEMP
  337. #ifdef HEATER_1_MINTEMP
  338. minttemp_1 = temp2analog(HEATER_1_MINTEMP);
  339. #endif //MINTEMP
  340. #ifdef HEATER_1_MAXTEMP
  341. maxttemp_1 = temp2analog(HEATER_1_MAXTEMP);
  342. #endif //MAXTEMP
  343. #ifdef BED_MINTEMP
  344. bed_minttemp = temp2analog(BED_MINTEMP);
  345. #endif //BED_MINTEMP
  346. #ifdef BED_MAXTEMP
  347. bed_maxttemp = temp2analog(BED_MAXTEMP);
  348. #endif //BED_MAXTEMP
  349. }
  350. void setWatch()
  351. {
  352. #ifdef WATCHPERIOD
  353. if(isHeatingHotend0())
  354. {
  355. watchmillis = max(1,millis());
  356. watch_raw[TEMPSENSOR_HOTEND_0] = current_raw[TEMPSENSOR_HOTEND_0];
  357. }
  358. else
  359. {
  360. watchmillis = 0;
  361. }
  362. #endif
  363. }
  364. void disable_heater()
  365. {
  366. #if TEMP_0_PIN > -1
  367. target_raw[0]=0;
  368. #if HEATER_0_PIN > -1
  369. digitalWrite(HEATER_0_PIN,LOW);
  370. #endif
  371. #endif
  372. #if TEMP_1_PIN > -1
  373. target_raw[1]=0;
  374. #if HEATER_1_PIN > -1
  375. digitalWrite(HEATER_1_PIN,LOW);
  376. #endif
  377. #endif
  378. #if TEMP_2_PIN > -1
  379. target_raw[2]=0;
  380. #if HEATER_2_PIN > -1
  381. digitalWrite(HEATER_2_PIN,LOW);
  382. #endif
  383. #endif
  384. }
  385. // Timer 0 is shared with millies
  386. ISR(TIMER0_COMPB_vect)
  387. {
  388. //these variables are only accesible from the ISR, but static, so they don't loose their value
  389. static unsigned char temp_count = 0;
  390. static unsigned long raw_temp_0_value = 0;
  391. static unsigned long raw_temp_1_value = 0;
  392. static unsigned long raw_temp_2_value = 0;
  393. static unsigned char temp_state = 0;
  394. switch(temp_state) {
  395. case 0: // Prepare TEMP_0
  396. #if (TEMP_0_PIN > -1)
  397. #if TEMP_0_PIN > 7
  398. ADCSRB = 1<<MUX5;
  399. #endif
  400. ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
  401. ADCSRA |= 1<<ADSC; // Start conversion
  402. #endif
  403. #ifdef ULTIPANEL
  404. buttons_check();
  405. #endif
  406. temp_state = 1;
  407. break;
  408. case 1: // Measure TEMP_0
  409. #if (TEMP_0_PIN > -1)
  410. raw_temp_0_value += ADC;
  411. #endif
  412. temp_state = 2;
  413. break;
  414. case 2: // Prepare TEMP_1
  415. #if (TEMP_1_PIN > -1)
  416. #if TEMP_1_PIN > 7
  417. ADCSRB = 1<<MUX5;
  418. #endif
  419. ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07));
  420. ADCSRA |= 1<<ADSC; // Start conversion
  421. #endif
  422. #ifdef ULTIPANEL
  423. buttons_check();
  424. #endif
  425. temp_state = 3;
  426. break;
  427. case 3: // Measure TEMP_1
  428. #if (TEMP_1_PIN > -1)
  429. raw_temp_1_value += ADC;
  430. #endif
  431. temp_state = 4;
  432. break;
  433. case 4: // Prepare TEMP_2
  434. #if (TEMP_2_PIN > -1)
  435. #if TEMP_2_PIN > 7
  436. ADCSRB = 1<<MUX5;
  437. #endif
  438. ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07));
  439. ADCSRA |= 1<<ADSC; // Start conversion
  440. #endif
  441. #ifdef ULTIPANEL
  442. buttons_check();
  443. #endif
  444. temp_state = 5;
  445. break;
  446. case 5: // Measure TEMP_2
  447. #if (TEMP_2_PIN > -1)
  448. raw_temp_2_value += ADC;
  449. #endif
  450. temp_state = 0;
  451. temp_count++;
  452. break;
  453. default:
  454. SERIAL_ERROR_START;
  455. SERIAL_ERRORLNPGM("Temp measurement error!");
  456. break;
  457. }
  458. if(temp_count >= 16) // 6 ms * 16 = 96ms.
  459. {
  460. #ifdef HEATER_0_USES_AD595
  461. current_raw[0] = raw_temp_0_value;
  462. #else
  463. current_raw[0] = 16383 - raw_temp_0_value;
  464. #endif
  465. #ifdef HEATER_1_USES_AD595
  466. current_raw[2] = raw_temp_2_value;
  467. #else
  468. current_raw[2] = 16383 - raw_temp_2_value;
  469. #endif
  470. #ifdef BED_USES_AD595
  471. current_raw[1] = raw_temp_1_value;
  472. #else
  473. current_raw[1] = 16383 - raw_temp_1_value;
  474. #endif
  475. temp_meas_ready = true;
  476. temp_count = 0;
  477. raw_temp_0_value = 0;
  478. raw_temp_1_value = 0;
  479. raw_temp_2_value = 0;
  480. #ifdef HEATER_0_MAXTEMP
  481. #if (HEATER_0_PIN > -1)
  482. if(current_raw[TEMPSENSOR_HOTEND_0] >= maxttemp_0) {
  483. target_raw[TEMPSENSOR_HOTEND_0] = 0;
  484. digitalWrite(HEATER_0_PIN, 0);
  485. SERIAL_ERROR_START;
  486. SERIAL_ERRORLNPGM("Temperature extruder 0 switched off. MAXTEMP triggered !!");
  487. kill();
  488. }
  489. #endif
  490. #endif
  491. #ifdef HEATER_1_MAXTEMP
  492. #if (HEATER_1_PIN > -1)
  493. if(current_raw[TEMPSENSOR_HOTEND_1] >= maxttemp_1) {
  494. target_raw[TEMPSENSOR_HOTEND_1] = 0;
  495. digitalWrite(HEATER_2_PIN, 0);
  496. SERIAL_ERROR_START;
  497. SERIAL_ERRORLNPGM("Temperature extruder 1 switched off. MAXTEMP triggered !!");
  498. kill();
  499. }
  500. #endif
  501. #endif //MAXTEMP
  502. #ifdef HEATER_0_MINTEMP
  503. #if (HEATER_0_PIN > -1)
  504. if(current_raw[TEMPSENSOR_HOTEND_0] <= minttemp_0) {
  505. target_raw[TEMPSENSOR_HOTEND_0] = 0;
  506. digitalWrite(HEATER_0_PIN, 0);
  507. SERIAL_ERROR_START;
  508. SERIAL_ERRORLNPGM("Temperature extruder 0 switched off. MINTEMP triggered !!");
  509. kill();
  510. }
  511. #endif
  512. #endif
  513. #ifdef HEATER_1_MINTEMP
  514. #if (HEATER_2_PIN > -1)
  515. if(current_raw[TEMPSENSOR_HOTEND_1] <= minttemp_1) {
  516. target_raw[TEMPSENSOR_HOTEND_1] = 0;
  517. digitalWrite(HEATER_2_PIN, 0);
  518. SERIAL_ERROR_START;
  519. SERIAL_ERRORLNPGM("Temperature extruder 1 switched off. MINTEMP triggered !!");
  520. kill();
  521. }
  522. #endif
  523. #endif //MAXTEMP
  524. #ifdef BED_MINTEMP
  525. #if (HEATER_1_PIN > -1)
  526. if(current_raw[1] <= bed_minttemp) {
  527. target_raw[1] = 0;
  528. digitalWrite(HEATER_1_PIN, 0);
  529. SERIAL_ERROR_START;
  530. SERIAL_ERRORLNPGM("Temperatur heated bed switched off. MINTEMP triggered !!");
  531. kill();
  532. }
  533. #endif
  534. #endif
  535. #ifdef BED_MAXTEMP
  536. #if (HEATER_1_PIN > -1)
  537. if(current_raw[1] >= bed_maxttemp) {
  538. target_raw[1] = 0;
  539. digitalWrite(HEATER_1_PIN, 0);
  540. SERIAL_ERROR_START;
  541. SERIAL_ERRORLNPGM("Temperature heated bed switched off. MAXTEMP triggered !!");
  542. kill();
  543. }
  544. #endif
  545. #endif
  546. }
  547. }