31 bool get_temp_error();
35 extern int target_temperature[EXTRUDERS];
36 extern float current_temperature[EXTRUDERS];
37 #ifdef SHOW_TEMP_ADC_VALUES
38 extern int current_temperature_raw[EXTRUDERS];
39 extern int current_temperature_bed_raw;
41 extern int target_temperature_bed;
42 extern float current_temperature_bed;
44 #ifdef PINDA_THERMISTOR
45 extern uint16_t current_temperature_raw_pinda;
46 extern float current_temperature_pinda;
47 bool has_temperature_compensation();
50 #ifdef AMBIENT_THERMISTOR
51 extern int current_temperature_raw_ambient;
52 extern float current_temperature_ambient;
56 extern int current_voltage_raw_pwr;
60 extern int current_voltage_raw_bed;
63 extern bool bedPWMDisabled;
66 extern int pid_cycle, pid_number_of_cycles;
67 extern float _Kp,_Ki,_Kd;
68 float scalePID_i(
float i);
69 float scalePID_d(
float d);
70 float unscalePID_i(
float i);
71 float unscalePID_d(
float d);
73 bool pidTuningRunning();
74 void preparePidTuning();
79 extern volatile int babystepsTodo[3];
81 inline void babystepsTodoZadd(
int n)
84 CRITICAL_SECTION_START
85 babystepsTodo[Z_AXIS] += n;
91 void resetPID(uint8_t extruder);
98 FORCE_INLINE
float degHotend(uint8_t extruder) {
99 return current_temperature[extruder];
102 #ifdef SHOW_TEMP_ADC_VALUES
103 FORCE_INLINE
float rawHotendTemp(uint8_t extruder) {
104 return current_temperature_raw[extruder];
107 FORCE_INLINE
float rawBedTemp() {
108 return current_temperature_bed_raw;
112 FORCE_INLINE
float degBed() {
113 return current_temperature_bed;
117 FORCE_INLINE
float degTargetHotend(uint8_t extruder) {
118 return target_temperature[extruder];
121 FORCE_INLINE
float degTargetBed() {
122 return target_temperature_bed;
126 FORCE_INLINE
void setTargetHotend(
const float &celsius) {
127 target_temperature[0] = celsius;
131 FORCE_INLINE
void setTargetBed(
const float &celsius) {
132 target_temperature_bed = celsius;
135 FORCE_INLINE
bool isHeatingHotend(uint8_t extruder){
136 return target_temperature[extruder] > current_temperature[extruder];
139 FORCE_INLINE
bool isHeatingBed() {
140 return target_temperature_bed > current_temperature_bed;
143 FORCE_INLINE
bool isCoolingHotend(uint8_t extruder) {
144 return target_temperature[extruder] < current_temperature[extruder];
147 FORCE_INLINE
bool isCoolingBed() {
148 return target_temperature_bed < current_temperature_bed;
151 #define degHotend0() degHotend(0)
152 #define degTargetHotend0() degTargetHotend(0)
153 #define isHeatingHotend0() isHeatingHotend(0)
154 #define isCoolingHotend0() isCoolingHotend(0)
157 #define CHECK_ALL_HEATERS ((target_temperature[0] != 0) || (target_temperature_bed != 0))
159 int getHeaterPower(
int heater);
160 void disable_heater();
164 FORCE_INLINE
void autotempShutdown(){
168 autotemp_enabled=
false;
169 if(degTargetHotend(active_extruder)>autotemp_min)
175 void PID_autotune(
float temp,
int extruder,
int ncycles);
178 bool thermal_model_enabled();
179 void thermal_model_set_enabled(
bool enabled);
180 void thermal_model_set_warn_beep(
bool enabled);
181 void thermal_model_set_params(
float P=NAN,
float U=NAN,
float V=NAN,
float C=NAN,
float D=NAN,
182 int16_t L=-1,
float Ta_corr=NAN,
float warn=NAN,
float err=NAN);
183 void thermal_model_set_resistance(uint8_t index,
float R);
185 void thermal_model_report_settings();
186 void thermal_model_reset_settings();
187 void thermal_model_load_settings();
188 void thermal_model_save_settings();
190 void thermal_model_autotune(int16_t temp = 0,
bool selftest =
false);
191 bool thermal_model_autotune_result();
193 #ifdef THERMAL_MODEL_DEBUG
194 void thermal_model_log_enable(
bool enable);
199 extern unsigned char fanSpeedSoftPwm;
201 extern uint8_t fanSpeedBckp;