ソースを参照

Cleanup around updatePID

Scott Lahteine 6年前
コミット
b0ff3a4c6d
3個のファイルの変更19行の追加16行の削除
  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 ファイルの表示

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

+ 7
- 9
Marlin/temperature.cpp ファイルの表示

215
 
215
 
216
 #if HAS_PID_HEATING
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
   void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) {
224
   void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) {
219
     float input = 0.0;
225
     float input = 0.0;
220
     int cycles = 0;
226
     int cycles = 0;
466
           bedKp = workKp; \
472
           bedKp = workKp; \
467
           bedKi = scalePID_i(workKi); \
473
           bedKi = scalePID_i(workKi); \
468
           bedKd = scalePID_d(workKd); \
474
           bedKd = scalePID_d(workKd); \
469
-          updatePID(); }while(0)
475
+          }while(0)
470
 
476
 
471
         #define _SET_EXTRUDER_PID() do { \
477
         #define _SET_EXTRUDER_PID() do { \
472
           PID_PARAM(Kp, hotend) = workKp; \
478
           PID_PARAM(Kp, hotend) = workKp; \
502
 
508
 
503
 Temperature::Temperature() { }
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
 int Temperature::getHeaterPower(int heater) {
511
 int Temperature::getHeaterPower(int heater) {
514
   return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater];
512
   return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater];
515
 }
513
 }

+ 12
- 5
Marlin/temperature.h ファイルの表示

438
      */
438
      */
439
     #if HAS_PID_HEATING
439
     #if HAS_PID_HEATING
440
       static void PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result=false);
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
     #if ENABLED(BABYSTEPPING)
455
     #if ENABLED(BABYSTEPPING)
449
 
456
 

読み込み中…
キャンセル
保存