@@ -199,18 +199,9 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
199
199
void set (const raw_pid_t &raw) { set (raw.p , raw.i , raw.d ); }
200
200
void set (const raw_pidcf_t &raw) { set (raw.p , raw.i , raw.d , raw.c , raw.f ); }
201
201
202
- float get_fan_scale_output (const uint8_t fan_speed) {
203
- UNUSED (fan_speed);
204
- return 0 ;
205
- }
202
+ float get_fan_scale_output (const uint8_t ) { return 0 ; }
206
203
207
- float get_extrusion_scale_output (const bool is_active, const long e_position, const float e_mm_per_step, const int16_t lpq_len) {
208
- UNUSED (is_active);
209
- UNUSED (e_position);
210
- UNUSED (e_mm_per_step);
211
- UNUSED (lpq_len);
212
- return 0 ;
213
- }
204
+ float get_extrusion_scale_output (const bool , const int32_t , const float , const int16_t ) { return 0 ; }
214
205
215
206
float get_pid_output (const float target, const float current) {
216
207
const float pid_error = target - current;
@@ -274,29 +265,24 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
274
265
base::reset ();
275
266
prev_e_pos = 0 ;
276
267
lpq_ptr = 0 ;
277
- LOOP_L_N (i, LPQ_ARR_SZ) {
278
- lpq[i] = 0 ;
279
- }
268
+ LOOP_L_N (i, LPQ_ARR_SZ) lpq[i] = 0 ;
280
269
}
281
270
282
- float get_extrusion_scale_output (const bool is_active, const long e_position, const float e_mm_per_step, const int16_t lpq_len) {
271
+ float get_extrusion_scale_output (const bool is_active, const int32_t e_position, const float e_mm_per_step, const int16_t lpq_len) {
283
272
work_c = 0 ;
284
- if (!is_active) {
285
- return work_c; // 0
286
- }
273
+ if (!is_active) return work_c;
287
274
288
275
if (e_position > prev_e_pos) {
289
276
lpq[lpq_ptr] = e_position - prev_e_pos;
290
277
prev_e_pos = e_position;
291
278
}
292
- else {
279
+ else
293
280
lpq[lpq_ptr] = 0 ;
294
- }
295
281
296
282
++lpq_ptr;
297
- if (lpq_ptr >= LPQ_ARR_SZ || lpq_ptr >= lpq_len) {
283
+
284
+ if (lpq_ptr >= LPQ_ARR_SZ || lpq_ptr >= lpq_len)
298
285
lpq_ptr = 0 ;
299
- }
300
286
301
287
work_c = (lpq[lpq_ptr] * e_mm_per_step) * Kc;
302
288
@@ -331,9 +317,9 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
331
317
332
318
float get_fan_scale_output (const uint8_t fan_speed) {
333
319
work_f = 0 ;
334
- if (fan_speed > SCALE_MIN_SPEED) {
320
+ if (fan_speed > SCALE_MIN_SPEED)
335
321
work_f = Kf + (SCALE_LIN_FACTOR) * fan_speed;
336
- }
322
+
337
323
return work_f;
338
324
}
339
325
};
@@ -363,18 +349,13 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
363
349
void set (const raw_pid_t &raw) { set (raw.p , raw.i , raw.d ); }
364
350
void set (const raw_pidcf_t &raw) { set (raw.p , raw.i , raw.d , raw.c , raw.f ); }
365
351
366
- void reset () {
367
- cPID::reset ();
368
- }
352
+ void reset () { cPID::reset (); }
369
353
370
354
float get_fan_scale_output (const uint8_t fan_speed) {
371
- work_f = 0 ;
372
- if (fan_speed > SCALE_MIN_SPEED) {
373
- work_f = Kf + (SCALE_LIN_FACTOR) * fan_speed;
374
- }
355
+ work_f = fan_speed > (SCALE_MIN_SPEED) ? Kf + (SCALE_LIN_FACTOR) * fan_speed : 0 ;
375
356
return work_f;
376
357
}
377
- float get_extrusion_scale_output (const bool is_active, const long e_position, const float e_mm_per_step, const int16_t lpq_len) {
358
+ float get_extrusion_scale_output (const bool is_active, const int32_t e_position, const float e_mm_per_step, const int16_t lpq_len) {
378
359
return cPID::get_extrusion_scale_output (is_active, e_position, e_mm_per_step, lpq_len);
379
360
}
380
361
};
@@ -1174,9 +1155,7 @@ class Temperature {
1174
1155
1175
1156
// Update the temp manager when PID values change
1176
1157
#if ENABLED(PIDTEMP)
1177
- static void updatePID () {
1178
- HOTEND_LOOP () temp_hotend[e].pid .reset ();
1179
- }
1158
+ static void updatePID () { HOTEND_LOOP () temp_hotend[e].pid .reset (); }
1180
1159
static void setPID (const uint8_t hotend, const_float_t p, const_float_t i, const_float_t d) {
1181
1160
#if ENABLED(PID_PARAMS_PER_HOTEND)
1182
1161
temp_hotend[hotend].pid .set (p, i, d);
0 commit comments