Quellcode durchsuchen

Fix PID + Thermal Protection combos (#18023)

Jason Smith vor 4 Jahren
Ursprung
Commit
94063e3a87
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 9
- 5
Marlin/Configuration.h Datei anzeigen

@@ -479,16 +479,12 @@
479 479
 #define BANG_MAX 255     // Limits current to nozzle while in bang-bang mode; 255=full current
480 480
 #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
481 481
 #define PID_K1 0.95      // Smoothing factor within any PID loop
482
+
482 483
 #if ENABLED(PIDTEMP)
483 484
   //#define PID_EDIT_MENU         // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
484 485
   //#define PID_AUTOTUNE_MENU     // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
485
-  //#define PID_DEBUG             // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
486
-  //#define PID_OPENLOOP 1        // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
487
-  //#define SLOW_PWM_HEATERS      // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
488 486
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
489 487
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
490
-  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
491
-                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
492 488
 
493 489
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
494 490
 
@@ -557,6 +553,14 @@
557 553
   // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
558 554
 #endif // PIDTEMPBED
559 555
 
556
+#if EITHER(PIDTEMP, PIDTEMPBED)
557
+  //#define PID_DEBUG             // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
558
+  //#define PID_OPENLOOP          // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
559
+  //#define SLOW_PWM_HEATERS      // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
560
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
561
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
562
+#endif 
563
+
560 564
 // @section extruder
561 565
 
562 566
 /**

+ 7
- 7
Marlin/src/module/temperature.cpp Datei anzeigen

@@ -381,15 +381,15 @@ volatile bool Temperature::raw_temps_ready = false;
381 381
       #define ONHEATINGSTART() printerEventLEDs.onHotendHeatingStart()
382 382
       #define ONHEATING(S,C,T) printerEventLEDs.onHotendHeating(S,C,T)
383 383
     #endif
384
+    #define WATCH_PID BOTH(WATCH_BED, PIDTEMPBED) || BOTH(WATCH_HOTENDS, PIDTEMP)
384 385
 
385
-    #if WATCH_BED || WATCH_HOTENDS
386
-      #define HAS_TP_BED BOTH(THERMAL_PROTECTION_BED, PIDTEMPBED)
387
-      #if HAS_TP_BED && BOTH(THERMAL_PROTECTION_HOTENDS, PIDTEMP)
386
+    #if WATCH_PID
387
+      #if ALL(THERMAL_PROTECTION_HOTENDS, PIDTEMP, THERMAL_PROTECTION_BED, PIDTEMPBED)
388 388
         #define GTV(B,H) (isbed ? (B) : (H))
389
-      #elif HAS_TP_BED
390
-        #define GTV(B,H) (B)
391
-      #else
389
+      #elif BOTH(THERMAL_PROTECTION_HOTENDS, PIDTEMP)
392 390
         #define GTV(B,H) (H)
391
+      #else
392
+        #define GTV(B,H) (B)
393 393
       #endif
394 394
       const uint16_t watch_temp_period = GTV(WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD);
395 395
       const uint8_t watch_temp_increase = GTV(WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE);
@@ -528,7 +528,7 @@ volatile bool Temperature::raw_temps_ready = false;
528 528
         next_temp_ms = ms + 2000UL;
529 529
 
530 530
         // Make sure heating is actually working
531
-        #if WATCH_BED || WATCH_HOTENDS
531
+        #if WATCH_PID
532 532
           if (BOTH(WATCH_BED, WATCH_HOTENDS) || isbed == DISABLED(WATCH_HOTENDS)) {
533 533
             if (!heated) {                                            // If not yet reached target...
534 534
               if (current_temp > next_watch_temp) {                   // Over the watch temp?

+ 4
- 2
buildroot/share/tests/mks_robin_pro-tests Datei anzeigen

@@ -10,7 +10,9 @@ use_example_configs Mks/Robin_Pro
10 10
 opt_set SDCARD_CONNECTION LCD
11 11
 opt_set X_DRIVER_TYPE TMC2209
12 12
 opt_set Y_DRIVER_TYPE TMC2130
13
-exec_test $1 $2 "MKS Robin Pro with TMC Drivers "
13
+opt_set TEMP_SENSOR_BED 1
14
+opt_disable THERMAL_PROTECTION_HOTENDS
15
+exec_test $1 $2 "MKS Robin Pro with TMC Drivers, hotend thermal protection disabled"
14 16
 
15 17
 # cleanup
16
-restore_configs
18
+#restore_configs

+ 5
- 1
buildroot/share/tests/rumba32_f446ve-tests Datei anzeigen

@@ -10,8 +10,12 @@ set -e
10 10
 restore_configs
11 11
 opt_set MOTHERBOARD BOARD_RUMBA32_AUS3D
12 12
 opt_set SERIAL_PORT -1
13
+opt_disable PIDTEMP
14
+opt_enable PIDTEMPBED
15
+opt_set TEMP_SENSOR_BED 1
16
+opt_disable THERMAL_PROTECTION_BED
13 17
 opt_set X_DRIVER_TYPE TMC2130
14
-exec_test $1 $2 "rumba32_f446ve Default Config with TMC2130"
18
+exec_test $1 $2 "rumba32_f446ve with TMC2130, PID Bed, and bed thermal protection disabled"
15 19
 
16 20
 # cleanup
17 21
 restore_configs

Laden…
Abbrechen
Speichern