Kaynağa Gözat

Cleanup around updatePID

Scott Lahteine 6 yıl önce
ebeveyn
işleme
b0ff3a4c6d
3 değiştirilmiş dosya ile 19 ekleme ve 16 silme
  1. 0
    2
      Marlin/Marlin_main.cpp
  2. 7
    9
      Marlin/temperature.cpp
  3. 12
    5
      Marlin/temperature.h

+ 0
- 2
Marlin/Marlin_main.cpp Dosyayı Görüntüle

@@ -9428,8 +9428,6 @@ inline void gcode_M226() {
9428 9428
     if (parser.seen('I')) thermalManager.bedKi = scalePID_i(parser.value_float());
9429 9429
     if (parser.seen('D')) thermalManager.bedKd = scalePID_d(parser.value_float());
9430 9430
 
9431
-    thermalManager.updatePID();
9432
-
9433 9431
     SERIAL_ECHO_START();
9434 9432
     SERIAL_ECHOPAIR(" p:", thermalManager.bedKp);
9435 9433
     SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.bedKi));

+ 7
- 9
Marlin/temperature.cpp Dosyayı Görüntüle

@@ -215,6 +215,12 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
215 215
 
216 216
 #if HAS_PID_HEATING
217 217
 
218
+  /**
219
+   * PID Autotuning (M303)
220
+   *
221
+   * Alternately heat and cool the nozzle, observing its behavior to
222
+   * determine the best PID values to achieve a stable temperature.
223
+   */
218 224
   void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) {
219 225
     float input = 0.0;
220 226
     int cycles = 0;
@@ -466,7 +472,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
466 472
           bedKp = workKp; \
467 473
           bedKi = scalePID_i(workKi); \
468 474
           bedKd = scalePID_d(workKd); \
469
-          updatePID(); }while(0)
475
+          }while(0)
470 476
 
471 477
         #define _SET_EXTRUDER_PID() do { \
472 478
           PID_PARAM(Kp, hotend) = workKp; \
@@ -502,14 +508,6 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
502 508
 
503 509
 Temperature::Temperature() { }
504 510
 
505
-void Temperature::updatePID() {
506
-  #if ENABLED(PIDTEMP)
507
-    #if ENABLED(PID_EXTRUSION_SCALING)
508
-      last_e_position = 0;
509
-    #endif
510
-  #endif
511
-}
512
-
513 511
 int Temperature::getHeaterPower(int heater) {
514 512
   return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater];
515 513
 }

+ 12
- 5
Marlin/temperature.h Dosyayı Görüntüle

@@ -438,12 +438,19 @@ class Temperature {
438 438
      */
439 439
     #if HAS_PID_HEATING
440 440
       static void PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result=false);
441
-    #endif
442 441
 
443
-    /**
444
-     * Update the temp manager when PID values change
445
-     */
446
-    static void updatePID();
442
+      /**
443
+       * Update the temp manager when PID values change
444
+       */
445
+      #if ENABLED(PIDTEMP)
446
+        FORCE_INLINE static void updatePID() {
447
+          #if ENABLED(PID_EXTRUSION_SCALING)
448
+            last_e_position = 0;
449
+          #endif
450
+        }
451
+      #endif
452
+
453
+    #endif
447 454
 
448 455
     #if ENABLED(BABYSTEPPING)
449 456
 

Loading…
İptal
Kaydet