Prusa MINI Firmware overview
temperature.h File Reference

Go to the source code of this file.

Classes

struct  PID_t
 
struct  PIDC_t
 
struct  TempInfo
 
struct  HeaterInfo
 
struct  PIDHeaterInfo< T >
 
struct  heater_idle_t
 
struct  heater_watch_t
 
struct  raw_range_t
 
struct  celsius_range_t
 
struct  temp_range_t
 
class  Temperature
 

Macros

#define SOFT_PWM_SCALE   0
 
#define HOTEND_INDEX   0
 
#define E_NAME
 
#define DUMMY_PID_VALUE   3000.0f
 
#define _PID_Kp(H)   DUMMY_PID_VALUE
 
#define _PID_Ki(H)   DUMMY_PID_VALUE
 
#define _PID_Kd(H)   DUMMY_PID_VALUE
 
#define _PID_Kc(H)   1
 
#define PID_PARAM(F, H)   _PID_##F(H)
 
#define MIN_ADC_ISR_LOOPS   10
 
#define ACTUAL_ADC_SAMPLES   _MAX(int(MIN_ADC_ISR_LOOPS), int(SensorsReady))
 
#define PID_K2   (1-float(PID_K1))
 
#define PID_dT   ((OVERSAMPLENR * float(ACTUAL_ADC_SAMPLES)) / TEMP_TIMER_FREQUENCY)
 
#define scalePID_i(i)   ( float(i) * PID_dT )
 
#define unscalePID_i(i)   ( float(i) / PID_dT )
 
#define scalePID_d(d)   ( float(d) / PID_dT )
 
#define unscalePID_d(d)   ( float(d) * PID_dT )
 
#define G26_CLICK_CAN_CANCEL   (HAS_LCD_MENU && ENABLED(G26_MESH_VALIDATION))
 
#define THERMISTOR_ADC_RESOLUTION   1024
 
#define THERMISTOR_ABS_ZERO_C   -273.15f
 
#define THERMISTOR_RESISTANCE_NOMINAL_C   25.0f
 
#define is_preheating(n)   (false)
 
#define HAS_MAX6675   EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
 
#define COUNT_6675   1
 
#define READ_MAX6675(N)   read_max6675()
 
#define HAS_THERMAL_PROTECTION   (EITHER(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_CHAMBER) || HAS_THERMALLY_PROTECTED_BED)
 

Typedefs

typedef PID_t hotend_pid_t
 
typedef struct TempInfo temp_info_t
 
typedef HeaterInfo heater_info_t
 
typedef heater_info_t hotend_info_t
 

Enumerations

enum  heater_ind_t : int8_t {
  INDEX_NONE = -4, H_REDUNDANT, H_CHAMBER, H_BED,
  H_E0, H_E1, H_E2, H_E3,
  H_E4, H_E5
}
 
enum  ADCSensorState : char { StartSampling, SensorsReady, StartupDelay }
 

Variables

Temperature thermalManager
 

Macro Definition Documentation

◆ SOFT_PWM_SCALE

#define SOFT_PWM_SCALE   0

Marlin 3D Printer Firmware Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]

Based on Sprinter and grbl. Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. temperature.h - temperature controller

◆ HOTEND_INDEX

#define HOTEND_INDEX   0

◆ E_NAME

#define E_NAME

◆ DUMMY_PID_VALUE

#define DUMMY_PID_VALUE   3000.0f

◆ _PID_Kp

#define _PID_Kp (   H)    DUMMY_PID_VALUE

◆ _PID_Ki

#define _PID_Ki (   H)    DUMMY_PID_VALUE

◆ _PID_Kd

#define _PID_Kd (   H)    DUMMY_PID_VALUE

◆ _PID_Kc

#define _PID_Kc (   H)    1

◆ PID_PARAM

#define PID_PARAM (   F,
 
)    _PID_##F(H)

◆ MIN_ADC_ISR_LOOPS

#define MIN_ADC_ISR_LOOPS   10

◆ ACTUAL_ADC_SAMPLES

#define ACTUAL_ADC_SAMPLES   _MAX(int(MIN_ADC_ISR_LOOPS), int(SensorsReady))

◆ PID_K2

#define PID_K2   (1-float(PID_K1))

◆ PID_dT

#define PID_dT   ((OVERSAMPLENR * float(ACTUAL_ADC_SAMPLES)) / TEMP_TIMER_FREQUENCY)

◆ scalePID_i

#define scalePID_i (   i)    ( float(i) * PID_dT )

◆ unscalePID_i

#define unscalePID_i (   i)    ( float(i) / PID_dT )

◆ scalePID_d

#define scalePID_d (   d)    ( float(d) / PID_dT )

◆ unscalePID_d

#define unscalePID_d (   d)    ( float(d) * PID_dT )

◆ G26_CLICK_CAN_CANCEL

#define G26_CLICK_CAN_CANCEL   (HAS_LCD_MENU && ENABLED(G26_MESH_VALIDATION))

◆ THERMISTOR_ADC_RESOLUTION

#define THERMISTOR_ADC_RESOLUTION   1024

◆ THERMISTOR_ABS_ZERO_C

#define THERMISTOR_ABS_ZERO_C   -273.15f

◆ THERMISTOR_RESISTANCE_NOMINAL_C

#define THERMISTOR_RESISTANCE_NOMINAL_C   25.0f

◆ is_preheating

#define is_preheating (   n)    (false)

Preheating hotends

◆ HAS_MAX6675

#define HAS_MAX6675   EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)

◆ COUNT_6675

#define COUNT_6675   1

◆ READ_MAX6675

#define READ_MAX6675 (   N)    read_max6675()

◆ HAS_THERMAL_PROTECTION

Typedef Documentation

◆ hotend_pid_t

◆ temp_info_t

typedef struct TempInfo temp_info_t

◆ heater_info_t

◆ hotend_info_t

Enumeration Type Documentation

◆ heater_ind_t

enum heater_ind_t : int8_t
Enumerator
INDEX_NONE 
H_REDUNDANT 
H_CHAMBER 
H_BED 
H_E0 
H_E1 
H_E2 
H_E3 
H_E4 
H_E5 
49  : int8_t {
50  INDEX_NONE = -4,
52  H_E0, H_E1, H_E2, H_E3, H_E4, H_E5
53 } heater_ind_t;

◆ ADCSensorState

enum ADCSensorState : char

States for ADC reading in the ISR

Enumerator
StartSampling 
SensorsReady 
StartupDelay 
92  : 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 };

Variable Documentation

◆ thermalManager

Temperature thermalManager
StartupDelay
Definition: temperature.h:134
H_E4
Definition: temperature.h:52
StartSampling
Definition: temperature.h:93
H_E2
Definition: temperature.h:52
SensorsReady
Definition: temperature.h:133
H_E0
Definition: temperature.h:52
H_REDUNDANT
Definition: temperature.h:51
H_BED
Definition: temperature.h:51
H_CHAMBER
Definition: temperature.h:51
INDEX_NONE
Definition: temperature.h:50
H_E1
Definition: temperature.h:52
H_E5
Definition: temperature.h:52
H_E3
Definition: temperature.h:52
heater_ind_t
heater_ind_t
Definition: temperature.h:49