My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

temperature.h 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. // public functions
  24. void tp_init(); //initialise the heating
  25. void manage_heater(); //it is critical that this is called periodically.
  26. enum TempSensor {TEMPSENSOR_HOTEND_0=0,TEMPSENSOR_BED=1, TEMPSENSOR_HOTEND_1=2};
  27. //low leven conversion routines
  28. // do not use this routines and variables outsie of temperature.cpp
  29. int temp2analog(int celsius);
  30. int temp2analogBed(int celsius);
  31. float analog2temp(int raw);
  32. float analog2tempBed(int raw);
  33. extern int target_raw[3];
  34. extern int current_raw[3];
  35. extern float Kp,Ki,Kd,Kc;
  36. #ifdef PIDTEMP
  37. extern float pid_setpoint ;
  38. #endif
  39. #ifdef WATCHPERIOD
  40. extern int watch_raw[3] ;
  41. extern unsigned long watchmillis;
  42. #endif
  43. //high level conversion routines, for use outside of temperature.cpp
  44. //inline so that there is no performance decrease.
  45. //deg=degreeCelsius
  46. inline float degHotend0(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};
  47. inline float degHotend1(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};
  48. inline float degBed() { return analog2tempBed(current_raw[TEMPSENSOR_BED]);};
  49. inline float degTargetHotend0() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};
  50. inline float degTargetHotend1() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};
  51. inline float degTargetBed() { return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
  52. inline void setTargetHotend0(const float &celsius)
  53. {
  54. target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);
  55. #ifdef PIDTEMP
  56. pid_setpoint = celsius;
  57. #endif //PIDTEMP
  58. };
  59. inline void setTargetHotend1(const float &celsius) { target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
  60. inline void setTargetBed(const float &celsius) { target_raw[TEMPSENSOR_BED ]=temp2analogBed(celsius);};
  61. inline bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
  62. inline bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
  63. inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
  64. inline bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
  65. inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
  66. inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
  67. void disable_heater();
  68. void setWatch();
  69. void updatePID();
  70. #endif