|
@@ -85,55 +85,25 @@ extern float current_temperature_bed;
|
85
|
85
|
//inline so that there is no performance decrease.
|
86
|
86
|
//deg=degreeCelsius
|
87
|
87
|
|
88
|
|
-FORCE_INLINE float degHotend(uint8_t extruder) {
|
89
|
|
- return current_temperature[extruder];
|
90
|
|
-};
|
|
88
|
+FORCE_INLINE float degHotend(uint8_t extruder) { return current_temperature[extruder]; }
|
|
89
|
+FORCE_INLINE float degBed() { return current_temperature_bed; }
|
91
|
90
|
|
92
|
91
|
#ifdef SHOW_TEMP_ADC_VALUES
|
93
|
|
- FORCE_INLINE float rawHotendTemp(uint8_t extruder) {
|
94
|
|
- return current_temperature_raw[extruder];
|
95
|
|
- };
|
96
|
|
-
|
97
|
|
- FORCE_INLINE float rawBedTemp() {
|
98
|
|
- return current_temperature_bed_raw;
|
99
|
|
- };
|
|
92
|
+ FORCE_INLINE float rawHotendTemp(uint8_t extruder) { return current_temperature_raw[extruder]; }
|
|
93
|
+ FORCE_INLINE float rawBedTemp() { return current_temperature_bed_raw; }
|
100
|
94
|
#endif
|
101
|
95
|
|
102
|
|
-FORCE_INLINE float degBed() {
|
103
|
|
- return current_temperature_bed;
|
104
|
|
-};
|
105
|
|
-
|
106
|
|
-FORCE_INLINE float degTargetHotend(uint8_t extruder) {
|
107
|
|
- return target_temperature[extruder];
|
108
|
|
-};
|
109
|
|
-
|
110
|
|
-FORCE_INLINE float degTargetBed() {
|
111
|
|
- return target_temperature_bed;
|
112
|
|
-};
|
113
|
|
-
|
114
|
|
-FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) {
|
115
|
|
- target_temperature[extruder] = celsius;
|
116
|
|
-};
|
117
|
|
-
|
118
|
|
-FORCE_INLINE void setTargetBed(const float &celsius) {
|
119
|
|
- target_temperature_bed = celsius;
|
120
|
|
-};
|
|
96
|
+FORCE_INLINE float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; }
|
|
97
|
+FORCE_INLINE float degTargetBed() { return target_temperature_bed; }
|
121
|
98
|
|
122
|
|
-FORCE_INLINE bool isHeatingHotend(uint8_t extruder){
|
123
|
|
- return target_temperature[extruder] > current_temperature[extruder];
|
124
|
|
-};
|
|
99
|
+FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) { target_temperature[extruder] = celsius; }
|
|
100
|
+FORCE_INLINE void setTargetBed(const float &celsius) { target_temperature_bed = celsius; }
|
125
|
101
|
|
126
|
|
-FORCE_INLINE bool isHeatingBed() {
|
127
|
|
- return target_temperature_bed > current_temperature_bed;
|
128
|
|
-};
|
|
102
|
+FORCE_INLINE bool isHeatingHotend(uint8_t extruder) { return target_temperature[extruder] > current_temperature[extruder]; }
|
|
103
|
+FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
|
129
|
104
|
|
130
|
|
-FORCE_INLINE bool isCoolingHotend(uint8_t extruder) {
|
131
|
|
- return target_temperature[extruder] < current_temperature[extruder];
|
132
|
|
-};
|
133
|
|
-
|
134
|
|
-FORCE_INLINE bool isCoolingBed() {
|
135
|
|
- return target_temperature_bed < current_temperature_bed;
|
136
|
|
-};
|
|
105
|
+FORCE_INLINE bool isCoolingHotend(uint8_t extruder) { return target_temperature[extruder] < current_temperature[extruder]; }
|
|
106
|
+FORCE_INLINE bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
|
137
|
107
|
|
138
|
108
|
#define degHotend0() degHotend(0)
|
139
|
109
|
#define degTargetHotend0() degTargetHotend(0)
|
|
@@ -141,38 +111,36 @@ FORCE_INLINE bool isCoolingBed() {
|
141
|
111
|
#define isHeatingHotend0() isHeatingHotend(0)
|
142
|
112
|
#define isCoolingHotend0() isCoolingHotend(0)
|
143
|
113
|
#if EXTRUDERS > 1
|
144
|
|
-#define degHotend1() degHotend(1)
|
145
|
|
-#define degTargetHotend1() degTargetHotend(1)
|
146
|
|
-#define setTargetHotend1(_celsius) setTargetHotend((_celsius), 1)
|
147
|
|
-#define isHeatingHotend1() isHeatingHotend(1)
|
148
|
|
-#define isCoolingHotend1() isCoolingHotend(1)
|
|
114
|
+ #define degHotend1() degHotend(1)
|
|
115
|
+ #define degTargetHotend1() degTargetHotend(1)
|
|
116
|
+ #define setTargetHotend1(_celsius) setTargetHotend((_celsius), 1)
|
|
117
|
+ #define isHeatingHotend1() isHeatingHotend(1)
|
|
118
|
+ #define isCoolingHotend1() isCoolingHotend(1)
|
149
|
119
|
#else
|
150
|
|
-#define setTargetHotend1(_celsius) do{}while(0)
|
|
120
|
+ #define setTargetHotend1(_celsius) do{}while(0)
|
151
|
121
|
#endif
|
152
|
122
|
#if EXTRUDERS > 2
|
153
|
|
-#define degHotend2() degHotend(2)
|
154
|
|
-#define degTargetHotend2() degTargetHotend(2)
|
155
|
|
-#define setTargetHotend2(_celsius) setTargetHotend((_celsius), 2)
|
156
|
|
-#define isHeatingHotend2() isHeatingHotend(2)
|
157
|
|
-#define isCoolingHotend2() isCoolingHotend(2)
|
|
123
|
+ #define degHotend2() degHotend(2)
|
|
124
|
+ #define degTargetHotend2() degTargetHotend(2)
|
|
125
|
+ #define setTargetHotend2(_celsius) setTargetHotend((_celsius), 2)
|
|
126
|
+ #define isHeatingHotend2() isHeatingHotend(2)
|
|
127
|
+ #define isCoolingHotend2() isCoolingHotend(2)
|
158
|
128
|
#else
|
159
|
|
-#define setTargetHotend2(_celsius) do{}while(0)
|
|
129
|
+ #define setTargetHotend2(_celsius) do{}while(0)
|
160
|
130
|
#endif
|
161
|
131
|
#if EXTRUDERS > 3
|
162
|
|
-#define degHotend3() degHotend(3)
|
163
|
|
-#define degTargetHotend3() degTargetHotend(3)
|
164
|
|
-#define setTargetHotend3(_celsius) setTargetHotend((_celsius), 3)
|
165
|
|
-#define isHeatingHotend3() isHeatingHotend(3)
|
166
|
|
-#define isCoolingHotend3() isCoolingHotend(3)
|
|
132
|
+ #define degHotend3() degHotend(3)
|
|
133
|
+ #define degTargetHotend3() degTargetHotend(3)
|
|
134
|
+ #define setTargetHotend3(_celsius) setTargetHotend((_celsius), 3)
|
|
135
|
+ #define isHeatingHotend3() isHeatingHotend(3)
|
|
136
|
+ #define isCoolingHotend3() isCoolingHotend(3)
|
167
|
137
|
#else
|
168
|
|
-#define setTargetHotend3(_celsius) do{}while(0)
|
|
138
|
+ #define setTargetHotend3(_celsius) do{}while(0)
|
169
|
139
|
#endif
|
170
|
140
|
#if EXTRUDERS > 4
|
171
|
|
-#error Invalid number of extruders
|
|
141
|
+ #error Invalid number of extruders
|
172
|
142
|
#endif
|
173
|
143
|
|
174
|
|
-
|
175
|
|
-
|
176
|
144
|
int getHeaterPower(int heater);
|
177
|
145
|
void disable_heater();
|
178
|
146
|
void setWatch();
|
|
@@ -189,15 +157,14 @@ static bool thermal_runaway = false;
|
189
|
157
|
#endif
|
190
|
158
|
#endif
|
191
|
159
|
|
192
|
|
-FORCE_INLINE void autotempShutdown(){
|
193
|
|
-#ifdef AUTOTEMP
|
194
|
|
- if(autotemp_enabled)
|
195
|
|
- {
|
196
|
|
- autotemp_enabled=false;
|
197
|
|
- if(degTargetHotend(active_extruder)>autotemp_min)
|
198
|
|
- setTargetHotend(0,active_extruder);
|
199
|
|
- }
|
200
|
|
-#endif
|
|
160
|
+FORCE_INLINE void autotempShutdown() {
|
|
161
|
+ #ifdef AUTOTEMP
|
|
162
|
+ if (autotemp_enabled) {
|
|
163
|
+ autotemp_enabled = false;
|
|
164
|
+ if (degTargetHotend(active_extruder) > autotemp_min)
|
|
165
|
+ setTargetHotend(0, active_extruder);
|
|
166
|
+ }
|
|
167
|
+ #endif
|
201
|
168
|
}
|
202
|
169
|
|
203
|
170
|
void PID_autotune(float temp, int extruder, int ncycles);
|