Browse Source

Cleanup around updatePID

Scott Lahteine 7 years ago
parent
commit
1ed86adf9c

+ 0
- 2
Marlin/src/gcode/config/M304.cpp View File

@@ -32,8 +32,6 @@ void GcodeSuite::M304() {
32 32
   if (parser.seen('I')) thermalManager.bedKi = scalePID_i(parser.value_float());
33 33
   if (parser.seen('D')) thermalManager.bedKd = scalePID_d(parser.value_float());
34 34
 
35
-  thermalManager.updatePID();
36
-
37 35
   SERIAL_ECHO_START();
38 36
   SERIAL_ECHOPAIR(" p:", thermalManager.bedKp);
39 37
   SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.bedKi));

+ 7
- 9
Marlin/src/module/temperature.cpp View File

@@ -217,6 +217,12 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
217 217
 
218 218
 #if HAS_PID_HEATING
219 219
 
220
+  /**
221
+   * PID Autotuning (M303)
222
+   *
223
+   * Alternately heat and cool the nozzle, observing its behavior to
224
+   * determine the best PID values to achieve a stable temperature.
225
+   */
220 226
   void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) {
221 227
     float input = 0.0;
222 228
     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/src/module/temperature.h View File

@@ -430,12 +430,19 @@ class Temperature {
430 430
      */
431 431
     #if HAS_PID_HEATING
432 432
       static void PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result=false);
433
-    #endif
434 433
 
435
-    /**
436
-     * Update the temp manager when PID values change
437
-     */
438
-    static void updatePID();
434
+      #if ENABLED(PIDTEMP)
435
+        /**
436
+         * Update the temp manager when PID values change
437
+         */
438
+        FORCE_INLINE static void updatePID() {
439
+          #if ENABLED(PID_EXTRUSION_SCALING)
440
+            last_e_position = 0;
441
+          #endif
442
+        }
443
+      #endif
444
+
445
+    #endif
439 446
 
440 447
     #if ENABLED(BABYSTEPPING)
441 448
 

Loading…
Cancel
Save