Преглед на файлове

Cleanup around updatePID

Scott Lahteine преди 7 години
родител
ревизия
1ed86adf9c
променени са 3 файла, в които са добавени 19 реда и са изтрити 16 реда
  1. 0
    2
      Marlin/src/gcode/config/M304.cpp
  2. 7
    9
      Marlin/src/module/temperature.cpp
  3. 12
    5
      Marlin/src/module/temperature.h

+ 0
- 2
Marlin/src/gcode/config/M304.cpp Целия файл

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

+ 7
- 9
Marlin/src/module/temperature.cpp Целия файл

217
 
217
 
218
 #if HAS_PID_HEATING
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
   void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) {
226
   void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) {
221
     float input = 0.0;
227
     float input = 0.0;
222
     int cycles = 0;
228
     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/src/module/temperature.h Целия файл

430
      */
430
      */
431
     #if HAS_PID_HEATING
431
     #if HAS_PID_HEATING
432
       static void PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result=false);
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
     #if ENABLED(BABYSTEPPING)
447
     #if ENABLED(BABYSTEPPING)
441
 
448
 

Loading…
Отказ
Запис