Prusa MINI Firmware overview
temperature.h
Go to the documentation of this file.
1 /**
2  * Marlin 3D Printer Firmware
3  * Copyright (c) 2019 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 <http://www.gnu.org/licenses/>.
20  *
21  */
22 #pragma once
23 
24 /**
25  * temperature.h - temperature controller
26  */
27 
28 #include "thermistor/thermistors.h"
29 
30 #include "../inc/MarlinConfig.h"
31 
32 #if ENABLED(AUTO_POWER_CONTROL)
33  #include "../feature/power.h"
34 #endif
35 
36 #ifndef SOFT_PWM_SCALE
37  #define SOFT_PWM_SCALE 0
38 #endif
39 
40 #if HOTENDS <= 1
41  #define HOTEND_INDEX 0
42  #define E_NAME
43 #else
44  #define HOTEND_INDEX e
45  #define E_NAME e
46 #endif
47 
48 // Identifiers for other heaters
49 typedef enum : int8_t {
50  INDEX_NONE = -4,
53 } heater_ind_t;
54 
55 // PID storage
56 typedef struct { float Kp, Ki, Kd; } PID_t;
57 typedef struct { float Kp, Ki, Kd, Kc; } PIDC_t;
58 #if ENABLED(PID_EXTRUSION_SCALING)
59  typedef PIDC_t hotend_pid_t;
60  #if LPQ_MAX_LEN > 255
61  typedef uint16_t lpq_ptr_t;
62  #else
63  typedef uint8_t lpq_ptr_t;
64  #endif
65 #else
67 #endif
68 
69 #define DUMMY_PID_VALUE 3000.0f
70 
71 #if ENABLED(PIDTEMP)
72  #define _PID_Kp(H) Temperature::temp_hotend[H].pid.Kp
73  #define _PID_Ki(H) Temperature::temp_hotend[H].pid.Ki
74  #define _PID_Kd(H) Temperature::temp_hotend[H].pid.Kd
75  #if ENABLED(PID_EXTRUSION_SCALING)
76  #define _PID_Kc(H) Temperature::temp_hotend[H].pid.Kc
77  #else
78  #define _PID_Kc(H) 1
79  #endif
80 #else
81  #define _PID_Kp(H) DUMMY_PID_VALUE
82  #define _PID_Ki(H) DUMMY_PID_VALUE
83  #define _PID_Kd(H) DUMMY_PID_VALUE
84  #define _PID_Kc(H) 1
85 #endif
86 
87 #define PID_PARAM(F,H) _PID_##F(H)
88 
89 /**
90  * States for ADC reading in the ISR
91  */
92 enum ADCSensorState : char {
94  #if HAS_TEMP_ADC_0
95  PrepareTemp_0, MeasureTemp_0,
96  #endif
97  #if HAS_HEATED_BED
98  PrepareTemp_BED, MeasureTemp_BED,
99  #endif
100  #if HAS_TEMP_CHAMBER
101  PrepareTemp_CHAMBER, MeasureTemp_CHAMBER,
102  #endif
103  #if HAS_TEMP_ADC_1
104  PrepareTemp_1, MeasureTemp_1,
105  #endif
106  #if HAS_TEMP_ADC_2
107  PrepareTemp_2, MeasureTemp_2,
108  #endif
109  #if HAS_TEMP_ADC_3
110  PrepareTemp_3, MeasureTemp_3,
111  #endif
112  #if HAS_TEMP_ADC_4
113  PrepareTemp_4, MeasureTemp_4,
114  #endif
115  #if HAS_TEMP_ADC_5
116  PrepareTemp_5, MeasureTemp_5,
117  #endif
118  #if HAS_JOY_ADC_X
119  PrepareJoy_X, MeasureJoy_X,
120  #endif
121  #if HAS_JOY_ADC_Y
122  PrepareJoy_Y, MeasureJoy_Y,
123  #endif
124  #if HAS_JOY_ADC_Z
125  PrepareJoy_Z, MeasureJoy_Z,
126  #endif
127  #if ENABLED(FILAMENT_WIDTH_SENSOR)
128  Prepare_FILWIDTH, Measure_FILWIDTH,
129  #endif
130  #if HAS_ADC_BUTTONS
131  Prepare_ADC_KEY, Measure_ADC_KEY,
132  #endif
133  SensorsReady, // Temperatures ready. Delay the next round of readings to let ADC pins settle.
134  StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle
135 };
136 
137 // Minimum number of Temperature::ISR loops between sensor readings.
138 // Multiplied by 16 (OVERSAMPLENR) to obtain the total time to
139 // get all oversampled sensor readings
140 #define MIN_ADC_ISR_LOOPS 10
141 
142 #define ACTUAL_ADC_SAMPLES _MAX(int(MIN_ADC_ISR_LOOPS), int(SensorsReady))
143 
144 #if HAS_PID_HEATING
145  #define PID_K2 (1-float(PID_K1))
146  #define PID_dT ((OVERSAMPLENR * float(ACTUAL_ADC_SAMPLES)) / TEMP_TIMER_FREQUENCY)
147 
148  // Apply the scale factors to the PID values
149  #define scalePID_i(i) ( float(i) * PID_dT )
150  #define unscalePID_i(i) ( float(i) / PID_dT )
151  #define scalePID_d(d) ( float(d) / PID_dT )
152  #define unscalePID_d(d) ( float(d) * PID_dT )
153 #endif
154 
155 #define G26_CLICK_CAN_CANCEL (HAS_LCD_MENU && ENABLED(G26_MESH_VALIDATION))
156 
157 // A temperature sensor
158 typedef struct TempInfo {
159  uint16_t acc;
160  int16_t raw;
161  float celsius;
162  inline void reset() { acc = 0; }
163  inline void sample(const uint16_t s) { acc += s; }
164  inline void update() { raw = acc; }
165 } temp_info_t;
166 
167 // A PWM heater with temperature sensor
168 typedef struct HeaterInfo : public TempInfo {
169  int16_t target;
171 } heater_info_t;
172 
173 // A heater with PID stabilization
174 template<typename T>
175 struct PIDHeaterInfo : public HeaterInfo {
176  T pid; // Initialized by settings.load()
177 };
178 
179 #if ENABLED(PIDTEMP)
180  typedef struct PIDHeaterInfo<hotend_pid_t> hotend_info_t;
181 #else
183 #endif
184 #if HAS_HEATED_BED
185  #if ENABLED(PIDTEMPBED)
186  typedef struct PIDHeaterInfo<PID_t> bed_info_t;
187  #else
188  typedef heater_info_t bed_info_t;
189  #endif
190 #endif
191 #if HAS_HEATED_CHAMBER
192  typedef heater_info_t chamber_info_t;
193 #elif HAS_TEMP_CHAMBER
194  typedef temp_info_t chamber_info_t;
195 #endif
196 
197 // Heater idle handling
198 typedef struct {
200  bool timed_out;
201  inline void update(const millis_t &ms) { if (!timed_out && timeout_ms && ELAPSED(ms, timeout_ms)) timed_out = true; }
202  inline void start(const millis_t &ms) { timeout_ms = millis() + ms; timed_out = false; }
203  inline void reset() { timeout_ms = 0; timed_out = false; }
204  inline void expire() { start(0); }
205 } heater_idle_t;
206 
207 // Heater watch handling
208 typedef struct {
209  uint16_t target;
211  inline bool elapsed(const millis_t &ms) { return next_ms && ELAPSED(ms, next_ms); }
212  inline bool elapsed() { return elapsed(millis()); }
214 
215 // Temperature sensor read value ranges
216 typedef struct { int16_t raw_min, raw_max; } raw_range_t;
217 typedef struct { int16_t mintemp, maxtemp; } celsius_range_t;
218 typedef struct { int16_t raw_min, raw_max, mintemp, maxtemp; } temp_range_t;
219 
220 #define THERMISTOR_ADC_RESOLUTION 1024 // 10-bit ADC .. shame to waste 12-bits of resolution on 32-bit
221 #define THERMISTOR_ABS_ZERO_C -273.15f // bbbbrrrrr cold !
222 #define THERMISTOR_RESISTANCE_NOMINAL_C 25.0f // mmmmm comfortable
223 
224 #if HAS_USER_THERMISTORS
225 
226  enum CustomThermistorIndex : uint8_t {
227  #if ENABLED(HEATER_0_USER_THERMISTOR)
228  CTI_HOTEND_0,
229  #endif
230  #if ENABLED(HEATER_1_USER_THERMISTOR)
231  CTI_HOTEND_1,
232  #endif
233  #if ENABLED(HEATER_2_USER_THERMISTOR)
234  CTI_HOTEND_2,
235  #endif
236  #if ENABLED(HEATER_3_USER_THERMISTOR)
237  CTI_HOTEND_3,
238  #endif
239  #if ENABLED(HEATER_4_USER_THERMISTOR)
240  CTI_HOTEND_4,
241  #endif
242  #if ENABLED(HEATER_5_USER_THERMISTOR)
243  CTI_HOTEND_5,
244  #endif
245  #if ENABLED(HEATER_BED_USER_THERMISTOR)
246  CTI_BED,
247  #endif
248  #if ENABLED(HEATER_CHAMBER_USER_THERMISTOR)
249  CTI_CHAMBER,
250  #endif
251  USER_THERMISTORS
252  };
253 
254  // User-defined thermistor
255  typedef struct {
256  bool pre_calc; // true if pre-calculations update needed
257  float sh_c_coeff, // Steinhart-Hart C coefficient .. defaults to '0.0'
258  sh_alpha,
259  series_res,
260  res_25, res_25_recip,
261  res_25_log,
262  beta, beta_recip;
263  } user_thermistor_t;
264 
265 #endif
266 
267 class Temperature {
268 
269  public:
270 
271  static volatile bool in_temp_isr;
272 
273  #if HOTENDS
274  #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
275  #define HOTEND_TEMPS (HOTENDS + 1)
276  #else
277  #define HOTEND_TEMPS HOTENDS
278  #endif
279  static hotend_info_t temp_hotend[HOTEND_TEMPS];
280  #endif
281 
282  #if HAS_HEATED_BED
283  static bed_info_t temp_bed;
284  #endif
285 
286  #if HAS_TEMP_CHAMBER
287  static chamber_info_t temp_chamber;
288  #endif
289 
290  #if ENABLED(AUTO_POWER_E_FANS)
291  static uint8_t autofan_speed[HOTENDS];
292  #endif
293 
294  #if ENABLED(AUTO_POWER_CHAMBER_FAN)
295  static uint8_t chamberfan_speed;
296  #endif
297 
298  #if ENABLED(FAN_SOFT_PWM)
299  static uint8_t soft_pwm_amount_fan[FAN_COUNT],
300  soft_pwm_count_fan[FAN_COUNT];
301  #endif
302 
303  #if ENABLED(PREVENT_COLD_EXTRUSION)
304  static bool allow_cold_extrude;
305  static int16_t extrude_min_temp;
306  FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; }
307  FORCE_INLINE static bool tooColdToExtrude(const uint8_t E_NAME) {
308  return tooCold(degHotend(HOTEND_INDEX));
309  }
311  return tooCold(degTargetHotend(HOTEND_INDEX));
312  }
313  #else
314  FORCE_INLINE static bool tooColdToExtrude(const uint8_t) { return false; }
315  FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t) { return false; }
316  #endif
317 
318  FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
320 
321  #if HEATER_IDLE_HANDLER
323  #if HAS_HEATED_BED
325  #endif
326  #if HAS_HEATED_CHAMBER
328  #endif
329  #endif
330 
331  private:
332 
333  #if EARLY_WATCHDOG
334  static bool inited; // If temperature controller is running
335  #endif
336 
337  static volatile bool temp_meas_ready;
338 
339  #if WATCH_HOTENDS
340  static heater_watch_t watch_hotend[HOTENDS];
341  #endif
342 
343  #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
344  static uint16_t redundant_temperature_raw;
345  static float redundant_temperature;
346  #endif
347 
348  #if ENABLED(PID_EXTRUSION_SCALING)
349  static int32_t last_e_position, lpq[LPQ_MAX_LEN];
350  static lpq_ptr_t lpq_ptr;
351  #endif
352 
353  #if HOTENDS
354  static temp_range_t temp_range[HOTENDS];
355  #endif
356 
357  #if HAS_HEATED_BED
358  #if WATCH_BED
359  static heater_watch_t watch_bed;
360  #endif
361  #if DISABLED(PIDTEMPBED)
362  static millis_t next_bed_check_ms;
363  #endif
364  #ifdef BED_MINTEMP
365  static int16_t mintemp_raw_BED;
366  #endif
367  #ifdef BED_MAXTEMP
368  static int16_t maxtemp_raw_BED;
369  #endif
370  #endif
371 
372  #if HAS_HEATED_CHAMBER
373  #if WATCH_CHAMBER
374  static heater_watch_t watch_chamber;
375  #endif
376  static millis_t next_chamber_check_ms;
377  #ifdef CHAMBER_MINTEMP
378  static int16_t mintemp_raw_CHAMBER;
379  #endif
380  #ifdef CHAMBER_MAXTEMP
381  static int16_t maxtemp_raw_CHAMBER;
382  #endif
383  #endif
384 
385  #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
386  static uint8_t consecutive_low_temperature_error[HOTENDS];
387  #endif
388 
389  #ifdef MILLISECONDS_PREHEAT_TIME
390  static millis_t preheat_end_time[HOTENDS];
391  #endif
392 
393  #if HAS_AUTO_FAN
394  static millis_t next_auto_fan_check_ms;
395  #endif
396 
397  #if ENABLED(PROBING_HEATERS_OFF)
398  static bool paused;
399  #endif
400 
401  public:
402  #if HAS_ADC_BUTTONS
403  static uint32_t current_ADCKey_raw;
404  static uint8_t ADCKey_count;
405  #endif
406 
407  #if ENABLED(PID_EXTRUSION_SCALING)
408  static int16_t lpq_len;
409  #endif
410 
411  /**
412  * Instance Methods
413  */
414 
415  void init();
416 
417  /**
418  * Static (class) methods
419  */
420 
421  #if HAS_USER_THERMISTORS
422  static user_thermistor_t user_thermistor[USER_THERMISTORS];
423  static void log_user_thermistor(const uint8_t t_index, const bool eprom=false);
424  static void reset_user_thermistors();
425  static float user_thermistor_to_deg_c(const uint8_t t_index, const int raw);
426  static bool set_pull_up_res(int8_t t_index, float value) {
427  //if (!WITHIN(t_index, 0, USER_THERMISTORS - 1)) return false;
428  if (!WITHIN(value, 1, 1000000)) return false;
429  user_thermistor[t_index].series_res = value;
430  return true;
431  }
432  static bool set_res25(int8_t t_index, float value) {
433  if (!WITHIN(value, 1, 10000000)) return false;
434  user_thermistor[t_index].res_25 = value;
435  user_thermistor[t_index].pre_calc = true;
436  return true;
437  }
438  static bool set_beta(int8_t t_index, float value) {
439  if (!WITHIN(value, 1, 1000000)) return false;
440  user_thermistor[t_index].beta = value;
441  user_thermistor[t_index].pre_calc = true;
442  return true;
443  }
444  static bool set_sh_coeff(int8_t t_index, float value) {
445  if (!WITHIN(value, -0.01f, 0.01f)) return false;
446  user_thermistor[t_index].sh_c_coeff = value;
447  user_thermistor[t_index].pre_calc = true;
448  return true;
449  }
450  #endif
451 
452  #if HOTENDS
453  static float analog_to_celsius_hotend(const int raw, const uint8_t e);
454  #endif
455 
456  #if HAS_HEATED_BED
457  static float analog_to_celsius_bed(const int raw);
458  #endif
459  #if HAS_TEMP_CHAMBER
460  static float analog_to_celsius_chamber(const int raw);
461  #endif
462 
463  #if FAN_COUNT > 0
464 
465  static uint8_t fan_speed[FAN_COUNT];
466  #define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT)
467 
468  static void set_fan_speed(const uint8_t target, const uint16_t speed);
469 
470  #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
471  static bool fans_paused;
472  static uint8_t saved_fan_speed[FAN_COUNT];
473  #endif
474 
475  static constexpr inline uint8_t fanPercent(const uint8_t speed) { return ui8_to_percent(speed); }
476 
477  #if ENABLED(ADAPTIVE_FAN_SLOWING)
478  static uint8_t fan_speed_scaler[FAN_COUNT];
479  #endif
480 
481  static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) {
482  return (fs * uint16_t(
483  #if ENABLED(ADAPTIVE_FAN_SLOWING)
484  fan_speed_scaler[target]
485  #else
486  128
487  #endif
488  )) >> 7;
489  }
490 
491  static inline uint8_t scaledFanSpeed(const uint8_t target) {
492  return scaledFanSpeed(target, fan_speed[target]);
493  }
494 
495  #if ENABLED(EXTRA_FAN_SPEED)
496  static uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT];
497  static void set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp);
498  #endif
499 
500  #if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
501  void set_fans_paused(const bool p);
502  #endif
503 
504  #endif // FAN_COUNT > 0
505 
506  static inline void zero_fan_speeds() {
507  #if FAN_COUNT > 0
508  FANS_LOOP(i) set_fan_speed(i, 0);
509  #endif
510  }
511 
512  /**
513  * Called from the Temperature ISR
514  */
515  static void readings_ready();
516  static void isr();
517 
518  /**
519  * Call periodically to manage heaters
520  */
521  static void manage_heater() _O2; // Added _O2 to work around a compiler error
522 
523  /**
524  * Preheating hotends
525  */
526  #ifdef MILLISECONDS_PREHEAT_TIME
527  static bool is_preheating(const uint8_t E_NAME) {
528  return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]);
529  }
530  static void start_preheat_time(const uint8_t E_NAME) {
531  preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
532  }
533  static void reset_preheat_time(const uint8_t E_NAME) {
534  preheat_end_time[HOTEND_INDEX] = 0;
535  }
536  #else
537  #define is_preheating(n) (false)
538  #endif
539 
540  //high level conversion routines, for use outside of temperature.cpp
541  //inline so that there is no performance decrease.
542  //deg=degreeCelsius
543 
544  FORCE_INLINE static float degHotend(const uint8_t E_NAME) {
545  return (0
546  #if HOTENDS
547  + temp_hotend[HOTEND_INDEX].celsius
548  #endif
549  );
550  }
551 
552  #if ENABLED(SHOW_TEMP_ADC_VALUES)
553  FORCE_INLINE static int16_t rawHotendTemp(const uint8_t E_NAME) {
554  return (0
555  #if HOTENDS
556  + temp_hotend[HOTEND_INDEX].raw
557  #endif
558  );
559  }
560  #endif
561 
562  FORCE_INLINE static int16_t degTargetHotend(const uint8_t E_NAME) {
563  return (0
564  #if HOTENDS
565  + temp_hotend[HOTEND_INDEX].target
566  #endif
567  );
568  }
569 
570  #if WATCH_HOTENDS
571  static void start_watching_hotend(const uint8_t e=0);
572  #else
573  static inline void start_watching_hotend(const uint8_t=0) {}
574  #endif
575 
576  #if HOTENDS
577 
578  static void setTargetHotend(const int16_t celsius, const uint8_t E_NAME) {
579  const uint8_t ee = HOTEND_INDEX;
580  #ifdef MILLISECONDS_PREHEAT_TIME
581  if (celsius == 0)
582  reset_preheat_time(ee);
583  else if (temp_hotend[ee].target == 0)
584  start_preheat_time(ee);
585  #endif
586  #if ENABLED(AUTO_POWER_CONTROL)
588  #endif
589  temp_hotend[ee].target = _MIN(celsius, temp_range[ee].maxtemp - 15);
591  }
592 
593  FORCE_INLINE static bool isHeatingHotend(const uint8_t E_NAME) {
594  return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius;
595  }
596 
597  FORCE_INLINE static bool isCoolingHotend(const uint8_t E_NAME) {
598  return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius;
599  }
600 
601  #if HAS_TEMP_HOTEND
602  static bool wait_for_hotend(const uint8_t target_extruder, const bool no_wait_for_cooling=true
604  , const bool click_to_cancel=false
605  #endif
606  );
607  #endif
608 
609  FORCE_INLINE static bool still_heating(const uint8_t e) {
611  }
612 
613  #endif // HOTENDS
614 
615  #if HAS_HEATED_BED
616 
617  #if ENABLED(SHOW_TEMP_ADC_VALUES)
618  FORCE_INLINE static int16_t rawBedTemp() { return temp_bed.raw; }
619  #endif
620  FORCE_INLINE static float degBed() { return temp_bed.celsius; }
621  FORCE_INLINE static int16_t degTargetBed() { return temp_bed.target; }
622  FORCE_INLINE static bool isHeatingBed() { return temp_bed.target > temp_bed.celsius; }
623  FORCE_INLINE static bool isCoolingBed() { return temp_bed.target < temp_bed.celsius; }
624 
625  #if WATCH_BED
626  static void start_watching_bed();
627  #else
628  static inline void start_watching_bed() {}
629  #endif
630 
631  static void setTargetBed(const int16_t celsius) {
632  #if ENABLED(AUTO_POWER_CONTROL)
634  #endif
635  temp_bed.target =
636  #ifdef BED_MAXTEMP
637  _MIN(celsius, BED_MAXTEMP - 10)
638  #else
639  celsius
640  #endif
641  ;
642  start_watching_bed();
643  }
644 
645  static bool wait_for_bed(const bool no_wait_for_cooling=true
647  , const bool click_to_cancel=false
648  #endif
649  );
650 
651  #endif // HAS_HEATED_BED
652 
653  #if HAS_TEMP_CHAMBER
654  #if ENABLED(SHOW_TEMP_ADC_VALUES)
655  FORCE_INLINE static int16_t rawChamberTemp() { return temp_chamber.raw; }
656  #endif
657  FORCE_INLINE static float degChamber() { return temp_chamber.celsius; }
658  #if HAS_HEATED_CHAMBER
659  FORCE_INLINE static int16_t degTargetChamber() { return temp_chamber.target; }
660  FORCE_INLINE static bool isHeatingChamber() { return temp_chamber.target > temp_chamber.celsius; }
661  FORCE_INLINE static bool isCoolingChamber() { return temp_chamber.target < temp_chamber.celsius; }
662 
663  static bool wait_for_chamber(const bool no_wait_for_cooling=true);
664  #endif
665  #endif // HAS_TEMP_CHAMBER
666 
667  #if WATCH_CHAMBER
668  static void start_watching_chamber();
669  #else
670  static inline void start_watching_chamber() {}
671  #endif
672 
673  #if HAS_HEATED_CHAMBER
674  static void setTargetChamber(const int16_t celsius) {
675  temp_chamber.target =
676  #ifdef CHAMBER_MAXTEMP
677  _MIN(celsius, CHAMBER_MAXTEMP)
678  #else
679  celsius
680  #endif
681  ;
683  }
684  #endif // HAS_HEATED_CHAMBER
685 
686  /**
687  * The software PWM power for a heater
688  */
689  static int16_t getHeaterPower(const heater_ind_t heater);
690 
691  /**
692  * Switch off all heaters, set all target temperatures to 0
693  */
694  static void disable_all_heaters();
695 
696  /**
697  * Perform auto-tuning for hotend or bed in response to M303
698  */
699  #if HAS_PID_HEATING
700  static void PID_autotune(const float &target, const heater_ind_t hotend, const int8_t ncycles, const bool set_result=false);
701 
702  #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
703  static bool adaptive_fan_slowing;
704  #elif ENABLED(ADAPTIVE_FAN_SLOWING)
705  static constexpr bool adaptive_fan_slowing = true;
706  #endif
707 
708  /**
709  * Update the temp manager when PID values change
710  */
711  #if ENABLED(PIDTEMP)
712  FORCE_INLINE static void updatePID() {
713  #if ENABLED(PID_EXTRUSION_SCALING)
714  last_e_position = 0;
715  #endif
716  }
717  #endif
718 
719  #endif
720 
721  #if ENABLED(PROBING_HEATERS_OFF)
722  static void pause(const bool p);
723  FORCE_INLINE static bool is_paused() { return paused; }
724  #endif
725 
726  #if HEATER_IDLE_HANDLER
727 
731  }
732 
733  #if HAS_HEATED_BED
734  static void reset_bed_idle_timer() {
735  bed_idle.reset();
736  start_watching_bed();
737  }
738  #endif
739 
740  #endif // HEATER_IDLE_HANDLER
741 
742  #if HAS_TEMP_SENSOR
743  static void print_heater_states(const uint8_t target_extruder
744  #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
745  , const bool include_r=false
746  #endif
747  );
748  #if ENABLED(AUTO_REPORT_TEMPERATURES)
749  static uint8_t auto_report_temp_interval;
750  static millis_t next_temp_report_ms;
751  static void auto_report_temperatures();
752  static inline void set_auto_report_interval(uint8_t v) {
753  NOMORE(v, 60);
754  auto_report_temp_interval = v;
755  next_temp_report_ms = millis() + 1000UL * v;
756  }
757  #endif
758  #endif
759 
760  #if HAS_DISPLAY
761  static void set_heating_message(const uint8_t e);
762  #endif
763 
764  private:
765  static void set_current_temp_raw();
766  static void updateTemperaturesFromRawValues();
767 
768  #define HAS_MAX6675 EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
769  #if HAS_MAX6675
770  #if BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
771  #define COUNT_6675 2
772  #else
773  #define COUNT_6675 1
774  #endif
775  #if COUNT_6675 > 1
776  #define READ_MAX6675(N) read_max6675(N)
777  #else
778  #define READ_MAX6675(N) read_max6675()
779  #endif
780  static int read_max6675(
781  #if COUNT_6675 > 1
782  const uint8_t hindex=0
783  #endif
784  );
785  #endif
786 
787  static void checkExtruderAutoFans();
788 
789  static float get_pid_output_hotend(const uint8_t e);
790 
791  #if ENABLED(PIDTEMPBED)
792  static float get_pid_output_bed();
793  #endif
794 
795  #if HAS_HEATED_CHAMBER
796  static float get_pid_output_chamber();
797  #endif
798 
799  static void _temp_error(const heater_ind_t e, PGM_P const serial_msg, PGM_P const lcd_msg);
800  static void min_temp_error(const heater_ind_t e);
801  static void max_temp_error(const heater_ind_t e);
802 
803  #define HAS_THERMAL_PROTECTION (EITHER(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_CHAMBER) || HAS_THERMALLY_PROTECTED_BED)
804 
805  #if HAS_THERMAL_PROTECTION
806 
807  enum TRState : char { TRInactive, TRFirstHeating, TRStable, TRRunaway };
808 
809  typedef struct {
810  millis_t timer = 0;
811  TRState state = TRInactive;
812  } tr_state_machine_t;
813 
814  #if ENABLED(THERMAL_PROTECTION_HOTENDS)
815  static tr_state_machine_t tr_state_machine[HOTENDS];
816  #endif
817  #if HAS_THERMALLY_PROTECTED_BED
818  static tr_state_machine_t tr_state_machine_bed;
819  #endif
820  #if ENABLED(THERMAL_PROTECTION_CHAMBER)
821  static tr_state_machine_t tr_state_machine_chamber;
822  #endif
823 
824  static void thermal_runaway_protection(tr_state_machine_t &state, const float &current, const float &target, const heater_ind_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
825 
826  #endif // HAS_THERMAL_PROTECTION
827 };
828 
ACCUMULATE_ADC
#define ACCUMULATE_ADC(obj)
planner.h
HEATER_0_RAW_LO_TEMP
#define HEATER_0_RAW_LO_TEMP
Definition: thermistors.h:255
WITHIN
#define WITHIN(N, L, H)
Definition: macros.h:195
PENDING
#define PENDING(NOW, SOON)
Definition: millis_t.h:28
MSG_INVALID_EXTRUDER_NUM
#define MSG_INVALID_EXTRUDER_NUM
Definition: language.h:286
GET_TEXT
#define GET_TEXT(MSG)
Definition: multi_language.h:72
Temperature::reset_heater_idle_timer
static void reset_heater_idle_timer(const uint8_t E_NAME)
Definition: temperature.h:728
celsius_range_t
Definition: temperature.h:217
THERMISTOR_ADC_RESOLUTION
#define THERMISTOR_ADC_RESOLUTION
Definition: temperature.h:220
Temperature::tooColdToExtrude
static FORCE_INLINE bool tooColdToExtrude(const uint8_t)
Definition: temperature.h:314
MSG_T_MINTEMP
#define MSG_T_MINTEMP
Definition: language.h:296
SERIAL_CHAR
#define SERIAL_CHAR(x)
Definition: serial.h:69
SoftPWM::count
uint8_t count
Definition: temperature.cpp:2327
PIDHeaterInfo
Definition: temperature.h:175
MAX_BED_POWER
#define MAX_BED_POWER
Definition: Configuration_A3ides_2209_MINI.h:481
endstops.h
hotend_pid_t
PID_t hotend_pid_t
Definition: temperature.h:66
TEMP_AD8495
#define TEMP_AD8495(RAW)
Definition: temperature.cpp:1187
NOLESS
#define NOLESS(v, n)
Definition: macros.h:127
TempInfo::celsius
float celsius
Definition: temperature.h:161
TempInfo::sample
void sample(const uint16_t s)
Definition: temperature.h:163
M_PI
#define M_PI
Definition: Marduino.h:79
PORT_REDIRECT
#define PORT_REDIRECT(p)
Definition: serial.h:66
HEATER_BED_PIN
#define HEATER_BED_PIN
Definition: pins_ESP32.h:83
MSG_T_MIN
#define MSG_T_MIN
Definition: language.h:269
CHAMBER_MAXTEMP
#define CHAMBER_MAXTEMP
Definition: Configuration_A3ides_2209_MINI.h:397
_O2
#define _O2
Definition: macros.h:45
temperature.h
printerEventLEDs
PrinterEventLEDs printerEventLEDs
TEMPDIR
#define TEMPDIR(N)
Definition: temperature.cpp:267
heater_idle_t::update
void update(const millis_t &ms)
Definition: temperature.h:201
FAN1_PIN
#define FAN1_PIN
Definition: pins_AZSMZ_MINI.h:87
BANG_MAX
#define BANG_MAX
Definition: Configuration_A3ides_2209_MINI.h:406
HEATER_1_TEMPTABLE
#define HEATER_1_TEMPTABLE
Definition: thermistors.h:178
SERIAL_ECHO
#define SERIAL_ECHO(x)
Definition: serial.h:70
MSG_KI
#define MSG_KI
Definition: language.h:275
Temperature::hotEnoughToExtrude
static FORCE_INLINE bool hotEnoughToExtrude(const uint8_t e)
Definition: temperature.h:318
HEATER_2_TEMPTABLE_LEN
#define HEATER_2_TEMPTABLE_LEN
Definition: thermistors.h:189
StartupDelay
Definition: temperature.h:134
PIDTEMPBED
#define PIDTEMPBED
Definition: Configuration_A3ides_2209_MINI.h:471
Temperature::chamber_idle
static heater_idle_t chamber_idle
Definition: temperature.h:327
OUT_WRITE
#define OUT_WRITE(IO, V)
Definition: fastio.h:108
ARRAY_BY_HOTENDS
#define ARRAY_BY_HOTENDS(V...)
Definition: Conditionals_post.h:539
MSG_PID_DEBUG_ITERM
#define MSG_PID_DEBUG_ITERM
Definition: language.h:283
Temperature::isr
static void isr()
Definition: temperature.cpp:2346
Temperature::degTargetHotend
static FORCE_INLINE int16_t degTargetHotend(const uint8_t E_NAME)
Definition: temperature.h:562
INIT_CHAMBER_AUTO_FAN_PIN
#define INIT_CHAMBER_AUTO_FAN_PIN(P)
Definition: temperature.cpp:1530
H_E4
Definition: temperature.h:52
HEATER_CHAMBER_PIN
#define HEATER_CHAMBER_PIN
Definition: Configuration_A3ides_2209_MINI.h:355
HEATER_5_RAW_HI_TEMP
#define HEATER_5_RAW_HI_TEMP
Definition: thermistors.h:299
stepper.h
E0_AUTO_FAN_PIN
#define E0_AUTO_FAN_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:285
MSG_PID_DEBUG_PTERM
#define MSG_PID_DEBUG_PTERM
Definition: language.h:282
HEATER_1_MINTEMP
#define HEATER_1_MINTEMP
Definition: Configuration_A3ides_2209_MINI.h:379
TEMP_WINDOW
#define TEMP_WINDOW
Definition: Configuration_A3ides_2209_MINI.h:367
PROGMEM
#define PROGMEM
Definition: pgmspace.h:29
E4
Definition: L6470_Marlin.h:30
E1
Definition: L6470_Marlin.h:30
FAN2_PIN
#define FAN2_PIN
Definition: pins_CHEAPTRONICv2.h:92
MSG_PID_DEBUG
#define MSG_PID_DEBUG
Definition: language.h:279
LOW
#define LOW
Definition: wiring_constants.h:70
spiRec
uint8_t spiRec()
printcounter.h
spiInit
void spiInit(uint8_t spiRate)
PID_MAX
#define PID_MAX
Definition: Configuration_A3ides_2209_MINI.h:407
RECIPROCAL
#define RECIPROCAL(x)
Definition: macros.h:273
g29_auto.gcode
list gcode
Definition: g29_auto.py:44
heater_idle_t::reset
void reset()
Definition: temperature.h:203
EXTRUDER_AUTO_FAN_SPEED
#define EXTRUDER_AUTO_FAN_SPEED
Definition: Configuration_A3ides_2209_MINI_adv.h:293
MIN_POWER
#define MIN_POWER
Definition: Conditionals_post.h:1246
HAL_READ_ADC
#define HAL_READ_ADC()
Definition: HAL.h:360
MSG_T_MAXTEMP
#define MSG_T_MAXTEMP
Definition: language.h:295
INIT_FAN_PIN
#define INIT_FAN_PIN(P)
Definition: temperature.cpp:1523
stepper
Stepper stepper
Definition: stepper.cpp:82
_MAX
#define _MAX(V...)
Definition: macros.h:346
PID_t::Kp
float Kp
Definition: temperature.h:56
heater_info_t
HeaterInfo heater_info_t
THERMISTOR_RESISTANCE_NOMINAL_C
#define THERMISTOR_RESISTANCE_NOMINAL_C
Definition: temperature.h:222
HEATER_3_RAW_HI_TEMP
#define HEATER_3_RAW_HI_TEMP
Definition: thermistors.h:281
SERIAL_ECHOPAIR
#define SERIAL_ECHOPAIR(V...)
Definition: serial.h:114
HAS_HEATED_BED
#define HAS_HEATED_BED
Definition: Conditionals_post.h:1044
E1_AUTO_FAN_PIN
#define E1_AUTO_FAN_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:286
g29_auto.start
start
Definition: g29_auto.py:150
E0
Definition: L6470_Marlin.h:30
SCAN_THERMISTOR_TABLE
#define SCAN_THERMISTOR_TABLE(TBL, LEN)
Definition: temperature.cpp:1193
MSG_PID_DEBUG_CTERM
#define MSG_PID_DEBUG_CTERM
Definition: language.h:285
MSG_BIAS
#define MSG_BIAS
Definition: language.h:267
PID_K2
#define PID_K2
Definition: temperature.h:145
HEATER_0_MINTEMP
#define HEATER_0_MINTEMP
Definition: Configuration_A3ides_2209_MINI.h:378
PGM_P
#define PGM_P
Definition: pgmspace.h:30
HEATER_3_RAW_LO_TEMP
#define HEATER_3_RAW_LO_TEMP
Definition: thermistors.h:282
G26_CLICK_CAN_CANCEL
#define G26_CLICK_CAN_CANCEL
Definition: temperature.h:155
TEMP_TIMER_NUM
#define TEMP_TIMER_NUM
Definition: HAL.h:128
babystep
Babystep babystep
i
uint8_t i
Definition: screen_test_graph.c:72
HEATER_1_RAW_HI_TEMP
#define HEATER_1_RAW_HI_TEMP
Definition: thermistors.h:263
HEATER_4_TEMPTABLE
#define HEATER_4_TEMPTABLE
Definition: thermistors.h:208
_MIN
#define _MIN(V...)
Definition: macros.h:333
MIN_ADC_ISR_LOOPS
#define MIN_ADC_ISR_LOOPS
Definition: temperature.h:140
state
static volatile fsensor_t state
Definition: filament_sensor.c:23
HEATER_2_RAW_HI_TEMP
#define HEATER_2_RAW_HI_TEMP
Definition: thermistors.h:272
EXTRUDE_MINTEMP
#define EXTRUDE_MINTEMP
Definition: Configuration_A3ides_2209_MINI.h:517
heater_idle_t::start
void start(const millis_t &ms)
Definition: temperature.h:202
HEATER_2_TEMPTABLE
#define HEATER_2_TEMPTABLE
Definition: thermistors.h:188
TEMP_BED_PIN
#define TEMP_BED_PIN
Definition: pins_ESP32.h:76
BED_MAXTEMP
#define BED_MAXTEMP
Definition: Configuration_A3ides_2209_MINI.h:396
kill
void kill(PGM_P const lcd_error, PGM_P const lcd_component, const bool steppers_off)
Definition: Marlin.cpp:718
HEATER_0_TEMPTABLE_LEN
#define HEATER_0_TEMPTABLE_LEN
Definition: thermistors.h:169
thermistors.h
PIDC_t
Definition: temperature.h:57
HEATER_4_RAW_HI_TEMP
#define HEATER_4_RAW_HI_TEMP
Definition: thermistors.h:290
millis
uint32_t millis(void)
Definition: wiring_time.c:29
HEATER_IDLE_HANDLER
#define HEATER_IDLE_HANDLER
Definition: Conditionals_post.h:1429
MSG_KP
#define MSG_KP
Definition: language.h:274
HEATER_4_TEMPTABLE_LEN
#define HEATER_4_TEMPTABLE_LEN
Definition: thermistors.h:209
LIMIT
#define LIMIT(v, n1, n2)
Definition: macros.h:139
Temperature::manage_heater
static void manage_heater() _O2
Definition: temperature.cpp:975
HEATER_CHAMBER_RAW_LO_TEMP
#define HEATER_CHAMBER_RAW_LO_TEMP
Definition: thermistors.h:318
StartSampling
Definition: temperature.h:93
SERIAL_ECHO_START
#define SERIAL_ECHO_START()
Definition: serial.h:179
HEATER_PSTR
#define HEATER_PSTR(h)
Definition: temperature.cpp:107
TempInfo
Definition: temperature.h:158
TEMP_2_PIN
#define TEMP_2_PIN
Definition: pins_MKS_SBASE.h:96
EmergencyParser::killed_by_M112
static bool killed_by_M112
Definition: emergency_parser.h:65
CHAMBER_AUTO_FAN_SPEED
#define CHAMBER_AUTO_FAN_SPEED
Definition: Configuration_adv.h:360
heater_idle_t::expire
void expire()
Definition: temperature.h:204
Temperature::degHotend
static FORCE_INLINE float degHotend(const uint8_t E_NAME)
Definition: temperature.h:544
CHAMBER_AUTO_FAN_TEMPERATURE
#define CHAMBER_AUTO_FAN_TEMPERATURE
Definition: Configuration_adv.h:359
H_E2
Definition: temperature.h:52
MSG_HEATER_CHAMBER
#define MSG_HEATER_CHAMBER
Definition: language.h:289
PIDC_t::Kp
float Kp
Definition: temperature.h:57
HAL_timer_start
FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t)
Definition: HAL.h:149
KEEPALIVE_STATE
#define KEEPALIVE_STATE(N)
Definition: gcode.h:365
ADCSensorState
ADCSensorState
Definition: temperature.h:92
Endstops::poll
static void poll()
Definition: endstops.cpp:272
IsRunning
bool IsRunning()
Definition: Marlin.h:331
loud_kill
void loud_kill(PGM_P const lcd_msg, const heater_ind_t heater)
Definition: temperature.cpp:723
HEATER_3_TEMPTABLE_LEN
#define HEATER_3_TEMPTABLE_LEN
Definition: thermistors.h:199
LEDColor
Definition: leds.h:41
HEATER_1_RAW_LO_TEMP
#define HEATER_1_RAW_LO_TEMP
Definition: thermistors.h:264
HEATER_0_RAW_HI_TEMP
#define HEATER_0_RAW_HI_TEMP
Definition: thermistors.h:254
temp_range_t::raw_min
int16_t raw_min
Definition: temperature.h:218
emergency_parser
EmergencyParser emergency_parser
OUT_WRITE_OD
#define OUT_WRITE_OD(IO, V)
Definition: fastio.h:115
Running
bool Running
Definition: Marlin.cpp:181
HAL_ADC_READY
#define HAL_ADC_READY()
Definition: HAL.h:361
HEATER_2_PIN
#define HEATER_2_PIN
Definition: pins_COHESION3D_REMIX.h:116
MSG_PID_DEBUG_OUTPUT
#define MSG_PID_DEBUG_OUTPUT
Definition: language.h:281
NOMORE
#define NOMORE(v, n)
Definition: macros.h:133
FAN_PIN
#define FAN_PIN
Definition: pins_ESP32.h:82
HeaterInfo::soft_pwm_amount
uint8_t soft_pwm_amount
Definition: temperature.h:170
SPIclass::init
static FORCE_INLINE void init()
Definition: private_spi.h:31
CHAMBER_TEMPTABLE_LEN
#define CHAMBER_TEMPTABLE_LEN
Definition: thermistors.h:237
HAL_timer_isr_prologue
#define HAL_timer_isr_prologue(TIMER_NUM)
Definition: HAL.h:196
SET_INPUT_PULLUP
#define SET_INPUT_PULLUP(IO)
Definition: fastio.h:100
MSG_PID_DEBUG_DTERM
#define MSG_PID_DEBUG_DTERM
Definition: language.h:284
heater_idle_t
Definition: temperature.h:198
ABS
#define ABS(a)
Definition: macros.h:266
PID_t::Ki
float Ki
Definition: temperature.h:56
HEATER_4_RAW_LO_TEMP
#define HEATER_4_RAW_LO_TEMP
Definition: thermistors.h:291
E2_AUTO_FAN_PIN
#define E2_AUTO_FAN_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:287
pgm_read_byte
#define pgm_read_byte(addr)
Definition: pgmspace.h:95
HEATER_0_PIN
#define HEATER_0_PIN
Definition: pins_ESP32.h:81
Temperature::getHeaterPower
static int16_t getHeaterPower(const heater_ind_t heater)
Definition: temperature.cpp:607
HEATER_3_PIN
#define HEATER_3_PIN
Definition: pins_CNCONTROLS_11.h:68
Temperature::PID_autotune
static void PID_autotune(const float &target, const heater_ind_t hotend, const int8_t ncycles, const bool set_result=false)
COUNT_6675
#define COUNT_6675
Definition: temperature.h:773
SensorsReady
Definition: temperature.h:133
HEATER_5_TEMPTABLE
#define HEATER_5_TEMPTABLE
Definition: thermistors.h:218
FORCE_INLINE
#define FORCE_INLINE
Definition: macros.h:40
TEMP_TIMER_FREQUENCY
#define TEMP_TIMER_FREQUENCY
Definition: HAL.h:131
PSTR
#define PSTR(str)
Definition: pgmspace.h:31
E4_AUTO_FAN_PIN
#define E4_AUTO_FAN_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:289
E3
Definition: L6470_Marlin.h:30
PIDHeaterInfo::pid
T pid
Definition: temperature.h:176
SERIAL_BOTH
#define SERIAL_BOTH
Definition: serial.h:49
Temperature::targetTooColdToExtrude
static FORCE_INLINE bool targetTooColdToExtrude(const uint8_t)
Definition: temperature.h:315
FILWIDTH_PIN
#define FILWIDTH_PIN
Definition: pins_RAMPS_LINUX.h:211
HEATER_5_RAW_LO_TEMP
#define HEATER_5_RAW_LO_TEMP
Definition: thermistors.h:300
Temperature::print_heater_states
static void print_heater_states(const uint8_t target_extruder)
E2
Definition: L6470_Marlin.h:30
heater_watch_t::elapsed
bool elapsed(const millis_t &ms)
Definition: temperature.h:211
WATCH_HOTENDS
#define WATCH_HOTENDS
Definition: Conditionals_post.h:1061
COPY
Definition: inflate.h:36
ENABLE_TEMPERATURE_INTERRUPT
#define ENABLE_TEMPERATURE_INTERRUPT()
Definition: HAL.h:145
HEATER_1_TEMPTABLE_LEN
#define HEATER_1_TEMPTABLE_LEN
Definition: thermistors.h:179
SPIclass::receive
static FORCE_INLINE uint8_t receive()
Definition: private_spi.h:33
H_E0
Definition: temperature.h:52
COUNT
#define COUNT(a)
Definition: macros.h:200
heater_idle_t::timeout_ms
millis_t timeout_ms
Definition: temperature.h:199
H_REDUNDANT
Definition: temperature.h:51
filwidth
FilamentWidthSensor filwidth
MSG_STOPPED_HEATER
#define MSG_STOPPED_HEATER
Definition: language.h:291
HEATER_5_TEMPTABLE_LEN
#define HEATER_5_TEMPTABLE_LEN
Definition: thermistors.h:219
TEMP_CHAMBER_PIN
#define TEMP_CHAMBER_PIN
Definition: pins_CNCONTROLS_15.h:54
HAL_START_ADC
#define HAL_START_ADC(pin)
Definition: HAL.h:357
MSG_PID_TEMP_TOO_HIGH
#define MSG_PID_TEMP_TOO_HIGH
Definition: language.h:265
HeaterInfo
Definition: temperature.h:168
DISABLED
#define DISABLED(V...)
Definition: macros.h:178
heater_watch_t::next_ms
millis_t next_ms
Definition: temperature.h:210
HEATER_5_PIN
#define HEATER_5_PIN
Definition: pins.h:757
TempInfo::raw
int16_t raw
Definition: temperature.h:160
Temperature::hotend_idle
static heater_idle_t hotend_idle[HOTENDS]
Definition: temperature.h:322
cu
#define cu(x)
Definition: macros.h:97
FilamentWidthSensor::update_volumetric
static void update_volumetric()
Definition: filwidth.h:108
HEATER_0_MAXTEMP
#define HEATER_0_MAXTEMP
Definition: Configuration_A3ides_2209_MINI.h:390
HEATER_2_RAW_LO_TEMP
#define HEATER_2_RAW_LO_TEMP
Definition: thermistors.h:273
READ_MAX6675
#define READ_MAX6675(N)
Definition: temperature.h:778
constrain
#define constrain(amt, low, high)
Definition: wiring_constants.h:79
WRITE
#define WRITE(IO, V)
Definition: fastio.h:96
E3_AUTO_FAN_PIN
#define E3_AUTO_FAN_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:288
FilamentWidthSensor::accumulate
static void accumulate(const uint16_t adc)
Definition: filwidth.h:63
MISO_PIN
#define MISO_PIN
Definition: spi_pins.h:58
SERIAL_ECHOPGM
#define SERIAL_ECHOPGM(S)
Definition: serial.h:173
Temperature::targetHotEnoughToExtrude
static FORCE_INLINE bool targetHotEnoughToExtrude(const uint8_t e)
Definition: temperature.h:319
powerManager
Power powerManager
HEATER_1_PIN
#define HEATER_1_PIN
Definition: pins_RAMPS_LINUX.h:196
TEMP_RESIDENCY_TIME
#define TEMP_RESIDENCY_TIME
Definition: Configuration_A3ides_2209_MINI.h:366
spiBegin
void spiBegin()
celsius_range_t::mintemp
int16_t mintemp
Definition: temperature.h:217
heater_idle_t::timed_out
bool timed_out
Definition: temperature.h:200
WATCH_BED
#define WATCH_BED
Definition: Conditionals_post.h:1062
SERIAL_ECHOLNPAIR
#define SERIAL_ECHOLNPAIR(V...)
Definition: serial.h:144
HAS_HEATED_CHAMBER
#define HAS_HEATED_CHAMBER
Definition: Conditionals_post.h:1025
HOTEND_LOOP
#define HOTEND_LOOP()
Definition: Conditionals_LCD.h:436
L
#define L(CODE)
Definition: macros.h:76
HEATER_3_TEMPTABLE
#define HEATER_3_TEMPTABLE
Definition: thermistors.h:198
MSG_KD
#define MSG_KD
Definition: language.h:276
H_BED
Definition: temperature.h:51
TempInfo::update
void update()
Definition: temperature.h:164
TEMP_CHAMBER_HYSTERESIS
#define TEMP_CHAMBER_HYSTERESIS
Definition: Configuration_A3ides_2209_MINI.h:374
_PWM_LOW
#define _PWM_LOW(N, S)
ELAPSED
#define ELAPSED(NOW, SOON)
Definition: millis_t.h:29
Temperature::disable_all_heaters
static void disable_all_heaters()
Definition: temperature.cpp:1926
HEATER_4_PIN
#define HEATER_4_PIN
Definition: pins.h:754
MAX6675_SS2_PIN
#define MAX6675_SS2_PIN
Definition: pins_MIGHTYBOARD_REVE.h:142
uint8_t
const uint8_t[]
Definition: 404_html.c:3
TEMP_3_PIN
#define TEMP_3_PIN
Definition: pins_RAMPS_RE_ARM.h:169
THERMISTOR_ABS_ZERO_C
#define THERMISTOR_ABS_ZERO_C
Definition: temperature.h:221
MAX_REDUNDANT_TEMP_SENSOR_DIFF
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF
Definition: Configuration_A3ides_2209_MINI.h:364
_PWM_MOD
#define _PWM_MOD(N, S, T)
Babystep::task
static void task()
ui
MarlinUI ui
FilamentWidthSensor::reading_ready
static void reading_ready()
Definition: filwidth.h:74
SCK_PIN
#define SCK_PIN
Definition: spi_pins.h:55
_BV
#define _BV(bit)
Definition: wiring_constants.h:99
HAL_adc_init
void HAL_adc_init()
Definition: HAL.h:345
extrude_min_temp
const int32_t extrude_min_temp
Definition: menu_vars.cpp:43
MSG_T_MAX
#define MSG_T_MAX
Definition: language.h:270
MSG_CLASSIC_PID
#define MSG_CLASSIC_PID
Definition: language.h:273
H_CHAMBER
Definition: temperature.h:51
Planner::steps_to_mm
static float steps_to_mm[XYZE_N]
Definition: planner.h:254
delay
void delay(uint32_t ms)
Definition: wiring_time.c:42
HAL_ANALOG_SELECT
#define HAL_ANALOG_SELECT(pin)
Definition: HAL.h:342
MSG_PID_DEBUG_INPUT
#define MSG_PID_DEBUG_INPUT
Definition: language.h:280
MSG_REDUNDANCY
#define MSG_REDUNDANCY
Definition: language.h:292
MSG_HEATER_BED
#define MSG_HEATER_BED
Definition: language.h:288
TEMP_HYSTERESIS
#define TEMP_HYSTERESIS
Definition: Configuration_A3ides_2209_MINI.h:368
INIT_E_AUTO_FAN_PIN
#define INIT_E_AUTO_FAN_PIN(P)
Definition: temperature.cpp:1525
heater_watch_t
Definition: temperature.h:208
OVERSAMPLENR
#define OVERSAMPLENR
Definition: thermistors.h:26
HAL_timer_isr_epilogue
#define HAL_timer_isr_epilogue(TIMER_NUM)
Definition: HAL.h:197
E5_AUTO_FAN_PIN
#define E5_AUTO_FAN_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:290
TempInfo::reset
void reset()
Definition: temperature.h:162
temp_range_t
Definition: temperature.h:218
MOSI_PIN
#define MOSI_PIN
Definition: spi_pins.h:61
Temperature::start_watching_hotend
static void start_watching_hotend(const uint8_t=0)
Definition: temperature.h:573
MSG_TU
#define MSG_TU
Definition: language.h:272
Temperature::reset_bed_idle_timer
static void reset_bed_idle_timer()
Definition: temperature.h:734
HAL_TEMP_TIMER_ISR
HAL_TEMP_TIMER_ISR()
Definition: temperature.cpp:2313
SERIAL_ERROR_START
#define SERIAL_ERROR_START()
Definition: serial.h:180
EXTRUDERS
#define EXTRUDERS
Definition: Configuration_A3ides_2209_MINI.h:148
CHAMBER_MINTEMP
#define CHAMBER_MINTEMP
Definition: Configuration_A3ides_2209_MINI.h:385
FAN_COUNT
#define FAN_COUNT
Definition: Conditionals_post.h:1292
SERIAL_ECHOPAIR_F
#define SERIAL_ECHOPAIR_F(S, V...)
Definition: serial.h:176
Temperature::bed_idle
static heater_idle_t bed_idle
Definition: temperature.h:324
ui8_to_percent
constexpr uint8_t ui8_to_percent(const uint8_t i)
Definition: utility.h:81
HEATER_1_MAXTEMP
#define HEATER_1_MAXTEMP
Definition: Configuration_A3ides_2209_MINI.h:391
HIGH
#define HIGH
Definition: wiring_constants.h:71
DISABLE_HEATER
#define DISABLE_HEATER(NR)
ARRAY_N
#define ARRAY_N(N, V...)
Definition: macros.h:227
E5
Definition: L6470_Marlin.h:30
Temperature::start_watching_chamber
static void start_watching_chamber()
Definition: temperature.h:670
MAX6675_SS_PIN
#define MAX6675_SS_PIN
Definition: pins_RAMPS_LINUX.h:138
TEMP_1_PIN
#define TEMP_1_PIN
Definition: pins_RAMPS_LINUX.h:131
MSG_D
#define MSG_D
Definition: language.h:268
HEATER_0_TEMPTABLE
#define HEATER_0_TEMPTABLE
Definition: thermistors.h:168
SERIAL_EOL
#define SERIAL_EOL()
Definition: serial.h:181
MSG_KU
#define MSG_KU
Definition: language.h:271
CHAMBER_AUTO_FAN_PIN
#define CHAMBER_AUTO_FAN_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:291
INDEX_NONE
Definition: temperature.h:50
raw_range_t::raw_min
int16_t raw_min
Definition: temperature.h:216
HEATER_BED_RAW_HI_TEMP
#define HEATER_BED_RAW_HI_TEMP
Definition: thermistors.h:308
TEMP_BED_RESIDENCY_TIME
#define TEMP_BED_RESIDENCY_TIME
Definition: Configuration_A3ides_2209_MINI.h:370
Temperature
Definition: temperature.h:267
TEMP_BED_HYSTERESIS
#define TEMP_BED_HYSTERESIS
Definition: Configuration_A3ides_2209_MINI.h:372
BED_MINTEMP
#define BED_MINTEMP
Definition: Configuration_A3ides_2209_MINI.h:384
heater_watch_t::target
uint16_t target
Definition: temperature.h:209
joystick
Joystick joystick
TEST
#define TEST(n, b)
Definition: macros.h:81
createSpeedLookupTable.int
int
Definition: createSpeedLookupTable.py:15
FilamentWidthSensor::update_measured_mm
static void update_measured_mm()
Definition: filwidth.h:77
heater_watch_t::elapsed
bool elapsed()
Definition: temperature.h:212
SoftPWM::add
bool add(const uint8_t mask, const uint8_t amount)
Definition: temperature.cpp:2328
DELAY_NS
#define DELAY_NS(x)
Definition: Delay.h:172
HOTENDS
#define HOTENDS
Definition: Conditionals_LCD.h:425
thermalManager
Temperature thermalManager
Definition: temperature.cpp:89
TEMP_5_PIN
#define TEMP_5_PIN
Definition: pins.h:779
temp_info_t
struct TempInfo temp_info_t
Stepper::position
static int32_t position(const AxisEnum axis)
Definition: stepper.cpp:2214
BOTH
#define BOTH(V1, V2)
Definition: macros.h:183
BEEPER_PIN
#define BEEPER_PIN
Definition: pins_CHEAPTRONICv2.h:125
EXTRUDER_AUTO_FAN_TEMPERATURE
#define EXTRUDER_AUTO_FAN_TEMPERATURE
Definition: Configuration_A3ides_2209_MINI_adv.h:292
PID_PARAM
#define PID_PARAM(F, H)
Definition: temperature.h:87
H_E1
Definition: temperature.h:52
E_AXIS
Definition: types.h:40
TEMP_0_PIN
#define TEMP_0_PIN
Definition: pins_ESP32.h:75
HeaterInfo::target
int16_t target
Definition: temperature.h:169
wait_for_heatup
bool wait_for_heatup
Definition: Marlin.cpp:184
SS_PIN
#define SS_PIN
Definition: spi_pins.h:64
Temperature::readings_ready
static void readings_ready()
Definition: temperature.cpp:2182
serialprintPGM
void serialprintPGM(PGM_P str)
Definition: serial.cpp:35
TEMP_BED_WINDOW
#define TEMP_BED_WINDOW
Definition: Configuration_A3ides_2209_MINI.h:371
is_preheating
#define is_preheating(n)
Definition: temperature.h:537
SBI
#define SBI(A, B)
Definition: macros.h:85
S_FMT
#define S_FMT
Definition: macros.h:68
raw_range_t
Definition: temperature.h:216
E_NAME
#define E_NAME
Definition: temperature.h:42
SERIAL_ECHOLNPGM
#define SERIAL_ECHOLNPGM(S)
Definition: serial.h:174
Planner::tick
static void tick()
Definition: planner.h:750
MSG_PID_TIMEOUT
#define MSG_PID_TIMEOUT
Definition: language.h:266
H_E5
Definition: temperature.h:52
MSG_PID_AUTOTUNE_START
#define MSG_PID_AUTOTUNE_START
Definition: language.h:262
idle
void idle()
Definition: Marlin.cpp:629
_PWM_FAN
#define _PWM_FAN
Definition: hwio_a3ides.h:43
MSG_T_THERMAL_RUNAWAY
#define MSG_T_THERMAL_RUNAWAY
Definition: language.h:294
PID_t
Definition: temperature.h:56
BED_TEMPTABLE_LEN
#define BED_TEMPTABLE_LEN
Definition: thermistors.h:228
thermalManager
Temperature thermalManager
Definition: temperature.cpp:89
UNUSED
#define UNUSED(X)
Definition: stm32f4xx_hal_def.h:74
endstops
Endstops endstops
Definition: endstops.cpp:51
watchdog_refresh
void watchdog_refresh()
Definition: HAL.h:28
Temperature::in_temp_isr
static volatile bool in_temp_isr
Definition: temperature.h:271
HEATER_BED_RAW_LO_TEMP
#define HEATER_BED_RAW_LO_TEMP
Definition: thermistors.h:309
millis_t
uint32_t millis_t
Definition: millis_t.h:26
hotend_info_t
heater_info_t hotend_info_t
Definition: temperature.h:182
Temperature::init
void init()
Definition: temperature.cpp:1539
PID_t::Kd
float Kd
Definition: temperature.h:56
active_extruder
constexpr uint8_t active_extruder
Definition: motion.h:107
Power::power_on
static void power_on()
CONTROLLER_FAN_PIN
#define CONTROLLER_FAN_PIN
Definition: pins_MEGACONTROLLER.h:121
TEMP_4_PIN
#define TEMP_4_PIN
Definition: pins.h:776
H_E3
Definition: temperature.h:52
Temperature::zero_fan_speeds
static void zero_fan_speeds()
Definition: temperature.h:506
SoftPWM
Definition: temperature.cpp:2325
tool_change.h
MSG_PID_AUTOTUNE_FINISHED
#define MSG_PID_AUTOTUNE_FINISHED
Definition: language.h:278
TempInfo::acc
uint16_t acc
Definition: temperature.h:159
heater_ind_t
heater_ind_t
Definition: temperature.h:49
MSG_T_HEATING_FAILED
#define MSG_T_HEATING_FAILED
Definition: language.h:293
HEATER_CHAMBER_RAW_HI_TEMP
#define HEATER_CHAMBER_RAW_HI_TEMP
Definition: thermistors.h:317
ENABLED
#define ENABLED(V...)
Definition: macros.h:177
planner
Planner planner
Definition: planner.cpp:111
HOTEND_INDEX
#define HOTEND_INDEX
Definition: temperature.h:41
SOFT_PWM_SCALE
#define SOFT_PWM_SCALE
Definition: Configuration_A3ides_2209_MINI.h:1986
TEMP_AD595
#define TEMP_AD595(RAW)
Definition: temperature.cpp:1186
SPIclass
Definition: private_spi.h:28