My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

temperature.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. temperature.h - temperature controller
  3. Part of Marlin
  4. Copyright (c) 2011 Erik van der Zalm
  5. Grbl 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. Grbl 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 Grbl. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef temperature_h
  17. #define temperature_h
  18. #include "Marlin.h"
  19. #include "fastio.h"
  20. #ifdef PID_ADD_EXTRUSION_RATE
  21. #include "stepper.h"
  22. #endif
  23. void tp_init(); //initialise the heating
  24. void manage_heater(); //it is critical that this is called periodically.
  25. enum TempSensor {TEMPSENSOR_HOTEND_0=0,TEMPSENSOR_BED=1, TEMPSENSOR_HOTEND_1=2};
  26. //low leven conversion routines
  27. // do not use this routines and variables outsie of temperature.cpp
  28. int temp2analog(int celsius);
  29. int temp2analogBed(int celsius);
  30. float analog2temp(int raw);
  31. float analog2tempBed(int raw);
  32. extern int target_raw[3];
  33. extern int current_raw[3];
  34. extern float Kp,Ki,Kd,Kc;
  35. #ifdef PIDTEMP
  36. extern float pid_setpoint ;
  37. #endif
  38. #ifdef WATCHPERIOD
  39. extern int watch_raw[3] ;
  40. extern unsigned long watchmillis;
  41. #endif
  42. //high level conversion routines, for use outside of temperature.cpp
  43. //inline so that there is no performance decrease.
  44. //deg=degreeCelsius
  45. inline float degHotend0(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};
  46. inline float degHotend1(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};
  47. inline float degBed() { return analog2tempBed(current_raw[TEMPSENSOR_BED]);};
  48. inline float degTargetHotend0() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};
  49. inline float degTargetHotend1() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};
  50. inline float degTargetBed() { return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
  51. inline void setTargetHotend0(float celsius)
  52. {
  53. target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);
  54. #ifdef PIDTEMP
  55. pid_setpoint = celsius;
  56. #endif //PIDTEMP
  57. };
  58. inline void setTargetHotend1(float celsius) { target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
  59. inline void setTargetBed(float celsius) { target_raw[TEMPSENSOR_BED ]=temp2analogBed(celsius);};
  60. inline bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
  61. inline bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
  62. inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
  63. inline bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
  64. inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
  65. inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
  66. void disable_heater();
  67. void setWatch();
  68. #ifdef HEATER_0_USES_THERMISTOR
  69. #define HEATERSOURCE 1
  70. #endif
  71. #ifdef BED_USES_THERMISTOR
  72. #define BEDSOURCE 1
  73. #endif
  74. #endif